Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sample program:
- a
- a b
- a b c
- a (b c)
- (a b) c
- (a (b c)) d
- (a b c) d
- a | b
- a*
- (a | b)*
- a -> b
- a -> b -> c
- a b -> c
- a | b -> c
- (a | b) -> c
- a | (b -> c)
- f <- a b -> c
- the binary operators are ' ', ' -> ', ' <- ', ' | ' and '\n'
- there is a unary operator '*'
- all binary operators are right-associative
- spaces, stars and parentheses delimit words, e.g. "a|b" is a single word while "a | b" is several
- extra space is not allowed, e.g. "f *" since '*' is not a valid name but an operator
- precedence:
- 0. '\n'
- 1. ' <- ', ' -> '
- 2. ' | '
- 3. ' '
- 4. ' * '
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement