Abstract Syntax Tree Node Diagrams

M2C Modula-2 Compiler & Translator
Abstract Syntax Tree Node Diagrams
Version 1.04 -- January 12, 2016
Copyright (c) 2016 Benjamin Kowarsch.
Reproduction for academic and personal use permitted.
Any reproduction on aggregator websites is strictly prohibited.
Legend
label
NODE
label
ALTERNATIVE-1
NODE
ALTERNATIVE-2
SUBNODE-1
LEAFNODE
SUBNODE-2
value
AST Root Node
astRoot
AST
FILENAME
"filename"
"opt-0"
OPTIONS
"opt-1"
"opt-2"
compilationUnit
...
"opt-N"
DEFMOD
IMPMOD
Definition Module Node
DEFMOD
IDENT
moduleIdent
import-0
IMPLIST
import-1
import-2
...
importList
definitionList
EMPTY
DEFLIST
import-N
defn-0
defn-1
defn-2
EMPTY
...
defn-N
Import Nodes
import
IMPORT
UNQIMP
identList
IDENT
moduleIdent
identList
Definition Nodes
defn
CONSTDEF
IDENT
constIdent
expr
TYPEDEF
VARDECL
IDENT
typeDefn
identList
typeIdent
type
EMPTY
PROCDEF
fieldType
IDENT
procIdent
formalParamList
anyIdent
retType
EMPTY
Identifier and Qualified Identifier Nodes
anyIdent
ident
qualident
IDENT
QUALIDENT
identifier
qualifier-0
qualifier-1
qualifier-2
...
qualifier-N
identifier
Identifier List Node
identList
IDENTLIST
identifier-0
identifier-1
identifier-2
...
identifier-N
Type Nodes
type
countableType
anyIdent
SUBR
ENUM
recordType
SET
ARRAY
RECORD
EXTREC
VRNTREC
POINTER
PROCTYPE
Field Type Nodes
fieldType
countableType
anyIdent
SUBR
ENUM
SET
ARRAY
RECORD
POINTER
PROCTYPE
Subrange, Enumeration and Set Type Nodes
SUBR
lowerBound
upperBound
expr
expr
subrBaseType
anyIdent
EMPTY
ENUM
SET
identList
countableType
anyIdent
SUBR
ENUM
Array Type Node
ARRAY
INDEXLIST
indexType-0
indexType-1
indexType-2
indexType
arrayBaseType
...
indexType-N
fieldType
countableType
Simple and Extensible Record Type Nodes
fieldList-0
fieldList-1
RECORD
fieldList
FIELDLISTSEQ
FIELDLIST
fieldList-2
...
fieldList-N
identList
EXTREC
fieldType
recBaseType
anyIdent
FIELDLISTSEQ
Variant Record Type Node
VRNTREC
VFLISTSEQ
variantRecordFieldList-0
variantRecordFieldList-1
variantRecordFieldList-2
...
variantRecordFieldList-N
Variant Record Field List Node
variantRecordFieldList
fieldList
variantFieldList
VFLIST
caseIdent
IDENT
EMPTY
caseType
anyType
VARIANTLIST
variant-0
variant-1
identifier
variant-2
variant
VARIANT
CLABELLIST
FIELDLISTSEQ
defaultFieldListSeq
...
variant-N
FIELDLISTSEQ
EMPTY
Case Label List Node
CLABELLIST
caseLabels-0
caseLabels-1
caseLabels-2
CASELABELS
...
caseLabels-N
startLabel
expr
endLabel
expr
EMPTY
Pointer and Procedure Type Nodes
POINTER
PROCTYPE
type
formalTypeList
formalType-0
formalType-1
FTYPELIST
EMPTY
formalType-2
...
retType
anyIdent
formalType-N
EMPTY
Formal Type Node
formalType
simpleOrAttrFormalType
simpleFormalType
attrFormalType
typeIdent
OPENARRAY
CONSTP
anyIdent
typeIdent
simpleFormalType
anyIdent
VARP
simpleFormalType
Formal Parameter List Node
formalParamList
FPARAMLIST
formalParams-0
formalParams-1
formalParams-2
formalParams
EMPTY
...
FPARAMS
formalParams-N
identList
FORMALTYPE
Program or Implementation Module Node
IMPMOD
IDENT
moduleIdent
priority
importList
expr
EMPTY
block
Block Node
block
BLOCK
declarationList
DECLLIST
decl-0
decl-1
decl-2
body
EMPTY
...
decl-N
statement-0
statement-1
STMTSEQ
EMPTY
statement-2
...
statement-N
Declaration Nodes
decl
CONSTDEF
TYPEDECL
IDENT
typeDecl
typeIdent
type
VARDECL
identList
vsrType
fieldType
PROC
IDENT
procIdent
localModule
formalParamList
anyIdent
retType
block
EMPTY
Local Module Declaration Node
localModule
MODDECL
IDENT
moduleIdent
priority
importList
exportList
block
EXPORT
QUALEXP
EMPTY
identList
identList
Variable Size Record Type Declaration Node
vsrType
VSREC
FIELDLISTSEQ
VSFIELD
varSizeField
determinantField
varSizeFieldType
IDENT
IDENT
anyIdent
fieldIdent
determinantFieldIdent
Statement Nodes
statement
assignment
procCall
retStmt
withStmt
ifStmt
caseStmt
loopStmt
whileStmt
rptStmt
forStmt
EXIT
Assignment, Procedure Call, Return and With Statement Nodes
assignment
procCall
retStmt
withStmt
ASSIGN
PCALL
RETURN
WITH
designator
expr
expr-0
designator
expr-1
actualParams
ARGS
EMPTY
expr-2
...
returnValue
expr
expr-N
EMPTY
designator
STMTSEQ
If Statement Node
expr
STMTSEQ
elsifBranch-0
elsifBranch-1
ifBranch
ifStmt
elsifBranch
IF
ELSIF
elsifSeq
ELSIFSEQ
elsifBranch-2
elseBranch
EMPTY
...
STMTSEQ
elsifBranch-N
expr
EMPTY
STMTSEQ
Case Statement Node
expr
caseBranch-0
caseBranch-1
caseStmt
caseBranch
SWITCH
CASE
CASELIST
caseBranch-2
elseBranch
...
caseBranch-N
STMTSEQ
CLABELLIST
EMPTY
STMTSEQ
Loop, While and Repeat Statement Nodes
loopStmt
whileStmt
rptStmt
LOOP
WHILE
REPEAT
STMTSEQ
expr
STMTSEQ
STMTSEQ
expr
For Statement Node
forStmt
FORTO
IDENT
startValue
endValue
loopVariant
expr
expr
stepValue
expr
STMTSEQ
EMPTY
Expression Nodes
expr
boolExpr
relationalExpr
arithmeticExpr
designator
funcCall
setValue
literalValue
Boolean Operation Expression Nodes
boolExpr
NOT
expr
OR
expr
AND
expr
expr
expr
Relational Operation Expression Nodes
relationalExpr
EQ
expr
expr
NEQ
expr
expr
LT
expr
expr
LTEQ
expr
GT
expr
expr
GTEQ
expr
expr
IN
expr
expr
expr
Arithmetic Operation Expression Nodes
arithmeticExpr
NEG
expr
PLUS
expr
expr
MINUS
expr
expr
ASTERISK
expr
expr
SOLIDUS
expr
DIV
expr
expr
MOD
expr
expr
expr
Designator Nodes
designator
anyIdent
DEREF
designator
anyIdent
DESIG
head
tail
DEREF
FIELD
INDEX
selector
anyIdent
expr-0
DESIG
expr-1
expr-2
...
expr-N
Function Call Node
funcCall
FCALL
designator
expr-0
expr-1
actualParams
ARGS
EMPTY
expr-2
...
expr-N
Set Value Node
setValue
SETVAL
setTypeIdent
anyIdent
expr-0
EMPTY
expr-1
elementList
ARGS
EMPTY
expr-2
...
expr-N
Literal Value Nodes
literalValue
INTVAL
whole number value
REALVAL
real number value
CHRVAL
character code value
QUOTEDVAL
"quoted character or string"