Padrões sintácticos típicos

Pattern name
Possible 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