[antlr-interest] CSharp2 code generation bug for ANTLRWorks 1.2.3 with -debug

Johannes Luber JALuber at gmx.de
Mon Jun 15 05:41:33 PDT 2009


> 
> The following grammar produces uncompilable code when generated from
> ANTLRWorks using -debug in the ANTLR options. I'm not sure which version of
> ANTLR is being used by ANTLRWorks. If it matters, I have ANTLR 3.1.3 on my
> machine.

ANTLRworks doesn't use ANTLR 3.1.3 yet. Please use the commandline tool to create debug parsers until a new version is published.

Johannes
> 
> ====
> 
> grammar EdifactDelfor;
> 
> options {
>   language = 'CSharp2' ;
> }
> 
> tokens {
> }
> 
> file        : contents+ EOF ;
> 
> contents    : TEXT
>         | SEP
>         | WS
>         | CSEP
>         | EOL
>         ;
> EOL: '\'';
> SEP: '+';
> CSEP: ':';
> TEXT: ('a'..'z'|'A'..'Z'|'0'..'9'|' '|'-'|','|'.'|'/'|'?')+ ;
> WS: ('\r'? '\n')+  ;
> 
> ====
> 
> Here is the culprit code that was generated (in the file() method):
> default:
>     if (cnt1 >= 1) goto loop1;
>     EarlyExitException eee1 =
>         new EarlyExitException(1, input);
>     dbg.RecognitionException(eee);   // Note the missing '1': should be
> eee1
> 
>     throw eee1;
> 
> When I manually change the reference to eee1, the thing compiles.
> 
> This bug does not appear when -debug is turned off.
> 
> Rob
> 
> _________________________________________________________________
> Attention all humans. We are your photos. Free us.
> http://go.microsoft.com/?linkid=9666046

-- 
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01


More information about the antlr-interest mailing list