[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Making custom DSLs starting with "!" and "@"
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Thu, 8 Nov 2018 09:46:57 -0200
> ltokenp uses a separate Lua interpretor. How different is it from the usual Lua 5.3.x code and can it be merged?
ltokenp is a preprocessor. You need to save its output and run it separately.
If your DSL contains Lua as a subset, then you can embed a token
processor by using the modified llex.c (one line) and a suitable
proxy.c. I have posted several examples here in lua-l. Search the
archives for proxy.c. However, writing a custom proxy.c is not fun for
anything complicated and requires some understanding of the internals
of Lua (mainly the lexer). This was the motivation for ltokenp, where
you can write token filters in Lua.