[antlr-interest] Lexer and Parser class packaging

Jim Idle jimi at intersystems.com
Mon Feb 5 09:19:10 PST 2007


ANTLR3 beginners will then just run into a different behavior issue as
soon as they want something in the headers other than the package and
want one thing in the lexer and another in the parser ;-). Also, now
that the book is virtually out the door, such things should be much less
of an issue providing the book is read beforehand.

One possibility though is to not have a default for the @header {} which
will then just leave @lexer::header and @parser::header, which are
probably more obvious.

Jim

-----Original Message-----
From: Martin Probst [mailto:mail at martin-probst.com] 
Sent: Monday, February 05, 2007 8:40 AM
To: Jim Idle
Cc: Vadim Tropashko; antlr-interest at antlr.org
Subject: Re: [antlr-interest] Lexer and Parser class packaging

Hi,

> You need to use @header::lexer and @header::parser. Otherwise the  
> header element will only appear in one of them (can't remember  
> which it is now by default ;-).

Why is that actually so? Apparently 95% of all beginners with ANTLR 3  
run into this problem, maybe you should simply adjust to the users  
and make @header {} be inherited by both parser and lexer?

Regards,
Martin




More information about the antlr-interest mailing list