A compiler for Crusty, a small expression-oriented language. Written in Rust.
Crusty is a minimal imperative language with Rust and Scala influences. Here's a taste:
var n: Int = read_int();
print_int(n);
while n > 1 do {
if n % 2 == 0 then {
n = n / 2;
} else {
n = 3*n + 1;
}
print_int(n);
}
- Expression-oriented: everything returns a value
- Three types: Int, Bool and Unit
- Lexical scoping with block expressions
- Short-circuit and/or
- Optional type annotations on variables
See the full language specification.
- Setup
- Tokenizer
- Parser
- Interpreter
- Type checker
- IR Generator
- Assembly Generator
- Functions
- break and continue
- Analysis & optimization