[antlr-interest] Exported vocabularies not matching up

Bocek, Timothy (RDM) timothy.bocek at guidant.com
Mon Jul 10 08:47:38 PDT 2006


Not a stupid suggestion at all, although the batch script I was using to compile the grammars seemed to be doing things in the right order.  Fiddling with the script a bit got things to work, although I'm still unsure as to what was going wrong.  That, however, isn't an antlr issue.

Maybe it's time to install a Windows build of Make? ;)

Thanks again for the suggestion!
-Tim Bocek

"Any views expressed in this e-mail are not those of Guidant Corporation."

-----Original Message-----
From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org]On Behalf Of Koehne Kai
Sent: Saturday, July 08, 2006 12:20 AM
To: antlr-interest at antlr.org
Subject: RE: [antlr-interest] Exported vocabularies not matching up


Hi,

maybe a stupid suggestion, but did you check that you generate the lexer and the parser in the correct order? I had similar problems until I detected that my ant task mixed it up ... If it is something different, you should maybe post a minimal example ...

Regards,

Kai Koehne

-----Original Message-----
From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org]On Behalf Of Bocek, Timothy
(RDM)
Sent: Friday, July 07, 2006 11:34 PM
To: antlr-interest at antlr.org
Subject: [antlr-interest] Exported vocabularies not matching up


I'm working on a simple set of grammars in ANTLR version 2.7.5.  I am exporting lexers and grammars for Python.  My problem arises when I export the vocabulary from my lexer definition, then import the vocabulary into my parser definitions (I am using the same lexer with two different parsers, so having the lexer and parsers in one file is not an option).  The vocabulary exported from the lexer looks like this:

IF="if"=4
THEN="then"=5
ELSE="else"=6
RETURN="return"=7
TRUE="true"=8
FALSE="false"=9
APPLICABLE="applicable"=10
NOT_APPLICABLE="not_applicable"=11
ENUM_ITEMS="enum_items"=12
AND="and"=13
OR="or"=14
NOT="not"=15
ABS="abs"=16
MIN="min"=17
MAX="max"=18
ROUND="round"=19
WS=20
COMMENT=21
LETTER=22
DIGIT=23
SIMPLE_IDENTIFIER=24
IDENTIFIER=25
INTEGER=26
LPAREN=27
RPAREN=28
LBRACK=29
RBRACK=30
COMMA=31
DOT=32
SEMICOLON=33
PLUS=34
MINUS=35
TIMES=36
DIVIDE=37
EQ=38
NE=39
GT=40
LT=41
GE=42
LE=43

However, the vocabulary exported from the parsers looks like this:

IF="if"=4
THEN="then"=5
ELSE="else"=6
TRUE="true"=7
FALSE="false"=8
APPLICABLE="applicable"=9
NOT_APPLICABLE="not_applicable"=10
AND="and"=11
OR="or"=12
NOT="not"=13
WS=14
COMMENT=15
LETTER=16
DIGIT=17
SIMPLE_IDENTIFIER=18
IDENTIFIER=19
INTEGER=20
LPAREN=21
RPAREN=22
LBRACK=23
RBRACK=24
COMMA=25
DOT=26
SEMICOLON=27
PLUS=28
MINUS=29
TIMES=30
DIVIDE=31
EQ=32
NE=33
GT=34
LT=35
GE=36
LE=37
RETURN="return"=38
ENUM_ITEMS="enum_items"=39
ABS="abs"=40
MIN="min"=41
MAX="max"=42
ROUND="round"=43

As you can see, although the same tokens appear in both the lexer and the parser, the numerical identifiers have changed!  I have checked the import and export statements in my lexer and parsers and they look like they should be working.  Does anyone have an idea as to what might be causing this?  I am new to ANTLR, so help would be appreciated greatly!

Thanks,
Tim Bocek

"Any views expressed in this e-mail are not those of Guidant Corporation."


More information about the antlr-interest mailing list