[antlr-interest] semantic predicate

Loring Craymer Loring.G.Craymer at jpl.nasa.gov
Tue May 31 00:15:15 PDT 2005


Yeah, semantic predicate hoisting is a sorely missed feature in ANTLR 2.
PCCTS worked the way Lloyd would like, and ANTLR 3 will as well.  It makes
keyword handling (especially when keywords are not reserved words) much
easier.

 

--Loring

 

  _____  

From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of Alexey Demakov
Sent: Monday, May 30, 2005 11:58 PM
To: antlr-interest at antlr.org
Subject: Re: [antlr-interest] semantic predicate

 

No, rule will not be called when semantic predicate is in alternative

from where rule is called. Semantic predicate in rule have no effect

on call, but is additional state check.

 

So, rule will not be called in this situation:

 

another_rule:

     { false }? rule

   | ANOTHER_TOKEN

;

 

Try to look at ANTLR generated code.

 

Regards,
Alexey

 

-----
Alexey Demakov
TreeDL: Tree Description Language: http://treedl.sourceforge.net
RedVerst Group: http://www.unitesk.com

 

----- Original Message ----- 

From: Lloyd Dupont <mailto:lloyd at nova-mind.com>  

To: antlr-interest at antlr.org 

Sent: Tuesday, May 31, 2005 10:39 AM

Subject: [antlr-interest] semantic predicate

 

do they work?

 

 

normaly a rule (or subrule) like

rule: { false }? SOME_TOKEN;

 

should never be called!

unfortunately, if I added it I have plenty of error messages!

 

kind of puzzled...

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20050531/15719e0c/attachment-0001.html


More information about the antlr-interest mailing list