Ross Patterson

Results 111 comments of Ross Patterson

I sat down tonight to start implementing option 2, and quickly found myself categorizing most of my changes (at the top of this PR) as "_making `lark.lark` accept the same...

I reverted all my changes to `lark.lark`, and did what @MegaIng suggested - made it do exactly what the BNF in `load_grammar.py` does. 1. In `rule`, split out the modifiers...

> > I haven't changed this, because it will change trees produced by `lark.lark`, but I think I should. > > I think that's fine. I don't think there are...

> It might make sense to write an `Interpreter` instead of a `Visitor` which allows slighter better control about what happens when. The `Visitor` model seems to fit well for...

> > There wasn't any existing doc on using the lark.lark grammar, so I put some instructions for the validator at the top of the grammar. > > We should...

> `alias` and `expr` are also never inlined by `lark.lark` despite having a `?` because the `[]` makes it so that we always have a `None` as a second child....

> With regard to tests, also see that we are already testing `lark.lark`: > > https://github.com/lark-parser/lark/blob/7646fb31609c6c83e0998b121eeffb908f5ec5ba/tests/test_parser.py#L1047 > > It might make sense to extend the tests there to include `LarkValidatorVisitor`...

> I'm working on blending my `test_lark_lark.py` and `test_grammar_formal.py` into `test_parser.py` and `test_grammar.py`. I'm using the technique used in `test_parser.py` for running a set of tests against multiple parsers. While...

I'll be offline for the next few weeks, but I'll wrap this up after I return in mid-March.

While testing and verifying my changes, I realized there are a few more differences between `load_grammar.py` and `lark.lark`, which result in differently-shaped parse trees. Specifically: 1. The `load_grammar.py` version of...