softdevteam / lrpar

Rust LR parser
Other
1 stars 0 forks source link

Simplify presentation of repairs #39

Closed ltratt closed 6 years ago

ltratt commented 6 years ago

This is, in some senses, an incomplete pull request, but it's still probably complete enough to be worth merging. The original plan was to make it possible to make KimYiPlus repairs easier to understand, merging things like:

  Insert X, Insert Y
  Insert X, Insert Z

into:

  Insert X, Insert {Y, Z}

Doing this requires moving away from the idea that inserting a nonterm tells us anything useful: there may be no relation between Y and Z from the grammars point of view, but users don't think in terms of grammar, so it's better to flatten things.

While working on this PR, I found (finally) examples where KimYi and KimYiPlus don't work properly. I've been working on that in a separate branch forked from this one. I still have more work to do on that, but it's pretty clear that it's moving in a useful direction. That means that I'm not going to be able to finish this PR completely until the "newer" PR is completed. So I think it's worth looking at this PR now and, if we're happy, merging it.

This PR thus doesn't do any merging of repairs, but it does all the preparatory work needed for merging to be possible. The first 4 commits are largely or wholly mechanical. The final commit (https://github.com/softdevteam/lrpar/commit/e182c21d0de8b3df3350d587e6952dc90d620089) is really the important commit. Repair::InsertNonterm (which inserts a given nonterminal) becomes Repair::InserSeq (which stores 1 or more nonterminals, any of which can be inserted at this point in the grammar).

ptersilie commented 6 years ago

Looks good. Do you want to merge anything or keep the commits as is?

ltratt commented 6 years ago

I think they're OK as-is, if you're comfortable with that.

ptersilie commented 6 years ago

I'm happy to merge as is. Merging now!