[antlr-interest] Where to put general intialisation logic for a parser?

Johannes Luber jaluber at gmx.de
Tue Apr 10 05:01:31 PDT 2007


Hello,

I have to load a few files to initialize some variables at the beginning
of the parsing, but I'm not sure where to put this code. As I need to do
execute this code only once, I've looked for an action similar to
@members, but didn't found it. The closest I've come seems to be an
@init action at the start rule. Unfortunately, using @init doesn't seem
right for this purpose. So I've wondered if deriving a special Parser
class would be the right thing to do. I am right? If yes, is there
anything I have to be aware of?

Best regards,
Johannes Luber


More information about the antlr-interest mailing list