[antlr-interest] Advice requested: multiple passes vs. subclassing
Richard Clark
rd_clark at sbcglobal.net
Sat Jul 31 19:46:06 PDT 2004
I have an architectural question re: parser reusability.
I have a parser for Javascript / Actionscript and am deriving a couple
of products from it -- a Javadoc-style compiler and a Eclipse editor
plugin with "lint" functionality.
The parser generates a straightforward AST, and I've been using a tree
parser on the result to recognize and rename ordinary function
declarations into constructors and methods. However, when I want to do
Javadoc, I may actually need to post-process with two tree parsers --
one to rewrite some of the nodes, the other to assemble the Javadoc
output.
I've thought of a way to do this in one parser, but I don't want to
modify the generic language parser as that kills reusability. So, I'm
asking your advice: which of these would you do, given the choice:
1) Alter the base parser for each application
2) Subclass the base parser and roll the changes into the subclass
3) Go ahead with a generic parser and apply transforms to the resulting
trees?
I'd appreciate hearing from the more experienced folks here :)
Thanks,
...Richard
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/antlr-interest/
<*> To unsubscribe from this group, send an email to:
antlr-interest-unsubscribe at yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list