Callisto is a superset of Lua that transpiles straight down to regular Lua.
Callisto supports the following platforms:
- Lua 5.1, 5.2, and 5.3
- LuaJIT
- Bang variables -
object:bang!()
(object:bangBANG()
orobject:bangInPlace()
in legacy mode) - Que variables -
object:what?()
(object:whatQUE()
) - Increment operator -
number++
(legacy mode only) - Mutating operators
a += b
a -= b
a *= b
a /= b
a ^= b
a ..= b
- Compound named array lookups
vec->xyz
translates tovec[1], vec[2], vec[3]
- Supports the following sets of lookups; can be mixed:
(x, y, z, w)
(r, g, b, a)
(s, t, p, q)
(legacy mode only)(u, v)
(legacy mode only)
- Fat-arrow lambdas -
(x) => x^2
- Default function arguments -
function(x = 5) return x^2 end
Callisto exposes the compiler interface through the callisto
commmand line tool and through the Lua compiler API.
The command line can be invoked in two ways:
- Through an executable generated through
build.bat
orbuild.sh
(requires srlua) - Directly from the Lua source
Command line:
# outputs to file.lua
callisto file.clua
# outputs to other.lua
callisto file.clua -o other.lua
Directly from Lua source:
#outputs to file.lua
luajit tools/callisto.lua file.lua
#outputs to other.lua
luajit tools/callisto.lua other.lua
local Callisto = require("Callisto")
local source = [[
(x = 1) => x^2
]]
local source, sourcemap = Callisto.Transform(source)
local chunk, err = Callisto.LoadString(source, sourcemap)
if (not chunk) then
error(err)
end
chunk()
-- OR
local chunk, err = Callisto.Compile(source)
if (not chunk) then
error(err)
end
chunk()