MicroGCL grammar
<program> -> 'BEGIN' <statement list> 'END' '.'
<statement list> -> <statement> {<statement>}
<statement> -> <ident> ':=' <expression> #Assign ';'
<statement> -> 'READ' <id list> ';'
<statement> -> 'WRITE' <expr list> ';' #EndWrite
<statement> -> 'IF' <boolean> '->' <statement list> 'FI' ';'
<boolean> -> <expression> <relop> <expression>
<id list> -> <ident> #ReadId { ',' <ident> #ReadId }
<expr list> -> <expression> #WriteExpr { ',' <expression> #WriteExpr}
<expression> -> <primary> {<add op> <primary> #GenInfix}
<primary> -> '(' <expression> ')'
<primary> -> <ident>
<primary> -> 'IntLiteral' #ProcessLiteral
<add op> -> '+' #ProcessOp
<add op> -> '-' #ProcessOp
<relop> -> '<' #ProcessOp
<relop> -> '<=' #ProcessOp
<relop> -> '>' #ProcessOp
<relop> -> '>=' #ProcessOp
<relop> -> '=' #ProcessOp
<relop> -> '#' #ProcessOp
<ident> -> 'Id' #ProcessId
<system goal> -> #Start <program> 'EofSym' #Finish
NOTE: 'tokens', <nonterminals> #semanticActions
Next Page