[antlr-interest] Imported parser tokens mismatch

Luigi Iannone iannone at cs.manchester.ac.uk
Thu Apr 15 06:44:36 PDT 2010


Hi,

I am struggling to re-use tokens across grammars. I have two combined grammars, namely

ManchesterOWLSyntax.g 
OPPLScript.g

They both import a parser grammar called MOWLParser.g, 

ManchesterOWLSyntax.g  imports it directly, whereas OPPLScript.g imports OPPLParser.g which imports MOWLParser.g

I would have thought that all the .tokens generated files would overlap on all the tokens defined inside MOWLParser.g

Maybe I am missing something but if I try to generate the code I end up with different MOWLParser.tokens which results in different token type codes for the same token.

Just as example the token CONJUNCTION gets code 77 when generating OPPLScript.g and 56 when generating ManchesterSyntax.g

I put all the relevant files at http://www.cs.man.ac.uk/~iannonel/antlrexperiments/ (both the loose files and their zipped archive: import.zip)

Thanks in advance for any help,

Luigi


More information about the antlr-interest mailing list