A simple interperter + compiler in Rust using the LLVM toolkit and the Inkwell crate. The interpreter/compiler supports a subset of the scheme programming language. Take a look at the programs folder for sample scheme programs that can be run using the interpreter/compiler. The best way to understand the interpreter/compiler implementation is via grokking the following two projects.
Note: The compiler requires type hints in case of list and function object parameters or if the function returns a list. The interpreter ignores these type hints.
To build the compiler you will need the LLVM toolkit installed. The current version of the compiler uses LLVM 15. Easiest method to build and try out the compiler is run the project under Vscode using devcontainers. The devcontainer sets up the entire environment to build the compiler.
cargo build
Run all of the tests
cargo tests
cargo run
To run programs using the interpreter
cargo run -- -i program.scm
To run programs using LLVM JIT compiler
cargo run -- -c program.scm