racc icon indicating copy to clipboard operation
racc copied to clipboard

Documentation: How to use the pure Ruby version of racc

Open mohamedhafez opened this issue 1 year ago • 1 comments

It says in https://railsatscale.com/2023-08-29-ruby-outperforms-c/

An interesting feature of Racc is that it actually ships with a pure Ruby implementation of the parser runtime.

But I don't see documentation about how to choose to use the pure ruby variant of racc instead of the c-extension version, could that be added somewhere?

mohamedhafez avatar Jul 11 '24 08:07 mohamedhafez

It looks like this currently falls back to the pure-Ruby version only if the extension (JRuby or CRuby) does not load:

https://github.com/ruby/racc/blob/2c5a142f03ecde2044767d8d51eb05547777881f/lib/racc/parser.rb#L189-L214

I think we would need some additional code to allow users to opt into the pure-Ruby version or opt out of loading the extensions.

headius avatar Jul 11 '24 19:07 headius