[antlr-interest] predicate question
Gerald Rosenberg
gerald at certiv.net
Mon May 5 20:09:49 PDT 2008
At 07:27 PM 5/5/2008, Terence Parr wrote:
>On May 5, 2008, at 7:17 PM, Gerald Rosenberg wrote:
>
>>Is the question whether
>>
>>a : {p1}? {action();} {p2}? A | A ;
>>
>>should perform differently from
>>
>>a : {p1}? {action(); return true;}? {p2}? A | A ;
>>
>> From a high level the-grammar-as-a-language point of view, seems
>>like those two rules should match equivalently.
>
>p1 / p2 are evaluated out of order of normal flow, which is the
>issue. Predicates can be hoisted into parsing decision, which
>different than the matching. the matching works...prediction won't :)
>
>Ter
I was imprecise: "seems like those two rules should both predict and
match equivalently."
I know there is a historical basis for treating actions as first
class elements, but is there a language-level reason why an action is
not logically just an unchecked validating predicate (or a predicate
just a checked action with a bunch of nifty turbo-performance
accelerators under the hood)?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080505/671e37f7/attachment.html
More information about the antlr-interest
mailing list