[antlr-interest] grammar inheritance example

tdknghi <nk.truong at student.qut.edu.au> nk.truong at student.qut.edu.au
Wed Jan 22 18:03:40 PST 2003


  Hi all,

I would like to extends the java.g grammar. I attempt to extend the 
grammar with the grammar bellow and here is the error.

<grammar.g>

class MyJavaParser extends JavaRecognizer;
options
{
	k = 2;
	exportVocab=MyJava;
	importVocab=Java;
	buildAST = true;
}

gapDeclaration: B_GAP;

class MyJavaLexer extends JavaLexer;

options
{
	exportVocab=MyJava;
	importVocab=Java;
}
B_GAP : "GAP";

Here is the error messages when you run java antlr.Tool grammar.g

ANTLR Parser Generator   Version 2.7.1   1989-2000 jGuru.com
error: grammar JavaLexer not defined
error: grammar JavaRecognizer not defined

Do any of you have any idea what goes wrong?

Thanks.

MM


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list