Litan is a dynamically typed programming language with a C-like syntax.
function main() {
std::println("Hello World");
}
Litan has fully-featured lambda expressions and supports higher-order-functions.
function use_lambda(fx) {
return fx(1, 2);
}
function make_lambda(c)
=> lambda[c](a, b) => (a + b + c)
function main() {
std::println(use_lambda(make_lambda(3))); // 6
}
Reflections allow you to gather infos about your programm at compile-time.
function main() {
std::println("Line: " + std::str(reflect(line))); // Line 2
}
Litan uses structs whose members can added or removed dynamically.
function main() {
var object = std::struct();
object.foo = 42;
object.bar = 1337;
std::println(object.foo);
std::println(object.bar);
}
- Sphinx (Unit test framework)
- CMake 3.13 or newer
- A modern C++ compiler with C++20 support
- Clang++-10 or newer
- GCC-10 or newer
- stdxx library
- Clone the repository recursively.
- Run
./build.sh
to compile the compiler, vm and everything needed.- Note: Clang++ is choosen by default but this can be changed.
Just run
./build.sh COMPILER_GOES_HERE
in this case.
- Note: Clang++ is choosen by default but this can be changed.
Just run
- Run
./install.sh
to install ltn, ltnc, ltnvm and ltninfo into the /usr/local/bin/ directory.
Bob Nystrom: For his great book "Crafting Interpreters" which provided a large portion of the information I needed to realize this project.