I have an architectural question re: parser reusability.
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
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
I'd appreciate hearing from the more experienced folks here :)