lua-users home
lua-l archive

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


On 2022-03-28 16:13, Roberto Ierusalimschy wrote:

Are there new relevant uses of Lua we should be aware of?
("new" ≈ released in the last year.)


Since the author, Eduardo Bart [1], have mentioned only tangentially his
work previously, I think it is worth noting again in the "Compilers
implemented in Lua" category:

Nelua [2] is a Lua/Teal flavored language which compiles to C, with true
native coroutines [3] (since 2021) and modern metaprogramming
capabilities (in Lua), akin to these found in Zig. The name comes from
"Native Extensible Lua" and plays the same role for the Lua users as Nim
plays for Python, but (unsurprisingly ;-)) generates more optimal and
clean C code.

Nelua translator is implemented 100% in Lua, starting from attributed
LPeg grammar. Last year, the grammar [4] has been rebased to lpegrex,
a new Lua parsing tool, which extends lpeg/lpeglabel re syntax with new
decorations for automatic AST generation. lpegrex is available as a rock
and more recently includes complete and practically usable C11 grammar
[5].

Amongst few other compound structures, Nelua build-in library [6]
includes hashmap and sequence, but not (yet) the composition of them - a
Lua tables equivalent. For the most frequent tables use (object
instances representation), there are metamethods capable `records`
(translated to C structs in the emitted code). Otherwise the standard
Lua library and mechanisms are already present, with the only notable
exception of full support for closures at the moment.

Despite it's original goal - to be convenient systems programming C++
replacement, once Nelua gain some IDE aids (LSP or something) for the
syntax extensions (especially the compile time metaprogramming
constructs), IMHO it also will be excellent choice for the the core part
of applications like Lite XL or Textadept, where a small C core is meant
to integrate and expose to the embedded Lua runtime some base API,
leaving the main logic the to the Lua side - with Nelua the both parts
of the code could use Lua style syntax, being more accessible for
contributions to the core part from bigger number of Lua (e.g. plugin)
developers.

Kind regards,
Alek

[1] https://github.com/edubart
[2] https://nelua.io/
[3] https://github.com/edubart/minicoro
[4] https://sourcegraph.com/github.com/edubart/nelua-lang/-/blob/lualib/nelua/syntaxdefs.lua [5] https://sourcegraph.com/github.com/edubart/lpegrex/-/blob/parsers/c11.lua
[6] https://nelua.io/libraries/