Sauvignon is a tree walking interpreter written in Rust.
Rust 2018 is required to compile this project. Currently, there are no additional dependencies.
$ cargo build
Start the REPL using
$ cargo run
or
$ cargo build
$ ./target/debug/sauvignon
Supported data types
- Integer
- Boolean
- String
Do integer arithmetic using +
, -
, *
, and /
.
(3+2) * 3
(6 - 1) / 5
20 / 4 - 5
Objects can be assigned to identifiers using let <ident> = <object>
.
let thirty = 30;
Declare functions using the fn
keyword.
let add = fn (a, b) {
return a + b
}
After declaring, you can call the functions.
add(5, 2)
Conditional control flow can be achieved using if
statements.
let a = 5;
if ( a != 5 ) {
return false;
} else {
return true;
}
String concatenation works using the +
infix operator.
"I like " + "CHEESECAKE!"
- Basic Lexer
- Extended Lexer
- REPL
- AST constructor
- Parser
- Internal object system
- Evaluator
- Built-in functions
- Arrays
- Hash maps
- Module import