[antlr-interest] Bug report: Composite grammar with all tokens defined in Lexer

Terence Parr parrt at cs.usfca.edu
Sun Dec 28 12:54:15 PST 2008


Wow. I broke something. doh. Adding bug report. thanks,
Ter
On Dec 28, 2008, at 11:00 AM, George S. Cowan wrote:

> The same error happens with the grammar at the end of the Composite  
> Grammar
> page on the wiki.
>  http://www.antlr.org/wiki/display/ANTLR3/Composite+Grammars
>
> The CLexer.java file is not generated for the grammars as written.
>
> But we can generate the CLexer.java file if we comment out the SPACE  
> rule in
> grammar L and, in grammar P1, change rule spaces to
>  spaces: ' '+ ;
>
> For convenience here are the files that I copied from the Composite  
> Grammar
> page.
>
> -------------------- begin L.g --------------
> lexer grammar L ;
>
> LETTER : 'a'..'z' ;
> SPACE : ' ' ;
>
> ---- begin P1.g (note: changed grammer to grammar) ---
> parser grammar P1 ;
>
> letter : LETTER ;
> spaces : SPACE+ ;
>
> --- begin P2.g (note: changed grammer to grammar) ---
> parser grammar P2 ;
> import P1 ;
>
> letters : letter+ ;
>
> --------------- begin C.g ---------
> grammar C ;
> import L, P2 ;
>
> stuff : ( letters spaces )+ ;
>
> --------- end grammar files ------------
>
> I ran my tests on Windows XP using the command line
>  java -cp C:\Java\ANTLR\antlr-3.1.1.jar org.antlr.Tool -o work C.g.
>
>
> Regards,
> George
>
>
> 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