Advertisement
Guest User

Untitled

a guest
Feb 26th, 2020
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. grammar lab1Adi;
  2.  
  3. ID : ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'0'..'9'|'_')*
  4. ;
  5.  
  6. INT : '0'..'9'+
  7. ;
  8.  
  9. COMMENT
  10. : '//' ~('\n'|'\r')* '\r'? '\n' {$channel=HIDDEN;}
  11. | '/*' ( options {greedy=false;} : . )* '*/' {$channel=HIDDEN;}
  12. ;
  13.  
  14. WS : ( ' '
  15. | '\t'
  16. | '\r'
  17. ) {$channel=HIDDEN;}
  18. ;
  19.  
  20. expr : term ((PLUS term | MINUS term))* NL ;
  21.  
  22. term : atom (MUL atom | DIV atom)* ;
  23.  
  24. atom : INT | (LP expr RP);
  25. LP : '(';
  26. RP : ')';
  27. NL : '\n';
  28. PLUS : '+';
  29. MINUS: '-';
  30. MUL : '*';
  31. DIV : '/';
  32. plik : expr* EOF;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement