[grammarians] ruby parser

Charles Oliver Nutter charles.nutter at sun.com
Sat Dec 2 15:17:34 EST 2006


Wilson Bilkovich wrote:
> On 12/2/06, Hanan Mneimneh <hanan_mneimneh at hotmail.com> wrote:
>> Hello
>>
>> I need to generate a state machine for a web application developed using
>> ruby on rails. For this purpose, I need to dynamically parse the controller
>> which is a ruby class. Is there a decent parser to parse ruby code????????
>>
> 
> You can use the ParseTree or sydparse gems for this.

If you'd like something that works on JRuby as well, parsetree is 
probably a good choice; there's a clone of parsetree in development for 
JRuby.

However you should keep in mind that basing logic in your application 
directly on the structure of the AST is unlikely to be portable forever. 
The AST is bound to change.

-- 
Charles Oliver Nutter, JRuby Core Developer
Blogging on Ruby and Java @ headius.blogspot.com
Help spec out Ruby today! @ www.headius.com/rubyspec
headius at headius.com -- charles.nutter at sun.com


More information about the Rubygrammar-grammarians mailing list