[antlr-interest] revised subject: tree matcher problem with validating semantic predicate

Terence Parr parrt at cs.usfca.edu
Thu Aug 6 12:45:34 PDT 2009


When a semantic predicate fails to validate  when matching in filter  
mode, it assumes that the rule is not viable, rewind, and tries the  
next alternative.
Ter
On Aug 6, 2009, at 3:08 AM, Tom Smith wrote:

> Five more minutes' thought, and I'm no longer sure. =;^)
>
> There are other kinds of semantic predicates that can be used for
> disabling alternatives.  Is it really by design that a validating
> semantic predicate does not validate when filter=true?
>
> On Thu, Aug 6, 2009 at 5:59 AM, Tom Smith<yotommy at gmail.com> wrote:
>> On Thu, Aug 6, 2009 at 5:51 AM, Gavin Lambert<antlr at mirality.co.nz>  
>> wrote:
>>> I've never really played with filter=true in tree grammars, but  
>>> when used in
>>> lexers the whole point is to only define the rules you care about  
>>> and
>>> anything that doesn't successfully match a rule is ignored.
>>>
>>> Thus if the predicate fails, it's not an error -- it's simply not  
>>> a match
>>> for that rule, and the parser will go try another alternative, or  
>>> give up
>>> and skip it.
>>>
>>> So I'm not surprised that the exception isn't being produced.
>>>
>>
>> Gavin:
>>
>> Presented this way, your reasoning makes sense to me.  Thanks for
>> taking the time to respond.
>>
>> Tom.
>>
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address



More information about the antlr-interest mailing list