lua-users home
lua-l archive

[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.

On Tue, 25 Jun 2019 at 17:53, Roberto Ierusalimschy
<roberto@inf.puc-rio.br> wrote:
>
> > A couple of questions:
> > - the white paper says that a 'commit' pops the first element off the
> > stack, which it states must be a 'choice' stack element. However, if
> > there was a 'call' instruction in between, the 'choice' and the
> > 'commit' or 'fail' instructions, there will be another type of element
> > on the stack.
>
> 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.
>
>
> > - what does the 'closeruntime' instruction do?
>
> It closes a runtime capture, which involves calling the corresponding
> Lua function. (This is by far the most complex instruction.)
>
> -- Roberto
>