lua-users home
lua-l archive

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


On Sun, Jul 17, 2016 at 11:09 PM, Soni L. <fakedme@gmail.com> wrote:
> Can I wrap the LPeg module table and hook everything that gets passed into
> LPeg so I can build a visual representation of the parsing/matching process
> and stuff?
>
> It'd look cool.
>
> --
> Disclaimer: these emails may be made public at any given time, with or
> without reason. If you don't agree with this, DO NOT REPLY.
>
>

I have created emulator of "lpeg" module [1] as a part of lpjit, JIT
compiler of LPeg patterns [2]. This module is a drop-in replacement
for standard "lpeg" module. When match() method is called, a pattern
is passed to lpjit.compile [3], which produces machine code for the
pattern. The wrapper passes LPeg test suite.


[1] https://github.com/starius/lpjit/blob/master/src/lpjit/lpeg.lua
[2] https://github.com/starius/lpjit
[3] https://github.com/starius/lpjit/blob/14b9b225e085675d1/src/lpjit/lpeg.lua#L121

-- 


Best regards,
Boris Nagaev