Parse tree for 1.9

Anybody know if there is anything like parse_tree for 1.9?
Thanks!
-=R

···

--
Posted via http://www.ruby-forum.com/.

Roger Pack wrote:

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

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

···

On Oct 9, 2008, at 22:30 PM, Roger Pack wrote:

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).

···

On Oct 9, 2008, at 22:30 , Roger Pack wrote:

Anybody know if there is anything like parse_tree for 1.9?

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

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.

···

On Oct 10, 2008, at 01:02 , Alex Fenton wrote:

Roger Pack wrote:

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