Pallene support in localua

published 2022-10-10 [ home ]

Today I attended Lua Workshop, and Roberto Ierusalimschy’s keynote was about Pallene, a language designed as a system counterpart to Lua in a scripting architecture. The language is a typed subset of Lua and can be used to replace C or as an interface between Lua and C. It is still a work in progress, there is no stable release yet.

Pallene works by accessing the internals of the Lua VM, so it requires a patched version of Lua. I wanted to try it so I added support for it to localua. You can just use “pallene” instead of the Lua version and it will pull the latest sources of Pallene and its Lua fork and install them in a self-contained directory.

The Pallene compiler does not have an easy way to specify a local Lua directory and I decided against hacking it so you will have to pass CFLAGS as an environment variable for it to work.

I have just pushed a localua version that supports this so you too can try Pallene now. Be aware that I have only tested this on Linux, and that it is an undocumented feature which means I do not guarantee I will support it forever. That being said, this works now:

curl "https://loadk.com/localua.sh" -O
chmod +x localua.sh
./localua.sh .lua pallene
curl -O "https://raw.githubusercontent.com/pallene-lang/pallene/master/examples/fibonacci/fibonacci.pln"
CFLAGS="-I $(pwd)/.lua/include -O2" ./.lua/bin/pallenec fibonacci.pln
./.lua/bin/lua -e 'print((require "fibonacci").fibonacci(10)[8])' # prints 13