[antlr-interest] Is tokenVocab an Option for Parser Grammars?

titech at metaorb.com titech at metaorb.com
Mon Aug 11 10:26:50 PDT 2008


Jim,
Is it possible to use a combined grammar and “import” some of the lexer rules—I’ve got a common subset of rules that I’d have to copy over and over, but I’d hate to have to make lexer rules for every literal.
Thanks,
--Mike
Mike Allbright
DLP Products
Texas Instruments, Inc.
>On Sun, 2008-08-10 at 15:11 -0700, titech at metaorb.com wrote: 
>I retested with the simple grammar files below.  The combined grammar works fine, 
>but the separate parse file causes an error regarding the literals (error text 
>below).  Do separate parse files require that all literals have associated lexer 
>rules?
>
>Yeah - you can't use literals in the parser unless you are using a combined grammar. My advice to you is 
>not to use literals in the parser, at least not when starting out, as it can greatly confuse you as to where the 
>literals are being matched (it is always in the lexer).
>
>Jim



More information about the antlr-interest mailing list