DEV Community

Discussion on: Understanding Ruby's block/proc parsing

Collapse
 
daniel13rady profile image
Daniel Brady

Can you share how you are generating the parse trees in these examples? 🤔 It seems like it would be fun to play around with!

Collapse
 
penelope_zone profile image
Penelope Phippen

It's a library in Ruby called ripper:

require "ripper"
pp Ripper.sexp("hi")
# => [:program, [[:vcall, [:@ident, "hi", [1,0]]]]]
Collapse
 
daniel13rady profile image
Daniel Brady

Thanks!