On 08/15/2010 04:02 AM, sunao furukawa wrote:
> Hello,
>
> My grammar file is improved one by one.
> Constant 'b' is used by the rule level_symbol.
> I want to use variable name b.
> But, variable name b collides with constant 'b'.
> variable name b is red letter when debugging.
> Please teach the way not to collide constant 'b'.
Sunao,
This is the classic "keyword" vs "reserved word" problem.
If you wish for your keywords to be available as identifiers, you need
to include them in your simple_identifier rule.
I'd have a keyword rule:
keyword : 'b'
;
and then
Something like:
simple_identifier: ALPHA
| ALPHANUM
| keyword
;
BTW, this really is a FAQ and has been answered many times on this email
list. Check out the archives listed on the wiki page.
> input text when debugging
>
> primitive mux (y, a, b, sel);
> output y;
> input sel, a, b;
> table // a b sel : y
> 0 ? 0 : 0; 1 ? 0 : 1; ? 0 1 : 0; ? 1 1 : 1; endtable
> endprimitive
>
> Thanks
--
Kevin J. Cummings
[email protected]
[email protected]
[email protected]
Registered Linux User #1232 (http://counter.li.org)
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.