A lightspeed scripting language with Lua-like syntax, compiled to bytecode and executed on a fast stack-based VM — all written in pure C.
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build# Run a script
./build/cs examples/hello.cs
# Start the REPL
./build/cslet x = 42
let name = "hello"
let active = true
let nothing = nilfn add(a, b)
return a + b
end
fn fib(n)
if n < 2 then return n end
return fib(n - 1) + fib(n - 2)
end
print(fib(30))if x > 10 then
print("big")
elseif x > 5 then
print("medium")
else
print("small")
endwhile x > 0 do
x = x - 1
end
for i = 0, 10 do
print(i)
endlet greeting = "Hello" .. " " .. "World"
print(greeting)-- This is a comment
let x = 42 -- inline commentprint(value)— print a value to stdoutclock()— returns elapsed time in seconds (for benchmarking)type(value)— returns the type of a value as a stringtostring(value)— converts a value to a stringtonumber(value)— converts a value to a number
CS compiles source code directly to bytecode in a single pass (no AST), then executes on an optimized stack-based virtual machine. This architecture minimizes memory allocations and maximizes throughput.