Problem with more than one tokentype files
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   dhanunjay_yandrapu
Posted On:   Friday, April 22, 2005 04:03 AM

hello, when i compiled a pascal grammar file by giving the command "java antlr.Tool pascal.g", it has generated the following java files PascalLexer.java PascalParser.java PascalParserTokenTypes.java PascalTokenTypes.java PascalLexer is implementing the interface defined in PascalTokenTypes.java and similary PascalParser is implementing interface in PascalParserTokenTypes.java. This is causing some problem in parsing the input file. This is because that the tokens have different values in the two Token Type.java files. For example IF token has value 6 in PascalTokenTypes.java file and it has value 50 in PascalParserTokenTypes.java. It means whenever lexer sees an IF token it returs it by retur   More>>

hello,

when i compiled a pascal grammar file by giving the command "java antlr.Tool pascal.g", it has generated the following java files

PascalLexer.java
PascalParser.java
PascalParserTokenTypes.java
PascalTokenTypes.java

PascalLexer is implementing the interface defined in PascalTokenTypes.java and similary PascalParser is implementing interface in PascalParserTokenTypes.java. This is causing some problem in parsing the input file. This is because that the tokens have different values in the two Token Type.java files. For example IF token has value 6 in PascalTokenTypes.java file and it has value 50 in PascalParserTokenTypes.java. It means whenever lexer sees an IF token it returs it by returning 6 but in parser the token correspondig to 6 is not IF. it is something else. How can i circumvent this problem. Any kind of help is appreciated.

thanks,
dhanunjay

   <<Less
About | Sitemap | Contact