binit@ktm:~$ cat crust/README.md
Crust● active
A small typed programming language with its own bytecode compiler and virtual machine, written from scratch in Rust. Source goes through a lexer, parser, and type checker, then compiles to bytecode that runs on a stack VM with call frames.
- + typed AST and type checking
- + int and float arithmetic
- + if / else, for loops
- + recursive function calls
- + formatted printing with {}
- + bytecode disassembler
samples/recursion.crust
fn factorial(n: i64) -> i64 {
if n == 0 {
return 1;
} else {
return n * factorial(n - 1);
}
}
fn main() -> void {
print("5! = {}", factorial(5));
}recursive fib(30), mean run time
1.6× fasterthan CPython on this benchmark