lua-users home
lua-l archive

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


In message <CAHPMtKQ5gN8CFw6wjKSTOThz_LJ1sJNdMBFim4rwC3N2SLGZgw@mail.gmail.com>
          Ignacio Burgueño <iburgueno@gmail.com> wrote:

>I found this, but it requires LuaJIT:
>https://github.com/sacek/LPegLJ

Thanks. My platform is not one on which LuaJIT runs, alas, but
the sources look interesting. What I was musing on was precisely
the business of matching streams against patterns. Hence my
interest in the notion of prefixes of patterns. 
A stream of characters produces a stream of strings, each of which
is a prefix of its successor. To retest each such string against the 
same pattern seems a bit uneconomic. One wants the matching process
to yield the state of the matching engine, so that the match can be
resumed for the next character to be received.

To test for failure of the match it is enough to test against a prefix
of the pattern. But what prefix? That thought led me to query whether
there is a minimal prefix that agrees with the pattern on the string
accumulated so far. Is this making any sense?

-- 
Gavin Wraith (gavin@wra1th.plus.com)
Home page: http://www.wra1th.plus.com/