The ECFG for the CLite language of Tucker & Noonan. Terminals are bold,
so non-bold curly and squre brackets are the extension quantifiers.
Program | → | intmain(){DeclarationsStatements} |
Declarations | → | {Declaration} |
Declaration | → | TypeIdentifier[[Integer]]
{,Identifier[[Integer]]}; |
Type | → | int|bool|float|char |
Statements | → | {Statement} |
Statement | → | ;|Block|Assignment|IfStatement|WhileStatement |
Block | → | {Statements} |
Assignment | → | Identifier[[Expression]]=Expression |
IfStatement | → | if(Expression)Statment[elseStatement] |
WhileStatement | → | while(Expression)Statement |
Expression | → | Conjunction{||Conjuction} |
Conjunction | → | Equality{&&Equality} |
Equality | → | Relation[EquOpRelation] |
EquOp | → | ==|!= |
Relation | → | Addition[RelOpAddition] |
RelOp | → | <|<=|>|>= |
Addition | → | Term{AddOpTerm} |
AddOp | → | +|- |
Term | → | Factor{MulOpFactor} |
MulOp | → | *|/|% |
Factor | → | [UnaryOp]Primary |
UnaryOp | → | -|! |
Primary | → | Identifier[[Expression]]|Literal
|(Expression)
|Type(Expression) |
Identifier | → | Letter{Letter|Digit} |
Letter | → | a|b|…|z|A|B|…|Z |
Digit | → | 0|1|…|9 |
Literal | → | Integer|Boolean|Float|Char |
Integer | → | Digit{Digit} |
Boolean | → | true|false |
Float | → | Integer.Integer |
Char | → | 'ASCIIChar' |