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

Add an option to use Prism parser #2642

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

Add an option to use Prism parser #2642

wants to merge 2 commits into from

Conversation

takaram
Copy link
Member

@takaram takaram commented Feb 15, 2024

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) with Prism::Tranlation::Parser.
Since this is just an experiment, the default parser remains to be that of parser gem. Instead I added --prism CLI option to switch the parser.

Here are some advantages with Prism:

Todo:

  • Support using Prism in opalopal
    • Prism can be run in JavaScript through wasm
  • Run tests with Prism

cc: @kddnewton

Copy link

@kddnewton kddnewton left a comment

Choose a reason for hiding this comment

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

Amazing!

@hmdne
Copy link
Member

hmdne commented Feb 15, 2024

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
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.

3 participants