Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- grammar lab1Adi;
- ID : ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'0'..'9'|'_')*
- ;
- INT : '0'..'9'+
- ;
- COMMENT
- : '//' ~('\n'|'\r')* '\r'? '\n' {$channel=HIDDEN;}
- | '/*' ( options {greedy=false;} : . )* '*/' {$channel=HIDDEN;}
- ;
- WS : ( ' '
- | '\t'
- | '\r'
- ) {$channel=HIDDEN;}
- ;
- expr : term ((PLUS term | MINUS term))* NL ;
- term : atom (MUL atom | DIV atom)* ;
- atom : INT | (LP expr RP);
- LP : '(';
- RP : ')';
- NL : '\n';
- PLUS : '+';
- MINUS: '-';
- MUL : '*';
- DIV : '/';
- plik : expr* EOF;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement