-
-
Notifications
You must be signed in to change notification settings - Fork 337
Add an option to use Prism parser #2642
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
base: master
Are you sure you want to change the base?
Conversation
kddnewton
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing!
|
There's a small issue for opalopal as of now which regards loading of WASM modules - they can be only loaded async (at least in Chromium). I have a plan to support such workflow, but it will take some time. Other than that, before we flip the default, we will also have to check regressions in source maps. |
Thanks to recent improvement of Prism, we no longer need workaround code
|
So what's the current status of using Prism parser in Opal? |
|
@davispuh This PR is mostly about experimenting with Prism to work under MRI. And it mostly works. We have a long term goal to migrate from whitequark/parser to prism, but there are multiple issues as of now:
|
|
My bad, I didn't know it had gotten so big. I've lowered its size now ruby/prism#3824 and it could probably get quite a bit smaller if I'm honest. How big is the built whitequark/parser? I can aim to be smaller than that. |
|
@davispuh Is https://github.com/kateinoigakukun/irb.wasm what you're looking for? That's kind of orthogonal to this PR, which is more about supporting eval. |
|
@kddnewton I think you managed it :). I have tried to isolate Opal-compiled parser (with no other parts of Opal, ie. compiler): The second number is what we should compare against, since most of the time we want to ship Opal-generated code minified. |
|
Oh yeah nice, we're now < half that size. |
|
Is that including the support code for serialization? |
|
Yes! I just added the flags for ignoring the other optional features like JSON support/pack support/etc. |
Ruby 3.3 introduced Prism parser, and it is also released as a gem.
The latest version of Prism includes
Prism::Tarnslaion::Parser, a wrapper class to make Prism compatible with parser gem (whitequark/parser).This PR tries to replace the current parser (
Parser::Ruby32) withPrism::Tranlation::Parser.Since this is just an experiment, the default parser remains to be that of parser gem. Instead I added
--prismCLI option to switch the parser.Here are some advantages with Prism:
Todo:
cc: @kddnewton