lua-users home
lua-l archive

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


Hi,

I'm just working on a library for that particular purpose ! This is
basically a string.dump for LPeg patterns.

https://github.com/jdesgats/lpeg-serialize

This is nowhere near finished, that's why I didn't announced on this
list yet. So don't expect it to be stable yet, any feedback or
contribution is welcome.

It is built as a completely separate module from LPeg, but you still
need LPeg headers to compile it, see the Makefile for details.

Compared to storing plain Lua code is simplicity (build your pattern
and save it) and speed, as building  and optimizing[1] large patterns
can be quite long.

[1] http://lua-users.org/lists/lua-l/2015-02/msg00284.html

Le Sat, 23 May 2015 19:28:41 +0700,
Александр Машин <alex.mashin@gmail.com> a écrit :

> Dear ALL,
> 
> is it possible to save a compiled LPeg grammar or pattern to file or 
> database and then to load it thence by means of pure Lua?
> 
> Effectively it means whether I can cast userdata to string and string
> to userdata correctly.
> 
> Alexander Mashin.
>