TLDR: I made Filli (this is a link), a Lua/python-like embeddable language written in C23 (or C99 with GNUisms; compiles as C++ too!). The license is permissive. It’s sandboxable, like Lua. It’s not overly simplistic: it has functions, closures, generators, dictionaries, and arrays. The interpreter is 2x as slow as (1x slower than) Lua, which is way more impressive than it sounds. It has an AOT (ahead-of-time compilation) version that can hit performance numbers half way between LuaJIT’s interpreter and compiler. The AOT version works by emitting C code that includes a modified version of the interpreter and then running the bytecode one instruction at a time, and then you compile that C code with a C compiler – it’s a “transpiler”, sort of. The AOT version is often 6x as fast as the interpreter, beating the Lua and LuaJIT interpreters in many cases. Filli’s syntax looks like this: # the "Too Simple" pi calculation benchmark, slightly modified func calc(n): let sum = 0 let flip = 1 print(n) print(sum) print(flip) for i in n: sum += flip / (2 * i + 1) flip *= -1 end return sum end let sum = calc(100000) Background It started when I saw a post linked on lobste.rs about someone trying to find the smallest embeddable scripting language. I was surprised at their options: anything that wasn’t a forth or scheme was either really big or lacked a way to do record types (often not even having arrays/dictionaries let alone structs). Even Lua was surprisingly big, coming in at well over a hundred KB, much closer to two hundred. (Example code from Flinch, an older language) I’d previously written Flinch, a stack language (sort of like Forth) that added concessions to make it easier to use the “Functional but Imperative” code shape common to C, Python, Lua, etc. It was very small, but implemented in C++ with a whole lot of cruft left behind from attempts to efficiently use C++-level refcounting for memory management. The syntax was otherwise INCREDIBLY awful. It was in no positio...
First seen: 2025-08-29 14:34
Last seen: 2025-08-29 14:34