Forum: Ruby parse tree for 1.9

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Roger P. (Guest)
on 2008-10-10 09:32
Anybody know if there is anything like parse_tree for 1.9?
Thanks!
-=R
Alex F. (Guest)
on 2008-10-10 12:06
(Received via mailing list)
Roger P. 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
Eric H. (Guest)
on 2008-10-10 12:32
(Received via mailing list)
On Oct 9, 2008, at 22:30 PM, Roger P. wrote:
> Anybody know if there is anything like parse_tree for 1.9?

require 'ripper'
Ripper.sexp '1 + 1' #=> [:program, [[:binary, [:@int, "1", [1, 0]], :
+, [:@int, "1", [1, 4]]]]]
Ryan D. (Guest)
on 2008-10-10 12:33
(Received via mailing list)
On Oct 9, 2008, at 22:30 , Roger P. 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).
Ryan D. (Guest)
on 2008-10-10 12:35
(Received via mailing list)
On Oct 10, 2008, at 01:02 , Alex F. wrote:

> Roger P. 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

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.
This topic is locked and can not be replied to.