Advertisement
Guest User

Untitled

a guest
May 25th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.08 KB | None | 0 0
  1. %ignore " "
  2. COMMENT: "#" /[^\n]/*
  3. %ignore COMMENT
  4.  
  5. SEMICOLON: ";"
  6. END_LINE: "\n"
  7. SEPARATOR: SEMICOLON | END_LINE
  8.  
  9. ZERO: "0"
  10. POSITIVE_DIGIT: "1".."9"
  11. DIGIT: ZERO | POSITIVE_DIGIT
  12.  
  13. UPPERCASE_LETTER: "A".."Z"
  14. LOWERCASE_LETTER: "a".."z"
  15. LETTER: UPPERCASE_LETTER | LOWERCASE_LETTER
  16.  
  17. POSITIVE_INTEGER: POSITIVE_DIGIT DIGIT*
  18. NEGATIVE_INTEGER: "-" POSITIVE_INTEGER
  19. INTEGER: ZERO | POSITIVE_INTEGER | NEGATIVE_INTEGER
  20. DECIMAL: INTEGER "." ZERO* POSITIVE_DIGIT
  21. NUMBER: INTEGER | DECIMAL
  22.  
  23. PLUS: "+"
  24. MINUS: "-"
  25. MULTIPLE: "*"
  26. DIVIDE: "//"
  27. DIV: "div"
  28.  
  29. sum_operator: PLUS | MINUS
  30. multiple_operator: MULTIPLE | DIVIDE | DIV
  31. operator: sum_operator | multiple_operator
  32.  
  33. LOWERCASE_NAME: LOWERCASE_LETTER (LOWERCASE_LETTER | "_")*
  34.  
  35. const_indent: LOWERCASE_NAME
  36.  
  37. const_multiplied: const_indent | NUMBER
  38.  
  39. const_multiple_expression: (const_multiplied multiple_operator)+ const_multiplied
  40. | "(" const_multiple_expression ")" multiple_operator const_multiplied
  41. | "(" const_multiple_expression ")" multiple_operator const_multiple_expression
  42. | const_multiplied multiple_operator "(" const_multiple_expression ")"
  43. | const_multiple_expression multiple_operator "(" const_multiple_expression ")"
  44. | "(" const_multiple_expression ")" multiple_operator "(" const_multiple_expression ")"
  45.  
  46. const_addend: NUMBER | const_indent | const_multiple_expression
  47.  
  48. const_sum_expression: (const_addend sum_operator)+ const_addend
  49. | "(" const_sum_expression ")" sum_operator const_addend
  50. | "(" const_multiple_expression ")" sum_operator const_addend
  51. | const_addend sum_operator "(" const_sum_expression ")"
  52. | const_addend sum_operator "(" const_multiple_expression ")"
  53.  
  54. const_expression: const_multiple_expression
  55. | const_sum_expression
  56. | "(" const_expression ")" operator "(" const_expression ")"
  57.  
  58. const_value: NUMBER | const_indent | const_expression
  59.  
  60.  
  61. start: const_value
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement