A small but fun toy scripting language written in Rust.
It's not fast, and it eats more memory than it should, but it's fun to play with!
Current language features include:
- Variables
- Functions
- Recursion
- Bindings for Rust-side functions
- Loops (supports
breakandcontinue)whileforloop(infinite loop)
if/else if/elsestatements- Comments (single line and multi-line)
- Arbitrary expressions
- Tiny standard library
- See the stdlib example for functions available
Currently there is no concept of exception handling, meaning that certain invalid operations will cause the program to panic. Exception handling is planned for the future.
The syntax is very simple and similar to other languages.
This code:
fib = fn(n) {
if n <= 1 {
return n;
} else {
return fib(n - 1) + fib(n - 2);
}
};
for (n = 0; n < 10; n = n + 1) {
print("fib_" + string(n) + " = " + string(fib(n)));
}
Will output:
fib_0 = 0
fib_1 = 1
fib_2 = 1
fib_3 = 2
fib_4 = 3
fib_5 = 5
fib_6 = 8
fib_7 = 13
fib_8 = 21
fib_9 = 34
See more examples in the examples folder.
The REPL is entered if no file arguments are passed:
cargo run --release
Currently inputs are limited to single lines.
There are a few example scripts written in ScriptyScript located in the examples folder. This one runs the math script:
cargo run --release examples\math.ss
If for whatever reason you want to read the documentation, you can build it locally:
cargo doc --no-deps --open