[antlr-interest] Question about factories

Tiller, Michael (M.M.) mtiller at ford.com
Wed Jul 9 12:46:53 PDT 2003


Note: I'm using antlr-2.7.2 and C++ code generation...
 
I noticed that the initializeASTFactory() method for my generated parser is not static.  Why?  More specifically, why should I have to instantiate a lexer so I can instantiate my parser so I can initialize an ASTFactory (which I'm using to generate trees outside my parser) so I can duplicate a node in my AST.  This seems overly complicated.  First, if initializeASTFactory was static (it doesn't seem to use any members of the parser), I wouldn't have to instantiate anything.  Even better, it would also be possible to generate a derived factory class from ASTFactory that just calls the static initializeASTFactory on itself in its constructor.  This way, I'd just have instantiate the factory type specific to my parser (no manual initialization required).
 
Am I missing something?
 
--
Mike
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20030709/71dab09e/attachment.html


More information about the antlr-interest mailing list