An abstract syntax for Tucker & Noonan's Clite.
Program | = | Declarationsdecpart;Statementsbody; |
Declarations | = | Declaration* |
Declaration | = | VariableDecl|ArrayDecl |
VariableDecl | = | Variablev;Typet; |
ArrayDecl | = | Variablev;Typet;Integersize; |
Type | = | int|bool|float|char |
Statements | = | Statement* |
Statement | = | Skip|Block|Assignment|Conditional|Loop |
Skip | = | |
Block | = | Statements |
Conditional | = | Expressiontest;Statmentthenbranch,elsebranch |
Loop | = | Expressiontest;Statmentbody |
Assignment | = | VariableReftarget;Expressionsource |
Expression | = | VariableRef|Value|Binary|Unary |
VariableRef | = | Variable|ArrayRef |
Binary | = | Operatorop;Expressionterm1,term2 |
Unary | = | UnaryOpop;Expressionterm; |
Operator | = | &&||||==|!=|<|<=|>|>=|+|-|*|/|% |
UnaryOp | = | -|! |
Variable | = | Stringid |
ArrayRef | = | Stringid;Expressionindex |
Value | = | IntValue|BoolValue|FloatValue|CharValue |
IntValue | = | IntegerintValue |
FloatValue | = | FloatfloatValue |
BoolValue | = | BooleanboolValue |
CharValue | = | CharactercharValue |