On Mon, Oct 5, 2009 at 9:37 AM, Jean-Christophe Le Lann <[email protected]> wrote: > Hi > > I have just started reading the source of jruby 1.3.1 (I would like to > develop some source-to-source transformations). > > Sorry for this very basic questions : > > 1) what is the best way to start writing a new pass ? do you have some > advices/pointers for me to start ? > 2) I can't find any class that implements NodeVisitor... (Wright ?) Why ?
The NodeVisitor can work for this fine. Also the method Node.childNodes can be used to walk the tree. Our compilers both use childNodes and the interpreter is baked right into the Nodes themselves. We used to have more use for NodeVisitor when parsing projects (like Eclipse/Netbeans) directly consumed our AST. We forked that usage off to the JRubyParser project on kenai.com and all NodeVisitor consumers went with it. If you want lexically exact transformations (current AST will only guarantee semantic equivalence) then you may want to use the JRubyParser project. -Tom -- blog: http://blog.enebo.com twitter: tom_enebo mail: [email protected] --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
