Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace parser with one made by Racc #62

Merged
merged 16 commits into from Oct 6, 2023
Merged

Conversation

junk0612
Copy link
Contributor

@junk0612 junk0612 commented Jul 31, 2023

Generate the parser of grammar file with Racc and replace it from original parser.

TODOs

  • Enable to parse the Ruby's parse.y
  • Assemble the same AST as the original parser
  • Replace the parser with the original
    • Move to future work.

while !scanner.eos? do
start = scanner.pos
case
when scanner.scan(/\$(<[a-zA-Z0-9_]+>)?\$/) # $$, $<long>$

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If don't need to use the result of scan, you can try to use skip and save a lot of allocations and improve the performance

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar what I did in this PR #102

@junk0612 junk0612 force-pushed the use-racc branch 2 times, most recently from f7ae7f6 to c9f0cfd Compare October 5, 2023 15:02
@junk0612 junk0612 marked this pull request as ready for review October 6, 2023 12:31
@junk0612 junk0612 changed the title [WIP] Replace parser with one made by Racc Replace parser with one made by Racc Oct 6, 2023
@yui-knk
Copy link
Collaborator

yui-knk commented Oct 6, 2023

:shipit:

@yui-knk yui-knk merged commit 6adc53d into ruby:master Oct 6, 2023
11 checks passed
@yui-knk
Copy link
Collaborator

yui-knk commented Oct 6, 2023

I'm excited to merge this PR!
Hand written parser is replaced by LR parser generated by Racc.
Now, Ruby runs Racc, Racc generates LR parser for Lrama and Lrama generates LR parser for Ruby!!!

Greatly appreciate your hard work 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants