Miksilo icon indicating copy to clipboard operation
Miksilo copied to clipboard

BiGrammar to Grammar transformation does not remove ignored produce grammars

Open keyboardDrummer opened this issue 8 years ago • 0 comments

Ignored produce grammars only have an effect when printing, not when parsing, so it's nicer to optimize them out of the parser. An example of a grammar that produces this scenario is ~~:

def ~~(right: BiGrammar): BiGrammar = {
    (this <~ space) ~ right
}

The space between this and right has no effect for parsing.

Add a small optimization that among other things does: Optimize(IgnoreRight(x, Produce y)) => Optimize(x)

keyboardDrummer avatar Sep 02 '17 12:09 keyboardDrummer