Closed rmanne closed 7 years ago
Hey, and thanks for getting in touch.
I would encourage you to read this section of the readme. Basically, you have to use rule
whenever there's a recursive rule. This is what allows the Earley library to do something slightly more clever than most parser combinator libraries for recursive rules.
Your grammar should work fine if you use something along the lines of:
grammar = mdo
s <- rule $ S <$> many a <*> b <*> many t
t <- rule $ T <$> c <*> s
return s
I hope that helps!
Thanks! That's exactly what I needed.
Consider the following toy example:
As far as I can tell, this grammar should be parsable. Every string only has a finite number of possible parse trees. Yet parsing fails if I enable the commented line (marked with a TODO). Am I doing something wrong? Or is this a bug/limitation in Earley?