Ok, I got it. Thanks.
2009/8/5 Safiye Celik <[email protected]>
> Hi,
> I am using ANTLR v3 with Java. What I want to ask is, when we should write
> "class MyParser extends Parser;" statement at the beginning of the .g
> grammar, and when we should write "grammar MyGrammar;" instead of that class
> statement. I have MyGrammar.g as below:
>
> grammar MyGrammar;
> options {}
> tokens{}
> //and rules here
>
> and when this grammar file is compiled, MyGrammarLexer.java and
> MyGrammarParser.java files are automatically generated and I had no problem
> till now. But I will add treewalker usage in my grammar file now, and in an
> example in v2, "grammar xxx;" is not used and instead, class declaration is
> used for xxxLexer, xxxParser and xxxTreeWalker. So, I try to do so, but I
> get "unexpected token:class" and some other errors when I comment out
> "grammar MyGrammar;" line and write "class MyParser extends Parser;"
> instead.
> What differs when I write "class MyParser extends Parser;" statement at the
> beginning of the grammar? And how can I get rid of the errors I get when I
> do so?
> --
> -safiye
>
--
-safiye
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address