[antlr-interest] Re: variables and keywords

lgcraymer lgc at mail1.jpl.nasa.gov
Sun Jan 25 01:18:13 PST 2004


Rene--

For this one, you want to avoid ANTLR's keyword feature and use
semantic predicates instead.  Where you would have placed a keyword
"key", use
{ LA(1) == "key" }? NAME
(where NAME is the generic token type for identifiers in this example)
and then elaborate on the predicate code to handle the behavior you
describe.

--Loring



--- In antlr-interest at yahoogroups.com, René Jansen <rvjansen at x> wrote:
> In the NetRexx language, when a string is used as a variable, it cannot 
> be a keyword anymore.  This is a great feature, and it comes out of the 
> real life experience that newly added keywords in most environments 
> (languages and toolkits) break existing programs. Now I've read about 
> (and used a bit) the keywords literals feature of Antlr, but I am at a 
> loss of how to specify the NetRexx behaviour in a grammar. Does anyone 
> have any pointers on how to implement such a feature, if I were to, 
> ahem, for example trying to make an antlr grammar for NetRexx?
> 
> Rene Vincent Jansen.


 

Yahoo! Groups Links

To visit your group on the web, go to:
 http://groups.yahoo.com/group/antlr-interest/

To unsubscribe from this group, send an email to:
 antlr-interest-unsubscribe at yahoogroups.com

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




More information about the antlr-interest mailing list