[antlr-interest] C++ target Problem (typedef)

Gokulakannan Somasundaram gokul007 at gmail.com
Fri Feb 17 07:39:33 PST 2012


Can you send me your traits file? Have you taken a look at the examples
provided? There is a UserTraits.hpp in each.

Thanks,
Gokul.

On Fri, Feb 17, 2012 at 11:37 PM, Oliver Kowalke <oliver.kowalke at gmx.de>wrote:

>  OK - traits header done.
>
> Unfortunately I get another error:
>
> error: antlr3traits.hpp:6:10: error: »antlr3« is not a type (using g++
> 4.6.1)
>
> header antlr3traits.hpp is missing include directive for headers (string,
> antlr3memory.hpp for instance)
>
> regards,
> Oliver
>
> Am 17.02.2012 16:02, schrieb Gokulakannan Somasundaram:
>
> Thanks for testing the C++ grammar. Please do mention the compiler in
> which you are doing the testing.
>
> What you are seeing is not a bug. You should explicitly write a Traits
> file. If you look at the example, you might understand.
> After writing the TraitsFile, you have to include the file in @includes.
>
> Suppose you are generating legacyDevCfgLexer.hpp(.cpp) and
> legacyDevCfgParser.hpp(.cpp), then you write a TraitsFile like this.
>
> using namespace antlr3;
>
> namespace {yours} {
>       #include <antlr3traits.hpp>
>
>       typedef Traits<legacyDevCfgLexer, legacyDevCfgParser>
> legacyDevCfgTraits;
>       typedef legacyDevCfgTraits legacyDevCfgLexerTraits;
>       typedef legacyDevCfgTraits legacyDevCfgParserTraits;
> };
>
> This will create a traits definition with all defaults. The traits is
> required in C++, as we do change the definition at compile time using
> metaprogramming. Please let me know, if you need any help and let me know,
> if you find any bugs.
>
> Thanks,
> Gokul.
>
> On Fri, Feb 17, 2012 at 10:51 PM, Oliver Kowalke <oliver.kowalke at gmx.de>wrote:
>
>> Hi,
>>
>> I'm happy to see a runtime for C++.
>>
>> Unfortunately I get an error:
>> The grammer is named 'legacyDevCfg' and in the lexer header file
>> (legacyDevCfgLexer.hpp) a typedef is declared:
>>
>> typedef legacyDevCfgLexerTraits legacyDevCfgLexerImplTraits;
>>
>> But legacyDevCfgLexerTraits is not defined in the files (grep
>> legacyDevCfgLexerTraits *) :/
>>
>> echo $CLASSPATH
>> /home/abc/Projekte/Antlr/antlr_with_cpp-3.4.jar
>>
>> g++ -W -Wall -g -pthread -I.-I./Cpp/include  -c -o main.o main.cpp
>>
>> -> error: »legacyDevCfgLexerTraits« is not a type
>>
>> any ideas?
>>
>> thx,
>> Oliver
>>
>> List: http://www.antlr.org/mailman/listinfo/antlr-interest
>> Unsubscribe:
>> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>>
>
>
>


More information about the antlr-interest mailing list