lrama icon indicating copy to clipboard operation
lrama copied to clipboard

Support IELR(1) Parser Generation

Open junk0612 opened this issue 1 year ago • 1 comments

Support the generation of the IELR(1) parser described in this paper. https://www.sciencedirect.com/science/article/pii/S0167642309001191

This PR will be ready for merging when the following is done.

  • [x] Add tests
    • Currently, I have only created a grammar file and verified its operation in my local environment.
  • [x] Refactor
    • The data structure is awful and needs to be improved because the priority was to achieve the expected results.

junk0612 avatar Apr 23 '24 05:04 junk0612

A couple months ago I poked around the internet looking for independent IELR(1) implementations, and besides lrama found only an inactive rust-based attempt. Recently I completed my own implementation and wrote a technical report with the hope that it might help others. IELR(1) turns out to be a real bear to figure out, even if it takes only a moderate amount of code. I hope you find the time and inspiration to complete this effort. Good luck!

jasone avatar Jul 26 '24 05:07 jasone

On https://github.com/ruby/lrama/pull/398/commits/7da96768fb91d6e017102a0b9a06528d7cf43f39 , Lrama can parse CRuby's parse.y at https://github.com/ruby/ruby/commit/028958f9ad83adbd1f7cb8e79167c9fb5e694535 .

These are the files of parsing results. ruby path/to/id2token path/to/parse.y | bundle exec lrama -v - lalr lalr.output

ruby path/to/id2token path/to/parse.y | bundle exec lrama -D lr.type=ielr -v - ielr ielr.output

junk0612 avatar Nov 14 '24 05:11 junk0612

@junk0612 I created 2 test cases as reproduction of https://github.com/ruby/lrama/pull/398#issuecomment-2475464104. See https://github.com/yui-knk/lrama/commit/ca288c87b79592826bc0aa7861aff963b002deb5

yui-knk avatar Jan 14 '25 13:01 yui-knk