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

Jim Idle jimi at temporal-wave.com
Thu May 4 00:51:39 PDT 2006


 
> > header "post_include_cpp" {
> >         #endif // PRECOMPILEDHEADERS
> >         #include "BaseParser.hpp"
> > }
> >
> > Rather cumbersome, but it worked.
> >
> > An option would be fine here ...

> I will let the C, C++ folks answer here.

The original question wwas more C++ oriented and seesm to require positional includes other than just at the top of the translation unit. Fortunately, ANTLR3 has mechanisms in the codegen whereby a particular target can allow sections that are peculiar to itself. I starterd to play with this a bit, but it did not work immediately and I did not have time to find out if that was my fault or a buglette in the codegen interface - eithe rway it is a simple debugging matter I think.
 
Hence, while C++ may well have different requirements to C, it is just a matter of defining some additional sections that make sense such as @postinclude or something similar. With C, I would wish to discourage the use of include files that carry code, in favor of solving any issues that people find this to be the only solution for, in a more elegant fashion. The C output, and I suspect that the other codegen authors have the same objective is meant to be as readable as it can be and it tries to produce code that you might actually type in - hopefully people don't generally put C functions in .h files ... (ha! Sometimes I even amuse myself ;-)).
 
Suffice it to say then, that I believe the solution to be much more elegant with ANTLR3, but the specific answer lies with the C++ codegen guy, which I believe is still Ric?
 
Jim


More information about the antlr-interest mailing list