-
Notifications
You must be signed in to change notification settings - Fork 63
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
Integrate YARP (aka Prism) #1213
Conversation
5041e8e
to
6348f56
Compare
Using upstream code? What's next, switching to |
Ha! Possibly! 😆 |
This works: $ rake $ bin/natalie --ast -e "p 1+2" s(:block, s(:block, s(:call, nil, :p, s(:call, s(:lit, 1), :+, s(:lit, 2))))) $ bin/natalie -e "p 1+2" 3
I was trying to get test/natalie/method_test.rb parsing (and passing), but I found a few unexpected results from YARP. I think these are bugs, which I filed here: ruby/prism#1435 ruby/prism#1436
I'd love to find a way to avoid these dependencies. These are just for generating some sources for YARP, and are not used after that. I bet we can pre-generate YARP sources and commit to our repo...
This reverts commit 671c9e4.
This might allow us to skip installing some gems with bundler during the build process... I need to make sure this works across platforms.
Hash literal value omission wasn't added until 3.1 :-)
This returns a simpler node in a very specific case of "#{'str'}" which gets one spec passing that relied on that.
We have to keep the sexp_type for symbol, regex, etc.
For now... once the test suite is passing, it would be good to come back and remove this whole compatibility layer and have pass1.rb just consume the YARP nodes directly. Baby steps. :-)
All the tests in |
We don't handle the variable setting yet, but we didn't with NatalieParser either.
I need to learn how to say something like "unexpected X, expected Y"...
All existing specs passing!
|
@@ -4,6 +4,7 @@ task default: :build | |||
|
|||
DEFAULT_BUILD_TYPE = 'debug'.freeze | |||
SO_EXT = RUBY_PLATFORM =~ /darwin/ ? 'bundle' : 'so' | |||
SO_EXT2 = RUBY_PLATFORM =~ /darwin/ ? 'dylib' : 'so' |
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.
FYI this is called DLEXT in RbConfig terms
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.
Thanks!
This will be my branch to integrate YARP instead of NatalieParser.
NatalieParser was born out of my frustration with the state of Ruby parsers and lack of a library that was free of a dependency on Ruby itself. Our humble parser project proved you can build a fast Ruby parser free of the tight coupling to MRI, but we didn't have the resources to make it fully correct. There are just a lot of edge cases with Ruby parsing I didn't have time to suss out.
YARP came along after and did everything I hoped NatalieParser could do, but with the backing of a major corporation and support from the Ruby community.
NatalieParser was quite a labor of love, and we learned a lot. I'd like to think it showed some in the Ruby community what was possible, and I have no regrets in building it.
Now it's time to be a little more practical for Natalie, given that there are so few of us on the project, and we don't want to make building a parser our full-time OSS job. 😄 (I will archive the NatalieParser project once YARP is fully working with Natalie.)