[antlr-interest] Re: variables and keywords

lgcraymer lgc at mail1.jpl.nasa.gov
Mon Jan 26 11:56:51 PST 2004


Monty--

Thanks for the correction.  It is a bit unfortunate that ANTLR 2 does not h=
oist semantic predicates--I found keyword resolution through 
semantic predicates very helpful with PCCTS.  I probably should also mentio=
n that Rene will find it desirable to insert syntactic 
predicates before (some/many?) invocations of rules that use keyword sem pr=
eds--otherwise the calling rule tests for NAME without 
checking if that NAME is "key".  Good thing Ter's looking to support sem pr=
ed hoisting in ANTLR 3!

--Loring

--- In antlr-interest at yahoogroups.com, mzukowski at y... wrote:
> Actually that would be LT(1).getText()=="key".
> 
> Monty
> 
> -----Original Message-----
> From: lgcraymer [mailto:lgc at m...] 
> Sent: Sunday, January 25, 2004 1:18 AM
> To: antlr-interest at yahoogroups.com
> Subject: [antlr-interest] Re: variables and keywords
> 
> 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/


 

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