Hello Estrela ⭐️
Back in January (of this year), I wanted to seriously push the limits of Claude AI, and I ended up building (with Claude’s help) a Go interpreter for a language called Golo — one I used to contribute to a few years back (originally implemented in Java using Invokedynamic). That language had some pretty advanced — and genuinely novel — concepts, both on the object-oriented and functional programming sides. The interpreter lives here: https://gololang.org/
Mid-March, Golo’s dad (its creator), Julien, told me he’d had an interesting conversation with a colleague about Lua — and that it would be fun to write a Lua interpreter in Golo.
I have a special fondness for Lua: there was once a Palm Pilot port of Lua called Plua, and I used to spend my long commutes on the Paris metro coding on it, right there on the device.
I think I went through at least 5 Palm Pilots, including a Clié — what a magnificent machine that was!!!
But back to Julien’s joke. He said it as a throwaway. But it was too tempting, and I’ve always said you can do anything in Golo. So allow me to introduce Estrela ⭐️🎉, a Lua 5.4 interpreter written in GoloScript, running through the golo binary.
Estrela, First Contact
This project implements a complete Lua 5.4 execution engine — lexer, parser, and tree-walking interpreter — entirely in GoloScript (yes, THE dynamic language with the elegant functional syntax).
Prerequisites and Installation
- GoloScript (
golo) must be installed and available in your$PATH: https://codeberg.org/TypeUnsafe/golo-script/releases - Clone the Estrela repository: https://codeberg.org/TypeUnsafe/estrela and run the
./install.shscript
Distribution principle
The GoloScript runtime resolves module imports (import lua.Lexer, etc.) by looking
for .golo files relative to the file that imports them. This means the entire
project must be installed as a directory in a known, stable location.
The chosen layout is:
/usr/local/lib/estrela/ ← all .golo source files
main.golo
lua/
lexer.golo
token.golo
parser.golo
interpreter.golo
stdlib.golo
/usr/local/bin/estrela ← thin shell wrapper (executable)
The wrapper simply delegates to the GoloScript runtime:
#!/usr/bin/env bash
exec golo /usr/local/lib/estrela/main.golo "$@"
Once installed, users run Lua scripts with:
estrela my_script.lua
estrela my_script.lua arg1 arg2
estrela --version
Say Hello in Lua
Start by launching the REPL: type estrela and hit enter:
Estrela 0.1 (Lua interpreter written in GoloScript)
Type 'exit' or 'quit' to leave.
lua> message = "hello world"
lua> print(message)
hello world
lua> message = message .. "!!!"
lua> print(message)
hello world!!!
lua>
Say Hello to Bob in Lua
Create a hello_bob.lua script:
-- hello_bob.lua: basic hello function
-- hello function
local function hello(name)
return "Hello " .. name
end
-- main
print(hello("Bob"))
And run estrela hello_bob.lua to get your Hello Bob. 🎉
You can also use it as a bash script by adding #!/usr/bin/env estrela at the top and making hello_bob.lua executable:
#!/usr/bin/env estrela
-- hello_bob.lua: basic hello function
-- hello function
local function hello(name)
return "Hello " .. name
end
-- main
print(hello("Bob"))
Last but not least: Augment Estrela in Golo
If you take a look at https://codeberg.org/TypeUnsafe/estrela/src/branch/main/lua/stdlib.golo, you’ll find that it’s pretty straightforward to add new built-in functions to the Lua interpreter (Estrela) in Golo.
Excerpt:
tableSet(strLib, luaString("upper"), wrap("string.upper", |_self, args| {
let s = if args: isEmpty() { luaString("") } else { args: get(0) }
return list[luaString(s: value(): toUpperCase())]
}))
tableSet(strLib, luaString("lower"), wrap("string.lower", |_self, args| {
let s = if args: isEmpty() { luaString("") } else { args: get(0) }
return list[luaString(s: value(): toLowerCase())]
}))
Like I said, you can do anything in Golo. Have fun 🤓