Advertisement
JoelSjogren

language

Feb 4th, 2018
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. sample program:
  2. a
  3. a b
  4. a b c
  5. a (b c)
  6. (a b) c
  7. (a (b c)) d
  8. (a b c) d
  9. a | b
  10. a*
  11. (a | b)*
  12. a -> b
  13. a -> b -> c
  14. a b -> c
  15. a | b -> c
  16. (a | b) -> c
  17. a | (b -> c)
  18. f <- a b -> c
  19.  
  20. the binary operators are ' ', ' -> ', ' <- ', ' | ' and '\n'
  21. there is a unary operator '*'
  22. all binary operators are right-associative
  23. spaces, stars and parentheses delimit words, e.g. "a|b" is a single word while "a | b" is several
  24. extra space is not allowed, e.g. "f *" since '*' is not a valid name but an operator
  25.  
  26. precedence:
  27. 0. '\n'
  28. 1. ' <- ', ' -> '
  29. 2. ' | '
  30. 3. ' '
  31. 4. ' * '
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement