4 ms·
This looks like a nice simplification of yacc/bison and lex/flex. The `then` keyword seems superfluous though; what was the motivation for `then` as opposed to
by aarchi 6y ago
This looks like a nice simplification of yacc/bison and lex/flex. The `then` keyword seems superfluous though; what was the motivation for `then` as opposed to just juxtaposition?
- cabalamat 6y agoThat's what I wondered too. I'm not sure what this gives me over and above yacc/lex (for C) or PLY (for Python).
- gosukiwi 6y agoThanks :) The reason it looks like that is because I need a way to distinguish binary calls from unary calls: `a b` would call the combinator `a` with the parser `b` as input. `a b c` will call the combinator b with a and c as input. I certainly could have chosen another syntax, but I settled for that one. Because the user can define their own combinators I can't just hard-code all combinators into the syntax. For example `*:A` is alias for `(many0 (token A))` but if the user defines his/her own unary combinator, I need a way to let him/her call it without changing the syntax.