lua-users home
lua-l archive

Re: LPEG output

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> "There cannot be a 'call' instruction in between. A commit is always in
> the same rule that generated the corresponding choice; so, any call
> between a choice and its corresponding commit must have returned."
> 
> Ok. But what if the failure happens during the call? Then the cleaning
> up of the stack encounters the 'call' stack element first.
> So, instructions encountered are: 1) choice, 2) call, 3) commit, and
> the failure (no match) happens between 2 and 3.
Then the commit is not executed. You asked about commit, not about fail.
A commit always find the choice at the top of the stack.
A fail (unlike a commit) must remove any call in the stack before
getting to a choice, which may not exist. This is all explained in the
paper.
-- Roberto

AltStyle によって変換されたページ (->オリジナル) /