Padrões sintácticos típicos

Pattern namePossible implementation

Sequence

x y ... z '[' INT+ ']' '[' INT* ']'

Sequence with terminator

( instruction ';' )* ( row '\n' )*

Sequence with separator

expr ( ',' expr )* ( expr (',' expr)* )?

Choice

type: 'int' | 'float' instruction: conditional | loop | ... ;

Token independence

'(' expr ')' ID '[' expr ']' '{' instruction+ '}' '<' ID ( ',' ID )* '>'

Recursivity

expr: '(' expr ')' | ID; classDef: 'class' ID '{' (classDef|method|field)* '}';

Last updated