-
Notifications
You must be signed in to change notification settings - Fork 25
ArchitectureGlossary
Some definitions useful to understand the main concepts of TypeCobol:
Concept | Definition |
---|---|
Token | Elementary text part of source code. A token cannot be subdivided, tokens are produced during Scanning step |
SyntaxProperty | Used to associate a Token to a value. It's especially useful for codegen and languageServer |
SymbolDefinition | One or more token used to define something. It can be a variable, a program name, a file name, ... |
SymbolReference | One or more token used to reference something. It can be a variable, a program name, a file name, ... |
URI | Deprecated. It's a duplicate of SymbolReference/SymbolDefinition. It'll be deleted |
StorageArea | Represent a memory zone associated with a reference. |
Variable | Can be a StorageArea or a constant value (like a literal) |
CodeElement | A CodeElement is an object which represent a Cobol statement. Eg. MoveStatement, InitializeStatement. CodeElement cannot be linked together. An IfStatement cannot contains another statement. You have to use Node for that |
Node | A node is usually associated with a CodeElement. Node can be linked together in a tree structure. So you can have an IfNode which contains other Node |
Example:
01 Var1 pic X.
01 Var2 pic X.
move Var1 to Var2
On the first line: 01
, Var1
, pic
, X
, .
are tokens.
See classes : TypeCobol.Compiler.Scanner.Token
and TypeCobol.Compiler.Scanner.Scanner
Example:
01 Var1 PIC X(02) GLOBAL.
The GLOBAL
keyword will be turned into a SyntaxProperty<bool>
which associates the GLOBAL
keyword with the logical value true
. It materializes the presence of the GLOBAL modifier for this data definition.
See classes : TypeCobol.Compiler.CodeElements.SyntaxProperty
and TypeCobol.Compiler.Parser.CodeElementBuilder
Example:
IDENTIFICATION DIVISION.
PROGRAM-ID. MyPgm1.
The token MyPgm1
will be turned into a SymbolDefinition
with a type of ProgramName
. The SymbolDefinition
class associates a name (materialized by a token) with basic type information indicating the nature of the definition.
See classes : TypeCobol.Compiler.CodeElements.SymbolDefinition
and TypeCobol.Compiler.Parser.CobolWordsBuilder
Example:
PERFORM para-1 THRU para-4
Both para-1
and para-4
tokens will be turned into SymbolReference
instances. Just like SymbolDefinition
, a type is associated with the reference to describe the nature of the name used. Here the names are ambiguous because para-1
and para-4
may refer to paragraphs or sections.
See classes : TypeCobol.Compiler.CodeElements.SymbolReference
and TypeCobol.Compiler.Parser.CobolWordsBuilder
Introduction
TypeCobol language
-
In a nutshell
-
TypeCobol concepts
TypeCobol Editor
(Type)Cobol parser API
TypeCobol architecture
- Glossary
- Main phases
- How to extend the grammar and semantic check (full example)
- File
- Text
- Code analysis steps
- Program class parser
- Type checker
- Error handler
- Grammars Composition
- Code generation
- Compilation process
(Type)Cobol concepts / reference doc
Contributing