crs
Syntatic Analysis
Context-Free Language Grammar Analysis
EBNF Grammar
The specification for the syntactic analysis of the language is shown with the productions below in EBNF syntax.
LHS | → | RHS |
---|---|---|
prog | → | {classDecl} {funcDef} program funcBody ; |
classDecl | → | class id [: id {, id }] { {varDecl} {funcDecl} } ; |
funcDecl | → | type id ( fParams ) ; |
funcHead | → | type [ id :: ] id ( fParams ) |
funcDef | → | funcHead funcBody ; |
funcBody | → | { {varDecl} {statement} } |
varDecl | → | type id {arraySize} ; |
statement | → | assignStat | if ( expr ) then statBlock else statBlock ; | for ( type id assignOp expr ; relExpr ; assignStat ) statBlock ; | get ( variable ) ; | put ( expr ) ; | return ( expr ) ; |
assignStat | → | variable assignOp expr |
statBlock | → | { {statement} } | statement | ε |
expr | → | arithExpr | relExpr |
relExpr | → | arithExpr relOp arithExpr |
arithExpr | → | arithExpr addOp term | term |
sign | → | + | - |
term | → | term multOp factor | factor |
factor | → | variable | functionCall | intNum | floatNum | ( arithExpr ) | ( not | ! ) factor | sign factor |
variable | → | {idnest} id {indice} |
functionCall | → | {idnest} id ( aParams ) |
idnest | → | id {indice} . | id ( aParams ) . |
indice | → | [ arithExpr ] |
arraySize | → | [ intNum ] |
type | → | int | float | id |
fParams | → | type id {arraySize} {fParamsTail} | ε |
aParams | → | expr {aParamsTail} | ε |
fParamsTail | → | , type id {arraySize} |
aParamsTail | → | , expr |
assignOp | → | = |
relOp | → | == | <> | < | > | <= | >= |
addOp | → | + | - | or | ¦¦ |
multOp | → | * | / | and | && |
BNF Grammar
An EBNF grammar can be converted to a BNF grammar by applying the following rules:
- For every instance of {X}, extract it to a new nonterminal Y and add the production Y → Y X | ε.
- For every instance of [X], extract it to a new nonterminal Y and add the production Y → X | ε.
- For every instance of (X), extract it to a new nonterminal Y and add the production Y → X.
The syntactic language specification in EBNF format was converted to a BNF grammar shown below.
LHS | → | RHS |
---|---|---|
prog | → | classDeclRecursion funcDefRecursion program funcBody ; |
classDeclRecursion | → | classDeclRecursion classDecl | ε |
classDecl | → | class id optionalInheritance { varDeclRecursion funcDeclRecursion } ; |
optionalInheritance | → | : id MultipleSuperClasses | ε |
MultipleSuperClasses | → | MultipleSuperClasses , id | ε |
funcDeclRecursion | → | funcDeclRecursion funcDecl | ε |
funcDecl | → | type id ( fParams ) ; |
funcHead | → | type optionalNamespace id ( fParams ) |
optionalNamespace | → | id :: | ε |
funcDefRecursion | → | funcDefRecursion funcDef | ε |
funcDef | → | funcHead funcBody ; |
funcBody | → | { varDeclRecursion statementRecursion } |
varDeclRecursion | → | varDeclRecursion varDecl | ε |
varDecl | → | type id arraySizeRecursion ; |
statementRecursion | → | statementRecursion statement | ε |
statement | → | assignStat | if ( expr ) then statBlock else statBlock ; | for ( type id assignOp expr ; relExpr ; assignStat ) statBlock ; | get ( variable ) ; | put ( expr ) ; | return ( expr ) ; |
assignStat | → | variable assignOp expr |
statBlock | → | { statementRecursion } | statement | ε |
expr | → | arithExpr | relExpr |
relExpr | → | arithExpr relOp arithExpr |
arithExpr | → | arithExpr addOp term | term |
sign | → | + | - |
term | → | term multOp factor | factor |
factor | → | variable | functionCall | intNum | floatNum | ( arithExpr ) | negationOperator factor | sign factor |
negationOperator | → | not | ! |
variable | → | idnestRecursion id indiceRecursion |
functionCall | → | idnestRecursion id ( aParams ) |
idnestRecursion | → | idnestRecursion idnest | ε |
idnest | → | id indiceRecursion . | id ( aParams ) . |
indiceRecursion | → | indiceRecursion indice | ε |
indice | → | [ arithExpr ] |
arraySizeRecursion | → | arraySizeRecursion arraySize | ε |
arraySize | → | [ intNum ] |
type | → | int | float | id |
fParams | → | type id arraySizeRecursion fParamsTailRecursion | ε |
aParams | → | expr aParamsTailRecursion | ε |
fParamsTailRecursion | → | fParamsTailRecursion fParamsTail | ε |
fParamsTail | → | , type id arraySizeRecursion |
aParamsTailRecursion | → | aParamsTailRecursion aParamsTail | ε |
aParamsTail | → | , expr |
assignOp | → | = |
relOp | → | == | <> | < | > | <= | >= |
addOp | → | + | - | or | ¦¦ |
multOp | → | * | / | and | && |
An AtoCC-compatible text format of the above grammar (with renamed variables) is shown below:
prog -> classDeclRecursion funcDefRecursion 'program' funcBody ';'
classDeclRecursion -> classDeclRecursion classDecl | EPSILON
classDecl -> 'class' 'id' optionalInheritance '{' varDeclRecursion funcDeclRecursion '}' ';'
optionalInheritance -> ':' 'id' multipleSuperClasses | EPSILON
multipleSuperClasses -> multipleSuperClasses ',' 'id' | EPSILON
funcDeclRecursion -> funcDeclRecursion funcDecl | EPSILON
funcDecl -> type 'id' '(' fParams ')' ';'
funcHead -> type optionalNamespace 'id' '(' fParams ')'
optionalNamespace -> 'id' '::' | EPSILON
funcDefRecursion -> funcDefRecursion funcDef | EPSILON
funcDef -> funcHead funcBody ';'
funcBody -> '{' varDeclRecursion statementRecursion '}'
varDeclRecursion -> varDeclRecursion varDecl | EPSILON
varDecl -> type 'id' arraySizeRecursion ';'
statementRecursion -> statementRecursion statement | EPSILON
statement -> assignStat | 'if' '(' expr ')' 'then' statBlock 'else' statBlock ';' | 'for' '(' type 'id' assignOp expr ';' relExpr ';' assignStat ')' statBlock ';' | 'get' '(' variable ')' ';' | 'put' '(' expr ')' ';' | 'return' '(' expr ')' ';'
assignStat -> variable assignOp expr
statBlock -> '{' statementRecursion '}' | statement | EPSILON
expr -> arithExpr | relExpr
relExpr -> arithExpr relOp arithExpr
arithExpr -> arithExpr addOp term | term
sign -> '+' | '-'
term -> term multOp factor | factor
factor -> variable | functionCall | 'intNum' | 'floatNum' | '(' arithExpr ')' | negationOperator factor | sign factor
negationOperator -> 'not' | '!'
variable -> idnestRecursion 'id' indiceRecursion
functionCall -> idnestRecursion 'id' '(' aParams ')'
idnestRecursion -> idnestRecursion idnest | EPSILON
idnest -> 'id' indiceRecursion '.' | 'id' '(' aParams ')' '.'
indiceRecursion -> indiceRecursion indice | EPSILON
indice -> '[' arithExpr ']'
arraySizeRecursion -> arraySizeRecursion arraySize | EPSILON
arraySize -> '[' 'intNum' ']'
type -> 'int' | 'float' | 'id'
fParams -> type 'id' arraySizeRecursion fParamsTailRecursion | EPSILON
aParams -> expr aParamsTailRecursion | EPSILON
fParamsTailRecursion -> fParamsTailRecursion fParamsTail | EPSILON
fParamsTail -> ',' type 'id' arraySizeRecursion
aParamsTailRecursion -> aParamsTailRecursion aParamsTail | EPSILON
aParamsTail -> ',' expr
assignOp -> '='
relOp -> '==' | '<>' | '<' | '>' | '<=' | '>='
addOp -> '+' | '-' | 'or' | '¦¦'
multOp -> '*' | '/' | 'and' | '&&'
Left-Factored, Right-Recursive and LL(1) Grammar
Left factoring is a technique used in predictive top-down parsers avoid the need for backtracking or lookaheads during parsing, such as is done in recursive descent. It involves the removal of any common left factor (terminal or non-terminal) that appears in a production with an or clause (|), or effectively two productions of the same non-terminal. Performing left factoring means that at a given non-terminal, there is a clear deterministic choice of which production to proceed towards.
Left recursion is avoided in recursive descent and predictive parsing strategies due to the possibility of an infinite loop, resulting in the compiler never terminating and with no progress.
Left-recursive productions can be replaced with right-recursive productions by applying the following rules:
For any production with the general form...
S → Sα1 | ... | Sαn | β1 | ... | βm
... replace with two productions:
S → β1 T | ... | βm T
T → α1 T | ... | α1 T | ε
This technique needs to be applied and the condition must hold for all non-terminal substitutions (one derivation step of a production).
Ambiguity in context-free grammars means that it can result in multiple possible derivations or parse trees. This is undesirable as we want our compiler to reliably generate the same parse tree given the same input program.
Using an LL(1) grammar for a syntactic analysis is attractive given that LL(1) grammars are known to be unambigiuous. Converting a grammar to LL(1) is an effective technique for dealing with ambiguities in general, giving that determining if an arbitrary grammar is ambiguous is an undecidable problem.
An attempt to use the following left-factoring online tool, left-recusion elimination online tool and CFG-to-LL(k) online tool was done. However, these tools were error-prone, and superior results were obtained by manipulating the grammar by hand while verifying with the AtoCC kfGEdit tool along the way.
Ultimately, too many changes were made to the grammar to describe every ambiguity, left factoring or left-recursion elimination. The resulting grammar is shown below in an AtoCC-compatible format (with renamed non-terminal symbols to more accurately represent their role).
Program -> ClassDeclarationRecursion FunctionDefinitionRecursion program FunctionBody ;
AdditiveOperator -> +
AdditiveOperator -> -
AdditiveOperator -> or
AdditiveOperator -> ¦¦
ArithmeticExpression -> Term ArithmeticExpressionTail
ArithmeticExpressionTail -> AdditiveOperator Term ArithmeticExpressionTail
ArithmeticExpressionTail -> EPSILON
ArithmeticOrRelationalExpression -> RelationalOperator ArithmeticExpression
ArithmeticOrRelationalExpression -> EPSILON
ArraySize -> [ intNum ]
ArraySizeRecursion -> ArraySize ArraySizeRecursion
ArraySizeRecursion -> EPSILON
AssignmentStatement -> Variable = Expression
ClassDeclaration -> class id OptionalInheritanceList { VariableThenFunctionDeclarationRecursion } ;
ClassDeclarationRecursion -> ClassDeclaration ClassDeclarationRecursion
ClassDeclarationRecursion -> EPSILON
Expression -> ArithmeticExpression ArithmeticOrRelationalExpression
Factor -> ( ArithmeticExpression )
Factor -> FunctionCallOrVariable
Factor -> NegationOperator Factor
Factor -> NumberSign Factor
Factor -> floatNum
Factor -> intNum
FunctionArguments -> Expression FunctionArgumentsTailRecursion
FunctionArguments -> EPSILON
FunctionArgumentsTail -> , Expression
FunctionArgumentsTailRecursion -> FunctionArgumentsTail FunctionArgumentsTailRecursion
FunctionArgumentsTailRecursion -> EPSILON
FunctionBody -> { VariableDeclarationRecursionThenStatementRecursionA }
FunctionCallOrVariable -> id FunctionCallOrVariableTail
FunctionCallOrVariableTail -> FunctionCallParensOrIndexing FunctionCallOrVariableTailRecursion
FunctionCallOrVariableTailRecursion -> . id FunctionCallOrVariableTail
FunctionCallOrVariableTailRecursion -> EPSILON
FunctionCallParensOrIndexing -> ( FunctionArguments )
FunctionCallParensOrIndexing -> IndexingRecursion
FunctionDeclarationRecursionStart -> Type id FunctionDeclarationRecursionTail
FunctionDeclarationRecursionStart -> EPSILON
FunctionDeclarationRecursionTail -> ( FunctionParameters ) ; FunctionDeclarationRecursionStart
FunctionDefinition -> FunctionHeader FunctionBody ;
FunctionDefinitionRecursion -> FunctionDefinition FunctionDefinitionRecursion
FunctionDefinitionRecursion -> EPSILON
FunctionHeader -> Type OptionalNamespacing ( FunctionParameters )
FunctionParameters -> Type id ArraySizeRecursion FunctionParametersTailRecursion
FunctionParameters -> EPSILON
FunctionParametersTail -> , Type id ArraySizeRecursion
FunctionParametersTailRecursion -> FunctionParametersTail FunctionParametersTailRecursion
FunctionParametersTailRecursion -> EPSILON
IdListRecursion -> , id IdListRecursion
IdListRecursion -> EPSILON
Indexing -> [ ArithmeticExpression ]
IndexingRecursion -> Indexing IndexingRecursion
IndexingRecursion -> EPSILON
MultiplicativeOperator -> &&
MultiplicativeOperator -> *
MultiplicativeOperator -> /
MultiplicativeOperator -> and
NegationOperator -> !
NegationOperator -> not
NumberSign -> +
NumberSign -> -
NumberType -> float
NumberType -> int
OptionalInheritanceList -> : id IdListRecursion
OptionalInheritanceList -> EPSILON
OptionalNamespacing -> id OptionalNamespacingTail
OptionalNamespacingTail -> :: id
OptionalNamespacingTail -> EPSILON
RelationalExpression -> ArithmeticExpression RelationalOperator ArithmeticExpression
RelationalOperator -> <>
RelationalOperator -> <
RelationalOperator -> <=
RelationalOperator -> ==
RelationalOperator -> >
RelationalOperator -> >=
Statement -> AssignmentStatement ;
Statement -> StatementWithoutAssignment
StatementBlock -> Statement
StatementBlock -> EPSILON
StatementBlock -> { StatementRecursion }
StatementRecursion -> Statement StatementRecursion
StatementRecursion -> EPSILON
StatementWithoutAssignment -> for ( Type id = Expression ; RelationalExpression ; AssignmentStatement ) StatementBlock ;
StatementWithoutAssignment -> get ( Variable ) ;
StatementWithoutAssignment -> if ( Expression ) then StatementBlock else StatementBlock ;
StatementWithoutAssignment -> put ( Expression ) ;
StatementWithoutAssignment -> return ( Expression ) ;
Term -> Factor TermRecursion
TermRecursion -> MultiplicativeOperator Factor TermRecursion
TermRecursion -> EPSILON
Type -> NumberType
Type -> id
Variable -> id VariableTail
VariableDeclarationRecursionThenStatementRecursionA -> NumberType id ArraySizeRecursion ; VariableDeclarationRecursionThenStatementRecursionA
VariableDeclarationRecursionThenStatementRecursionA -> EPSILON
VariableDeclarationRecursionThenStatementRecursionA -> StatementWithoutAssignment StatementRecursion
VariableDeclarationRecursionThenStatementRecursionA -> id VariableDeclarationRecursionThenStatementRecursionB
VariableDeclarationRecursionThenStatementRecursionB -> VariableTail = Expression ; StatementRecursion
VariableDeclarationRecursionThenStatementRecursionB -> id ArraySizeRecursion ; VariableDeclarationRecursionThenStatementRecursionA
VariableTail -> ( FunctionArguments ) . id VariableTail
VariableTail -> IndexingRecursion VariableTailTail
VariableTailTail -> . id VariableTail
VariableTailTail -> EPSILON
VariableThenFunctionDeclarationRecursion -> Type id VariableThenFunctionDeclarationRecursionTail
VariableThenFunctionDeclarationRecursion -> EPSILON
VariableThenFunctionDeclarationRecursionTail -> ArraySizeRecursion ; VariableThenFunctionDeclarationRecursion
VariableThenFunctionDeclarationRecursionTail -> FunctionDeclarationRecursionTail
The AtoCC kfG Edit tool confirms that the above grammar is LL(1).
LL(1) Parse Table
A parsing table must be constructed from the above grammar in order to represent the grammar during predictive parsing. The information below was generated automatically using an online tool.
The fact that there was at most one production in each table cell further reinforces the fact that the grammar is LL(1).
FIRST Sets
Non-Terminal Symbol | First Set |
---|---|
program | program |
; | ; |
+ | + |
- | - |
or | or |
¦¦ | ¦¦ |
ε | ε |
[ | [ |
intNum | intNum |
] | ] |
= | = |
class | class |
id | id |
{ | } |
} | } |
( | ) |
) | ) |
floatNum | floatNum |
, | , |
. | . |
&& | && |
* | * |
/ | / |
and | and |
! | ! |
not | not |
float | float |
int | int |
: | : |
:: | :: |
<> | <> |
< | < |
<= | <= |
== | == |
> | > |
>= | >= |
for | for |
get | get |
if | if |
then | then |
else | else |
put | put |
return | return |
Program | program , ε, class , id , float , int |
AdditiveOperator | + , - , or , ¦¦ |
ArithmeticExpressionTail | ε, + , - , or , ¦¦ |
ArithmeticOrRelationalExpression | ε, <> , < , <= , == , > , >= |
ArraySize | [ |
ArraySizeRecursion | ε, [ |
ClassDeclaration | class |
ClassDeclarationRecursion | ε, class |
Factor | ( , floatNum , intNum , id , + , - , ! , not |
FunctionArguments | ε, ( , floatNum , intNum , id , + , - , ! , not |
FunctionArgumentsTail | , |
FunctionArgumentsTailRecursion | ε, , |
FunctionBody | { |
FunctionCallOrVariable | id |
FunctionCallOrVariableTailRecursion | . , ε |
FunctionCallParensOrIndexing | ( , ε, [ |
FunctionDeclarationRecursionStart | ε, id , float , int |
FunctionDeclarationRecursionTail | ( |
FunctionDefinitionRecursion | ε, id , float , int |
FunctionParameters | ε, id , float , int |
FunctionParametersTail | , |
FunctionParametersTailRecursion | ε, , |
IdListRecursion | , , ε |
Indexing | [ |
IndexingRecursion | ε, [ |
MultiplicativeOperator | && , * , / , and |
NegationOperator | ! , not |
NumberSign | + , - |
NumberType | float , int |
OptionalInheritanceList | : , ε |
OptionalNamespacing | id |
OptionalNamespacingTail | :: , ε |
RelationalOperator | <> , < , <= , == , > , >= |
StatementBlock | ε, { , id , for , get , if , put , return |
StatementRecursion | ε, id , for , get , if , put , return |
StatementWithoutAssignment | for , get , if , put , return |
TermRecursion | ε, && , * , / , and |
Type | id , float , int |
Variable | id |
VariableDeclarationRecursionThenStatementRecursionA | ε, id , float , int , for , get , if , put , return |
VariableDeclarationRecursionThenStatementRecursionB | = , id , ( , ε, [ , . |
VariableTail | ( , ε, [ , . |
VariableTailTail | . , ε |
VariableThenFunctionDeclarationRecursion | ε, id , float , int |
VariableThenFunctionDeclarationRecursionTail | ; , ε, [ , ( |
AssignmentStatement | id |
FunctionHeader | id , float , int |
Statement | id , for , get , if , put , return |
FunctionCallOrVariableTail | ( , ε, [ , . |
FunctionDefinition | id , float , int |
Term | ( , floatNum , intNum , id , + , - , ! , not |
ArithmeticExpression | ( , floatNum , intNum , id , + , - , ! , not |
Expression | ( , floatNum , intNum , id , + , - , ! , not |
RelationalExpression | ( , floatNum , intNum , id , + , - , ! , not |
FOLLOW Sets
Non-Terminal Symbol | Follow Set |
---|---|
Program | $ |
AdditiveOperator | ( , floatNum , intNum , id , + , - , ! , not |
ArithmeticExpression | <> , < , <= , == , > , >= , ] , ) , ; , , |
ArithmeticExpressionTail | <> , < , <= , == , > , >= , ] , ) , ; , , |
ArithmeticOrRelationalExpression | ; , ) , , |
ArraySize | [ , ; , , , ) |
ArraySizeRecursion ; , , , ) | |
AssignmentStatement | ) , ; |
ClassDeclaration | class , program , id , float , int |
ClassDeclarationRecursion | program , id , float , int |
Expression | ; , ) , , |
Factor | && , * , / , and , + , - , or , ¦¦ , <> , < , <= , == , > , >= , ] , ) , ; , , |
FunctionArguments | ) |
FunctionArgumentsTail | , , ) |
FunctionArgumentsTailRecursion | ) |
FunctionBody | ; |
FunctionCallOrVariable | && , * , / , and , + , - , or , ¦¦ , <> , < , <= , == , > , >= , ] , ) , ; , , |
FunctionCallOrVariableTail | && , * , / , and , + , - , or , ¦¦ , <> , < , <= , == , > , >= , ] , ) , ; , , |
FunctionCallOrVariableTailRecursion | && , * , / , and , + , - , or , ¦¦ , <> , < , <= , == , > , >= , ] , ) , ; , , |
FunctionCallParensOrIndexing | . , && , * , / , and , + , - , or , ¦¦ , <> , < , <= , == , > , >= , ] , ) , ; , , |
FunctionDeclarationRecursionStart | } |
FunctionDeclarationRecursionTail | } |
FunctionDefinition | id , float , int , program |
FunctionDefinitionRecursion | program |
FunctionHeader | { |
FunctionParameters | ) |
FunctionParametersTail | , , ) |
FunctionParametersTailRecursion | ) |
IdListRecursion | { |
Indexing | [ , . , = , && , * , / , and , + , - , or , ¦¦ , ) , <> , < , <= , == , > , >= , ] , ; , , |
IndexingRecursion | . , = , && , * , / , and , + , - , or , ¦¦ , ) , <> , < , <= , == , > , >= , ] , ; , , |
MultiplicativeOperator | ( , floatNum , intNum , id , + , - , ! , not |
NegationOperator | ( , floatNum , intNum , id , + , - , ! , not |
NumberSign | ( , floatNum , intNum , id , + , - , ! , not |
NumberType | id |
OptionalInheritanceList | { |
OptionalNamespacing | ( |
OptionalNamespacingTail | ( |
RelationalExpression | ; |
RelationalOperator | ( , floatNum , intNum , id , + , - , ! , not |
Statement | id , for , get , if , put , return , } , ; , else |
StatementBlock | ; , else |
StatementRecursion | } |
StatementWithoutAssignment | id , for , get , if , put , return , } , ; , else |
Term | + , - , or , ¦¦ , <> , < , <= , == , > , >= , ] , ) , ; , , |
TermRecursion | + , - , or , ¦¦ , <> , < , <= , == , > , >= , ] , ) , ; , , |
Type | id |
Variable | ) , = |
VariableDeclarationRecursionThenStatementRecursionA | } |
VariableDeclarationRecursionThenStatementRecursionB | } |
VariableTail | = , ) |
VariableTailTail | = , ) |
VariableThenFunctionDeclarationRecursion | } |
VariableThenFunctionDeclarationRecursionTail | } |
Prediction Table
Prediction Number | Production LHS Non-Terminal | → | Production RHS Expression | Predict Set |
---|---|---|---|---|
1 | Program | → | ClassDeclarationRecursion FunctionDefinitionRecursion program FunctionBody ; | class , id , float , int , program |
2 | AdditiveOperator | → | + | + |
3 | AdditiveOperator | → | - | - |
4 | AdditiveOperator | → | or | or |
5 | AdditiveOperator | → | ¦¦ | ¦¦ |
6 | ArithmeticExpression | → | Term ArithmeticExpressionTail | ( , floatNum , intNum , id , + , - , ! , not |
7 | ArithmeticExpressionTail | → | AdditiveOperator Term ArithmeticExpressionTail | + , - , or , ¦¦ |
8 | ArithmeticExpressionTail | → | ε | <> , < , <= , == , > , >= , ] , ) , ; , , |
9 | ArithmeticOrRelationalExpression | → | RelationalOperator ArithmeticExpression | <> , < , = , == , > , >= |
10 | ArithmeticOrRelationalExpression | → | ε | ; , ) , , |
11 | ArraySize | → | [ intNum ] | [ |
12 | ArraySizeRecursion | → | ArraySize ArraySizeRecursion | [ |
13 | ArraySizeRecursion | → | ε | ; , , , ) |
14 | AssignmentStatement | → | Variable = Expression | id |
15 | ClassDeclaration | → | class id OptionalInheritanceList { VariableThenFunctionDeclarationRecursion } ; | class |
16 | ClassDeclarationRecursion | → | ClassDeclaration ClassDeclarationRecursion | class |
17 | ClassDeclarationRecursion | → | ε | program , id , float , int |
18 | Expression | → | ArithmeticExpression ArithmeticOrRelationalExpression | ( , floatNum , intNum , id , + , - , ! , not |
19 | Factor | → | ( ArithmeticExpression ) | ( |
20 | Factor | → | FunctionCallOrVariable | id |
21 | Factor | → | NegationOperator Factor | ! , not |
22 | Factor | → | NumberSign Factor | + , - |
23 | Factor | → | floatNum | floatNum |
24 | Factor | → | intNum | intNum |
25 | FunctionArguments | → | Expression FunctionArgumentsTailRecursion | ( , floatNum , intNum , id , + , - , ! , not |
26 | FunctionArguments | → | ε | ) |
27 | FunctionArgumentsTail | → | , Expression | , |
28 | FunctionArgumentsTailRecursion | → | FunctionArgumentsTail FunctionArgumentsTailRecursion | , |
29 | FunctionArgumentsTailRecursion | → | ε | ) |
30 | FunctionBody | → | { VariableDeclarationRecursionThenStatementRecursionA } | { |
31 | FunctionCallOrVariable | → | id FunctionCallOrVariableTail | id |
32 | FunctionCallOrVariableTail | → | FunctionCallParensOrIndexing FunctionCallOrVariableTailRecursion | ( , [ , . , = , && , * , / , and , + , - , or , ¦¦ , ) , <> , < , <= , == , > , >= , ] , ; , , |
33 | FunctionCallOrVariableTailRecursion | → | . id FunctionCallOrVariableTail | . |
34 | FunctionCallOrVariableTailRecursion | → | ε | && , * , / , and , + , - , or , ¦¦ , <> , < , <= , == , > , >= , ] , ) , ; , , |
35 | FunctionCallParensOrIndexing | → | ( FunctionArguments ) | ( |
36 | FunctionCallParensOrIndexing | → | IndexingRecursion | [ , . , = , && , * , / , and , + , - , or , ¦¦ , ) , <> , < , <= , == , > , >= , ] , ; , , |
37 | FunctionDeclarationRecursionStart | → | Type id FunctionDeclarationRecursionTail | id , float , int |
38 | FunctionDeclarationRecursionStart | → | ε | } |
39 | FunctionDeclarationRecursionTail | → | ( FunctionParameters ) ; FunctionDeclarationRecursionStart | ( |
40 | FunctionDefinition | → | FunctionHeader FunctionBody ; | id , float , int |
41 | FunctionDefinitionRecursion | → | FunctionDefinition FunctionDefinitionRecursion | id , float , int |
42 | FunctionDefinitionRecursion | → | ε | program |
43 | FunctionHeader | → | Type OptionalNamespacing ( FunctionParameters ) | id , float , int |
44 | FunctionParameters | → | Type id ArraySizeRecursion FunctionParametersTailRecursion | id , float , int |
45 | FunctionParameters | → | ε | ) |
46 | FunctionParametersTail | → | , Type id ArraySizeRecursion | , |
47 | FunctionParametersTailRecursion | → | FunctionParametersTail FunctionParametersTailRecursion | , |
48 | FunctionParametersTailRecursion | → | ε | ) |
49 | IdListRecursion | → | , id IdListRecursion | , |
50 | IdListRecursion | → | ε | { |
51 | Indexing | → | [ ArithmeticExpression ] | [ |
52 | IndexingRecursion | → | Indexing IndexingRecursion | [ |
53 | IndexingRecursion | → | ε | . , = , && , * , / , and , + , - , or , ¦¦ , ) , <> , < , <= , == , > , >= , ] , ; , , |
54 | MultiplicativeOperator | → | && | && |
55 | MultiplicativeOperator | → | * | * |
56 | MultiplicativeOperator | → | / | / |
57 | MultiplicativeOperator | → | and | and |
58 | NegationOperator | → | ! | ! |
59 | NegationOperator | → | not | not |
60 | NumberSign | → | + | + |
61 | NumberSign | → | - | - |
62 | NumberType | → | float | float |
63 | NumberType | → | int | int |
64 | OptionalInheritanceList | → | : id IdListRecursion | : |
65 | OptionalInheritanceList | → | ε | { |
66 | OptionalNamespacing | → | id OptionalNamespacingTail | id |
67 | OptionalNamespacingTail | → | :: id | :: |
68 | OptionalNamespacingTail | → | ε | ( |
69 | RelationalExpression | → | ArithmeticExpression RelationalOperator ArithmeticExpression | ( , floatNum , intNum , id , + , - , ! , not |
70 | RelationalOperator | → | <> | <> |
71 | RelationalOperator | → | < | < |
72 | RelationalOperator | → | <= | <= |
73 | RelationalOperator | → | == | == |
74 | RelationalOperator | → | > | > |
75 | RelationalOperator | → | >= | >= |
76 | Statement | → | AssignmentStatement ; | id |
77 | Statement | → | StatementWithoutAssignment | for , get , if , put , return |
78 | StatementBlock | → | Statement | id , for , get , if , put , return |
79 | StatementBlock | → | ε | ; , else |
80 | StatementBlock | → | { StatementRecursion } | { |
81 | StatementRecursion | → | Statement StatementRecursion | id , for , get , if , put , return |
82 | StatementRecursion | → | ε | } |
83 | StatementWithoutAssignment | → | for ( Type id = Expression ; RelationalExpression ; AssignmentStatement ) StatementBlock ; | for |
84 | StatementWithoutAssignment | → | get ( Variable ) ; | get |
85 | StatementWithoutAssignment | → | if ( Expression ) then StatementBlock else StatementBlock ; | if |
86 | StatementWithoutAssignment | → | put ( Expression ) ; | put |
87 | StatementWithoutAssignment | → | return ( Expression ) ; | return |
88 | Term | → | Factor TermRecursion | ( , floatNum , intNum , id , + , - , ! , not |
89 | TermRecursion | → | MultiplicativeOperator Factor TermRecursion | && , * , / , and |
90 | TermRecursion | → | ε | + , - , or , ¦¦ , <> , < , <= , == , > , >= , ] , ) , ; , , |
91 | Type | → | NumberType | float , int |
92 | Type | → | id | id |
93 | Variable | → | id VariableTail | id |
94 | VariableDeclarationRecursionThenStatementRecursionA | → | NumberType id ArraySizeRecursion ; VariableDeclarationRecursionThenStatementRecursionA | float , int |
95 | VariableDeclarationRecursionThenStatementRecursionA | → | ε | } |
96 | VariableDeclarationRecursionThenStatementRecursionA | → | StatementWithoutAssignment StatementRecursion | for , get , if , put , return |
97 | VariableDeclarationRecursionThenStatementRecursionA | → | id VariableDeclarationRecursionThenStatementRecursionB | id |
98 | VariableDeclarationRecursionThenStatementRecursionB | → | VariableTail = Expression ; StatementRecursion | ( , [ , . , = |
99 | VariableDeclarationRecursionThenStatementRecursionB | → | id ArraySizeRecursion ; VariableDeclarationRecursionThenStatementRecursionA | id |
100 | VariableTail | → | ( FunctionArguments ) . id VariableTail | ( |
101 | VariableTail | → | IndexingRecursion VariableTailTail | [ , . , = , ) |
102 | VariableTailTail | → | . id VariableTail | . |
103 | VariableTailTail | → | ε | = , ) |
104 | VariableThenFunctionDeclarationRecursion | → | Type id VariableThenFunctionDeclarationRecursionTail | id , float , int |
105 | VariableThenFunctionDeclarationRecursion | → | ε | } |
106 | VariableThenFunctionDeclarationRecursionTail | → | ArraySizeRecursion ; VariableThenFunctionDeclarationRecursion | [ , ; |
107 | VariableThenFunctionDeclarationRecursionTail | → | FunctionDeclarationRecursionTail | ( |
108 | POP ERROR | POP ERROR | POP ERROR | POP ERROR |
109 | SCAN ERROR | SCAN ERROR | SCAN ERROR | SCAN ERROR |
LL(1) Parsing Table
The columns of the parsing table below represent the list of possible next input tokens.
The rows represent the current leftmost nonterminal in the parse tree.
Every table cell maps the indicates how the current non-terminal should be expanded based on the next input token. The numbers correspond to the rows of entries in the above prediction table, where the production right-hand side expression would be used to expand the current non-terminal.
program | ; | + | - | or | ¦¦ | [ | intNum | ] | = | class | id | { | } | ( | ) | floatNum | , | . | && | * | / | and | ! | not | float | int | : | :: | <> | < | <= | == | > | >= | for | get | if | then | else | put | return | $ | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Program | 1 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 1 | 1 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 1 | 1 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 108 |
AdditiveOperator | 109 | 109 | 2 | 3 | 4 | 5 | 109 | 108 | 109 | 109 | 109 | 108 | 109 | 109 | 108 | 109 | 108 | 109 | 109 | 109 | 109 | 109 | 109 | 108 | 108 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 |
ArithmeticExpression | 109 | 108 | 6 | 6 | 109 | 109 | 109 | 6 | 108 | 109 | 109 | 6 | 109 | 109 | 6 | 108 | 6 | 108 | 109 | 109 | 109 | 109 | 109 | 6 | 6 | 109 | 109 | 109 | 109 | 108 | 108 | 108 | 108 | 108 | 108 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 |
ArithmeticExpressionTail | 109 | 8 | 7 | 7 | 7 | 7 | 109 | 109 | 8 | 109 | 109 | 109 | 109 | 109 | 109 | 8 | 109 | 8 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 8 | 8 | 8 | 8 | 8 | 8 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 |
ArithmeticOrRelationalExpression | 109 | 10 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 10 | 109 | 10 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 9 | 9 | 9 | 9 | 9 | 9 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 |
ArraySize | 109 | 108 | 109 | 109 | 109 | 109 | 11 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 108 | 109 | 108 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 |
ArraySizeRecursion | 109 | 13 | 109 | 109 | 109 | 109 | 12 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 13 | 109 | 13 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 |
AssignmentStatement | 109 | 108 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 14 | 109 | 109 | 109 | 108 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 |
ClassDeclaration | 108 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 15 | 108 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 108 | 108 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 |
ClassDeclarationRecursion | 17 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 16 | 17 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 17 | 17 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 |
Expression | 109 | 108 | 18 | 18 | 109 | 109 | 109 | 18 | 109 | 109 | 109 | 18 | 109 | 109 | 18 | 108 | 18 | 108 | 109 | 109 | 109 | 109 | 109 | 18 | 18 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 |
Factor | 109 | 108 | 22 | 22 | 108 | 108 | 109 | 24 | 108 | 109 | 109 | 20 | 109 | 109 | 19 | 108 | 23 | 108 | 109 | 108 | 108 | 108 | 108 | 21 | 21 | 109 | 109 | 109 | 109 | 108 | 108 | 108 | 108 | 108 | 108 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 |
FunctionArguments | 109 | 109 | 25 | 25 | 109 | 109 | 109 | 25 | 109 | 109 | 109 | 25 | 109 | 109 | 25 | 26 | 25 | 109 | 109 | 109 | 109 | 109 | 109 | 25 | 25 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 |
FunctionArgumentsTail | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 108 | 109 | 27 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 |
FunctionArgumentsTailRecursion | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 29 | 109 | 28 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 |
FunctionBody | 109 | 108 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 30 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 |
FunctionCallOrVariable | 109 | 108 | 108 | 108 | 108 | 108 | 109 | 109 | 108 | 109 | 109 | 31 | 109 | 109 | 109 | 108 | 109 | 108 | 109 | 108 | 108 | 108 | 108 | 109 | 109 | 109 | 109 | 109 | 109 | 108 | 108 | 108 | 108 | 108 | 108 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 |
FunctionCallOrVariableTail | 109 | 108 | 108 | 108 | 108 | 108 | 32 | 109 | 108 | 109 | 109 | 109 | 109 | 109 | 32 | 108 | 109 | 108 | 32 | 108 | 108 | 108 | 108 | 109 | 109 | 109 | 109 | 109 | 109 | 108 | 108 | 108 | 108 | 108 | 108 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 |
FunctionCallOrVariableTailRecursion | 109 | 34 | 34 | 34 | 34 | 34 | 109 | 109 | 34 | 109 | 109 | 109 | 109 | 109 | 109 | 34 | 109 | 34 | 33 | 34 | 34 | 34 | 34 | 109 | 109 | 109 | 109 | 109 | 109 | 34 | 34 | 34 | 34 | 34 | 34 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 |
FunctionCallParensOrIndexing | 109 | 108 | 108 | 108 | 108 | 108 | 36 | 109 | 108 | 109 | 109 | 109 | 109 | 109 | 35 | 108 | 109 | 108 | 108 | 108 | 108 | 108 | 108 | 109 | 109 | 109 | 109 | 109 | 109 | 108 | 108 | 108 | 108 | 108 | 108 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 |
FunctionDeclarationRecursionStart | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 37 | 109 | 38 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 37 | 37 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 |
FunctionDeclarationRecursionTail | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 108 | 39 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 |
FunctionDefinition | 108 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 40 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 40 | 40 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 |
FunctionDefinitionRecursion | 42 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 41 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 41 | 41 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 |
FunctionHeader | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 43 | 108 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 43 | 43 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 |
FunctionParameters | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 44 | 109 | 109 | 109 | 45 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 44 | 44 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 |
FunctionParametersTail | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 108 | 109 | 46 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 |
FunctionParametersTailRecursion | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 48 | 109 | 47 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 |
IdListRecursion | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 50 | 109 | 109 | 109 | 109 | 49 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 |
Indexing | 109 | 108 | 108 | 108 | 108 | 108 | 51 | 109 | 108 | 108 | 109 | 109 | 109 | 109 | 109 | 108 | 109 | 108 | 108 | 108 | 108 | 108 | 108 | 109 | 109 | 109 | 109 | 109 | 109 | 108 | 108 | 108 | 108 | 108 | 108 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 |
IndexingRecursion | 109 | 53 | 53 | 53 | 53 | 53 | 52 | 109 | 53 | 53 | 109 | 109 | 109 | 109 | 109 | 53 | 109 | 53 | 53 | 53 | 53 | 53 | 53 | 109 | 109 | 109 | 109 | 109 | 109 | 53 | 53 | 53 | 53 | 53 | 53 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 |
MultiplicativeOperator | 109 | 109 | 108 | 108 | 109 | 109 | 109 | 108 | 109 | 109 | 109 | 108 | 109 | 109 | 108 | 109 | 108 | 109 | 109 | 54 | 55 | 56 | 57 | 108 | 108 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 |
NegationOperator | 109 | 109 | 108 | 108 | 109 | 109 | 109 | 108 | 109 | 109 | 109 | 108 | 109 | 109 | 108 | 109 | 108 | 109 | 109 | 109 | 109 | 109 | 109 | 58 | 59 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 |
NumberSign | 109 | 109 | 60 | 61 | 109 | 109 | 109 | 108 | 109 | 109 | 109 | 108 | 109 | 109 | 108 | 109 | 108 | 109 | 109 | 109 | 109 | 109 | 109 | 108 | 108 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 |
NumberType | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 108 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 62 | 63 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 |
OptionalInheritanceList | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 65 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 64 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 |
OptionalNamespacing | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 66 | 109 | 109 | 108 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 |
OptionalNamespacingTail | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 68 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 67 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 |
RelationalExpression | 109 | 108 | 69 | 69 | 109 | 109 | 109 | 69 | 109 | 109 | 109 | 69 | 109 | 109 | 69 | 109 | 69 | 109 | 109 | 109 | 109 | 109 | 109 | 69 | 69 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 |
RelationalOperator | 109 | 109 | 108 | 108 | 109 | 109 | 109 | 108 | 109 | 109 | 109 | 108 | 109 | 109 | 108 | 109 | 108 | 109 | 109 | 109 | 109 | 109 | 109 | 108 | 108 | 109 | 109 | 109 | 109 | 70 | 71 | 72 | 73 | 74 | 75 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 |
Statement | 109 | 108 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 76 | 109 | 108 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 77 | 77 | 77 | 109 | 108 | 77 | 77 | 109 |
StatementBlock | 109 | 79 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 78 | 80 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 78 | 78 | 78 | 109 | 79 | 78 | 78 | 109 |
StatementRecursion | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 81 | 109 | 82 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 81 | 81 | 81 | 109 | 109 | 81 | 81 | 109 |
StatementWithoutAssignment | 109 | 108 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 108 | 109 | 108 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 83 | 84 | 85 | 109 | 108 | 86 | 87 | 109 |
Term | 109 | 108 | 88 | 88 | 108 | 108 | 109 | 88 | 108 | 109 | 109 | 88 | 109 | 109 | 88 | 108 | 88 | 108 | 109 | 109 | 109 | 109 | 109 | 88 | 88 | 109 | 109 | 109 | 109 | 108 | 108 | 108 | 108 | 108 | 108 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 |
TermRecursion | 109 | 90 | 90 | 90 | 90 | 90 | 109 | 109 | 90 | 109 | 109 | 109 | 109 | 109 | 109 | 90 | 109 | 90 | 109 | 89 | 89 | 89 | 89 | 109 | 109 | 109 | 109 | 109 | 109 | 90 | 90 | 90 | 90 | 90 | 90 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 |
Type | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 92 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 91 | 91 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 |
Variable | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 108 | 109 | 93 | 109 | 109 | 109 | 108 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 |
VariableDeclarationRecursionThenStatementRecursionA | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 97 | 109 | 95 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 94 | 94 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 96 | 96 | 96 | 109 | 109 | 96 | 96 | 109 |
VariableDeclarationRecursionThenStatementRecursionB | 109 | 109 | 109 | 109 | 109 | 109 | 98 | 109 | 109 | 98 | 109 | 99 | 109 | 108 | 98 | 109 | 109 | 109 | 98 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 |
VariableTail | 109 | 109 | 109 | 109 | 109 | 109 | 101 | 109 | 109 | 108 | 109 | 109 | 109 | 109 | 100 | 108 | 109 | 109 | 101 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 |
VariableTailTail | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 103 | 109 | 109 | 109 | 109 | 109 | 103 | 109 | 109 | 102 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 |
VariableThenFunctionDeclarationRecursion | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 104 | 109 | 105 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 104 | 104 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 |
VariableThenFunctionDeclarationRecursionTail | 109 | 106 | 109 | 109 | 109 | 109 | 106 | 109 | 109 | 109 | 109 | 109 | 109 | 108 | 107 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 | 109 |
List of Terminal Symbols (Tokens)
- Identifier (
id
) - Keyword (
program
) - Keyword (
class
) - Keyword (
if
) - Keyword (
then
) - Keyword (
for
) - Keyword (
get
) - Keyword (
put
) - Keyword (
return
) - Keyword (
float
) - Keyword (
int
) - Semicolon (
;
) - OpenCurlyBrace (
{
) - CloseCurlyBrace (
}
) - InheritanceOperator (
:
) - Comma (
,
) - OpenParens (
(
) - CloseParens (
)
) - ScopeResolutionOperator (
::
) - AssignmentOperator (
=
) - RelationalOperator
- MathOperator (
+
) - MathOperator (
-
) - MathOperator (
*
) - MathOperator (
/
) - BinaryLogicalOperator (
or
) - BinaryLogicalOperator (
||
) - BinaryLogicalOperator (
and
) - BinaryLogicalOperator (
&&
) - UnaryLogicalOperator (
not
) - UnaryLogicalOperator (
!
) - Integer
- Float
- OpenSquareBracket (
[
) - CloseSquareBracket (
]
) - AccessorOperator (
.
)