Another Rust implementation of the Lox programming language
- Nil
- Boolean
- Number (float64)
- String (UTF8 string),
- Functions (first class)
- repl
- expressions
- statements
- variables
- scope
- conditionals
- logic
- while
- for
- functions
- closures
- lambdas
- classes
fun makeCounter() {
var i = 0;
fun count() {
i = i + 1;
print(i);
}
return count;
}
var counter = makeCounter();
counter(); // 1
counter(); // 2
fun thrice(fn) {
for (var i = 1; i <= 3; i = i + 1) {
fn(i);
}
}
thrice(fun (a) {
print(a);
});
// 1
// 2
// 3