|
|
|
|
|
by mrkeen
500 days ago
|
|
> It seems as if you're trying to explicitly instruct a top-down parser. My mistake, that didn't even occur to me! I only ever use parser combinators so I just read grammars as if they were the code, and vice-versa. e.g. you could implement the grammar on the upper line as the code on the lower line: S -> F | F + S
s = f <|> (f >> char '+' >> s)
The two grammars you posted both 'look good' just by eyeballing them, neither needs 'fixing' (per the article title). They have identical precedence and identical don't-recurse-infinitely properties. |
|