[antlr-interest] Antlr v3.0ea8 : @header not taken into accountin automatically generated lexer java code...

Ric Klaren ric.klaren at gmail.com
Fri May 5 01:08:12 PDT 2006


Hi,

On 5/3/06, Arnulf Heller <aheller at gmx.at> wrote:
> I would settle for a different approach: use one header section and
> include that stuff in the lexer *and* in the parser. Keeps things
> simple and I suppose that everyone can live with the slight
> performance penalty.

Not really a fan of the idea. As soon as the syntax is well documented
it should not be a problem. Going from more to less seems to me a
wrong approach.

> That brings me to another point: usage of precompiled headers (for
> the C++ target). In v2, I used a small trick to get my precompiled
> headers working:
>
> header "pre_include_hpp" {
>          #ifndef PRECOMPILEDHEADERS
> }
>
> header "post_include_hpp" {
>          #endif // PRECOMPILEDHEADERS
>          #include "BaseParserTokenTypes.hpp"
> }
>
> header "pre_include_cpp" {
>          #include "StdAfx.h"
>          #ifndef PRECOMPILEDHEADERS
> }
>
> header "post_include_cpp" {
>          #endif // PRECOMPILEDHEADERS
>          #include "BaseParser.hpp"
> }
>
> Rather cumbersome, but it worked.

With V3 it should not be a problem to override a few template parts to
do this automagically. For V2 I probably won't bother myself unless I
receive a patch for it, although I dislike building compiler specifics
into the tool.

Cheers,

Ric


More information about the antlr-interest mailing list