[antlr-interest] grammar inheritance example

Terence Parr parrt at jguru.com
Wed Jan 22 18:05:50 PST 2003


First upgrade to 2.7.2 then use -glib java.g option on antlr (or on 
2.7.1).

Terence

On Wednesday, January 22, 2003, at 06:03 PM, tdknghi 
<nk.truong at student.qut.edu.au> wrote:

>   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/
>
>
--
Co-founder, http://www.jguru.com
Creator, ANTLR Parser Generator: http://www.antlr.org
Lecturer in Comp. Sci., University of San Francisco


 

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



More information about the antlr-interest mailing list