19 lines
294 B
Plaintext
19 lines
294 B
Plaintext
|
//define a lexical analyser called Exercice6
|
||
|
|
||
|
grammar Exercice6;
|
||
|
|
||
|
full_expr: expr ';' EOF ;
|
||
|
|
||
|
expr:
|
||
|
| LBRA expr RBRA expr
|
||
|
| LPAR expr RPAR expr
|
||
|
|
|
||
|
;
|
||
|
|
||
|
LPAR: '(' ;
|
||
|
RPAR: ')' ;
|
||
|
LBRA: '[' ;
|
||
|
RBRA: ']' ;
|
||
|
CHARS: ~[()[\]] -> skip;
|
||
|
WS: [ \t\r\n]+ -> skip ; // skip spaces, tabs, newlines
|