[antlr-interest] Issue with antlr 2.7.5rc2

Tushar Jog tusharjog at gmail.com
Wed Feb 2 22:03:52 PST 2005


Hello Ric,

attached you can find the tinyc cpp antlr example, modified by
me to illustrate the bug I saw.

I have used antlr rev. 2.7.5 this time and have seen the same issue.

As a test case, I have created a derived grammar tinycc.

do , make -f makfile.tinycc

the compilation will fail due to the missing literal for "for".

now edit TinyCCTokenTypes.hpp and add the following line in the
appropriate place
       TK_for = 28,
now edit TinyCCLexer.cpp and add the following line in the appropriate place
       literals["for"] = 28;

this should make it compile without errors.

Do you think that this is a bug, or am I doing something wrong in
my grammar ?

also, I have seen another issue when you add a new TOKEN in the
derived grammar that has a string literal, but antlr 2.7.5 handles
this correctly
as opposed to 2.7.5rc2 or 2.7.4. I cannot explain why though !!

regards
Tushar


On Fri, 28 Jan 2005 13:53:04 +0100, Ric Klaren <ric.klaren at gmail.com> wrote:
> On Fri, 28 Jan 2005 02:29:27 -0600, Tushar Jog <tusharjog at gmail.com> wrote:
> > on creating a DerivedGrammar (Parser and Lexer) from a BaseGrammer
> > (Parser and Lexer) ,
> > the new literals introduced in DerivedGrammar do not find there way into
> > DerivedGrammarLexer.cpp    DerivedGrammar::initLiterals()  function,
> > while the following files
> > DerivedGrammarTokenTypes.txt
> > DerivedGrammarTokenTypes.hpp
> > show that the new literals have been added here.
> >
> > I am using the cpp code generation of antlr.
> >
> > On hand editing DerivedGrammarLexer.cpp to add the new literals to
> > initLiterals() function, the DerivedGrammar parser correctly recognizes
> > the new literals as literals as opposed to identifiers.
> >
> > Is this a know or new bug ? Or is this behaviour expected ?
> 
> It's the first time I hear of this behaviour.
> 
> > The expandedGrammar.g file looks OK though, so I suspect that this is
> > a cpp code generator issue.
> 
> C++ mode does basically the same as Java mode (or at least it should)
> 
> Could you send me the input files/pruned down input files that show
> the behaviour and I'll have a look at it.
> 
> > Also, how does one submit BUG FIX requests for antlr ?
> 
> The list is a good spot, Terence is also a good person to start with,
> C++ stuff you can directly take up with me, I assume the other backend
> maintainers also have no trouble with being mailed directly.
> 
> Cheers,
> 
> Ric
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tinyc.tar.gz
Type: application/x-gzip
Size: 12792 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20050203/6e90612a/tinyc.tar.gz


More information about the antlr-interest mailing list