[antlr-interest] Bug or badly written error case

Benjamin Shropshire shro8822 at vandals.uidaho.edu
Mon Mar 3 16:01:02 PST 2008


Loring Craymer wrote:
> This is another example of the combined grammar confusion.  Combined grammars generate separate two recognizers--a lexer and a parser; the lexer executes before the parser.  Your first "import" rule defines three lexer rules in addition to the parser rule:
>
> IMPORT : 'import' ;
> T_xxx2 : ' ' ;
> T_xxx3: '\t' ;
>
> (I assume that you have IMPORT = 'import'; in your tokens section, although maybe not given the exception raised.)
>
> and even the "successful" case with import defined in terms of WS will not work as intended because the parser cannot encounter a WS token (the lexer moves these to the HIDDEN channel), so no input will match the import rule.
>
> I do like the definition with WS as a possible syntax for dealing with hidden tokens, though, when they are required to be present.
>
> --Loring
>   
I understand that there is an error in my code (and am not asking for 
help in fixing it as I already have), the issue I want to bring up is 
that the symptoms that my error caused are of no help what so ever in 
finding my error.  For the info that antlr gives to be useful, the user 
would need a understanding of the internals of antle. I think this is a 
problem and should be addressed.
>> This error in my code seems to be exposing a bug (or what looks like 
>> one) in antlr


More information about the antlr-interest mailing list