This project is a Rinha programming language compliant interpreter designed to take part in rinha-de-compiler, a "compilers cockfight". I had zero to none experience with Rust before and I decided to build a code interpreter written in it. What a great idea, isn't it? I implemented a Tree-Walk Interpreter that takes advantage of pre-generated ASTs (abstract syntax trees) through the rinha crate and evaluates it. It didn't turned out as a bad idea because somehow I got into Rodrigo Navarro's live coding, in which he implemented a minimal Rinha interpreter in Rust, explaining it along the way. Henri Borges also implemented a great and simple interpreter in Rust, both of which served as a reference for me to deepen my studies in Rust and create my very own Rinha interpreter.
By default, the Rinha source code JSON AST file is located at /var/rinha/source.rinha.json
.
docker build . -t rinha-interpreter
docker run -v /path/to/source.rinha.json:/var/rinha/source.rinha.json --memory=2gb --cpus=2 rinha-interpreter
Please note that Docker is required in order to run the interpreter.
The rinha crate is required in order to generate the Rinha source code JSON AST file.
Once it's installed through cargo install rinha
, the JSON AST can be generated using the following command.
rinha /path/to/source.rinha > /path/to/source.rinha.json
Please note that Rust is required in order to install the rinha crate.