[antlr-interest] V3 error message

Jim Idle jimi at intersystems.com
Tue Dec 5 13:23:13 PST 2006

-----Original Message-----
From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-bounces at antlr.org] On Behalf Of babak.teymouri at noos.fr

> Hi, 
> I'm testing the antlr v3 with C code generation. 

You might receive warnings about missing templates here. You can ignore them as they don’t affect the validity of the code.

> Ive recieved somme error messages during grammar compilation:
> Has anyone experimented this ?
> The funniest thing is that the C code is well generated and well compiled!! 

> no such locale file org/antlr/tool/templates/messages/languages/fr.stg 
> retrying with English locale

Care to supply fr.stg? This is because the locale language has been detected as French, but there is no French translation of the error and warning messages yet.

> error(146): parselv3.g:95:2: invalid StringTemplate % shorthand syntax: '%s'
> error(146): parselv3.g:95:2: invalid StringTemplate % shorthand syntax: '%s'

This is because you have something like:

printf("text is %s\n", $x.text->chars);

ANTLR does not know about C stuff itself, so it sees a % in your format code and thinks you are trying to do something with a string template. Make this go away by escaping the %:

printf("text is \%s\n", .....

> error(10):  internal error: group C does not satisfy interface ANTLRCore: > missing templates [lexerRulePropertyRef_text, lexerRulePro
> pertyRef_type, lexerRulePropertyRef_line, lexerRulePropertyRef_pos, 
> lexerRulePropertyRef_index, lexerRulePropertyRef_channel]

You can ignore these, they will go away in the next beta. I just missed the boat on changing the lexer code gen template for C.

> error(10):  internal error: parselv3.g : java.lang.NullPointerException
> org.antlr.codegen.ActionTranslatorLexer.mLOCAL_ATTR(ActionTranslatorLexer.java:1045)
> org.antlr.codegen.ActionTranslatorLexer.mTokens(ActionTranslatorLexer.java:2891)

To get to the bottom of this, I would need to see your grammar. But it is probably something specified incorrectly that later releases of ANTLR would catch as a warning/error. One thing you could look for is over complicated use of $attribute stuff in C code expressions. In general you want to assign the results to some local variable and use that.


No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.430 / Virus Database: 268.15.7/569 - Release Date: 12/5/2006 3:00 AM

More information about the antlr-interest mailing list