[antlr-interest] composite grammar fails to generate lexer

T Stotts timotheus at tstotts.net
Tue May 26 21:04:53 PDT 2009


Hello. I have written a simple composite grammar. Antlr 3.1 fails to
generate a lexer when the lexer grammar is in its own file; but
generates a lexer when the grammar is combined into one file. The
eventual grammar will be very large, so I need to implement it as a
composite grammar. What do I do? Is this a bug in the software, and why
does this problem not show up for the antlr v3 examples?

Clarification: by failing to generate a lexer, I do mean that the tool
fails to create a Vhdl2008Lexer.java file.


/*   File Vhdl2008.g  */
grammar Vhdl2008;

options {
    language='Java';
}

import Vhdl2008LexerRules;

entity_declaration :
    ENTITY Identifier IS
    END (ENTITY)? (Identifier)? SEMICOLON
    ;


/*   File Vhdl2008LexerRules.g  */
lexer grammar Vhdl2008LexerRules;

END : ('E'|'e')('N'|'n')('D'|'d') ;
ENTITY : ('E'|'e')('N'|'n')('T'|'t')('I'|'i')('T'|'t')('Y'|'y') ;
IS : ('I'|'i')('S'|'s') ;

SEMICOLON : ';';

Identifier : ('A'..'Z'|'a'..'z') ( ('_')? 'A'..'Z'|'a'..'z'|'0'..'9' )*;

WS : (' '|'\t'|'\r'|'\n')+ {$channel=HIDDEN;};


-- 
aka:   timotheus
web:   http://tstotts.net/


More information about the antlr-interest mailing list