oracle / truffleruby

A high performance implementation of the Ruby programming language, built on GraalVM.
https://www.graalvm.org/ruby/
Other
2.99k stars 180 forks source link

Replace Ripper with Prism's Ripper compatibility layer #3481

Open andrykonchin opened 4 months ago

andrykonchin commented 4 months ago

Replace Ripper C code with Prism::Translation::Ripper implementation.

eregon commented 4 months ago

Adding some notes: https://github.com/ruby/prism/issues/2354#issuecomment-1981382155 so the Prism Ripper compat should be mostly complete. So it'd be worth to try using Prism to replace Ripper in TruffleRuby. That'd need shipping the Ruby sources of Prism in TruffleRuby as well, probably best as a default gem like in CRuby 3.3 so it can be upgraded and e.g. there is no issue when loading Prism gem + Ripper. So maybe best done after importing Ruby 3.3 sources, OTOH Prism in Ruby 3.3.0 is too old, so seems no need to wait. Probably we should have a script to copy the files from the prism repo to places that make sense for a default gem, i.e. similar places for other default gems.

Regarding which libprism to use we should just use the one from the gem, because the Ruby code depends on it, so it's necessary. Also there is a the syntax version in Prism which should be enough to guarantee Ripper returns something that's the same version as RUBY_VERSION.