Getting started
Build Citril, run a program, and open the REPL.
Requirements
- CMake 3.16 or newer.
- A C++17 compiler — MSVC (Visual Studio), Clang, or GCC.
Build
From the project root:
cmake -S . -B build
cmake --build build --config Release
The executable lands at build/Release/citril.exe on Windows
(or build/citril on single-config generators). Put that folder
on your PATH to type citril from anywhere.
Your first program
Create hello.citril:
let name = "world"
print("Hello, ${name}!")
Run it (the bytecode VM is the default back end):
citril hello.citril
# Hello, world!
The REPL
Run citril with no arguments to start an interactive session.
It evaluates each line and echoes the result of an expression:
$ citril
Citril 6 -- type Ctrl-D (or 'exit') to quit
>> 2 + 2 * 3
8
>> let xs = [1, 2, 3]
>> map(function(x) return x * x end, xs)
[1, 4, 9]
Two back ends
Citril ships with a tree-walking interpreter and a bytecode VM that runs
the same programs. The VM is the default; use --tree to force
the interpreter, and --bench to compare them:
citril program.citril # bytecode VM (default)
citril --tree program.citril # tree-walking interpreter
citril --bench program.citril # time both
Next: the Language guide.