parse tree for 1.9

A

Alex Fenton

Roger said:
Anybody know if there is anything like parse_tree for 1.9?
Thanks!


Perhaps RubyVM::InstructionSequence.compile or
RubyVM::InstructionSequence::compile_file will do something similar to
what you want. These methods are standard in 1.9

alex
 
E

Eric Hodel

Anybody know if there is anything like parse_tree for 1.9?

require 'ripper'
Ripper.sexp '1 + 1' #=> [:program, [[:binary, [:mad:int, "1", [1, 0]], :
+, [:mad:int, "1", [1, 4]]]]]
 
R

Ryan Davis

Anybody know if there is anything like parse_tree for 1.9?

ruby_parser (new and massively improved release coming soon)... don't
let the 1.0.0 release bias your opinion too much.

The only thing it doesn't do is ASTs of runtime objects (procs,
methods, classes/modules). It is 100% compatible with ParseTree's
output tho (that also has a big release coming and there is some
incompatibilities, tho minor).
 
R

Ryan Davis

Perhaps RubyVM::InstructionSequence.compile or
RubyVM::InstructionSequence::compile_file will do something similar
to what you want. These methods are standard in 1.9

unfortunately, no... that's not even close. :(

I've asked multiple times if we could get bytecode for procs and short
of writing more C extensions to hack it out myself, I doubt it'll ever
show. Even still, we'd have to write a bytecode decompiler to
something that was remotely readable/usable. That's a lot of work.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,199
Messages
2,571,045
Members
47,643
Latest member
ashutoshjha_1101

Latest Threads

Top