Greetings!
On Wed, 2010-08-11 at 22:57 -0300, Victor Giordano wrote:
> Hi there!!. How you doing guys? Hope good!.
I am fine, I hope you are too!
> A have another question about tokens and lexical rules, i really don't
> get the idea...
> For example, assume we have this:
>
> 1)
> tokens
> {
> PLUS= '+';
> }
>
> 2) PLUS : '+';
>
> and then a rule
> expr: INT (PLUS INT)*;
>
> so... if a use one of another is exactly the same. The parse tree is the
> same, and the generated AST is also the same.
> Can you help me, and try to explain it to me. I read the book, but i
> don't understand.
>
As you have discovered, in this instance, ANTLR has 2 ways to express
the same concept.
There is, I believe, nothing else to explain here. You have correctly
analyzed that specifying a string value in the tokens{} block is
equivalent to specifying a lexical rule. Not a problem.
Perhaps I have mis-understood your question, please try to re-state your
question if you are still confused by these two equivalent
meta-syntactic constructs.
Hope this helps...
-jbb
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address
--
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.