rlox-interpreter is an AST-walking implementation of Bob Nystrom's Lox language in Rust.

Overview

rlox-interpreter

rlox-interpreter is an AST-walking implementation of Bob Nystrom's Lox language in Rust.

Disclaimer: This is my first Rust project, do not expect idiomatic or performant code. 😉

Build

Execute the following commands to build rlox-interpreter:

cargo build --release

Usage

Start a repl:

target/release/rlox-interpreter

Execute a Lox script:

target/release/rlox-interpreter resources/benchmark/fib.lox

Benchmarks

rlox-interpreter is implemented as an AST-walking interpreter. Here are some execution times from running each of the benchmarks on an AMD Ryzen 7 Pro 5850U. For comparison there are also the execution times for Bob Nystrom's AST-walking interpreter (which is programmed in Java).

rlox-interpreter jlox rlox-interpreter/jlox
binary_trees.lox 6.129 s 4.624 s 1.33
equality.lox 7.045 s 2.849 s 2.47
fib.lox 5.675 s 2.884 s 1.97
instantiation.lox 2.219 s 1.126 s 1.97
invocation.lox 2.052 s 1.034 s 1.98
method_call.lox 1.016 s 1.258 s 0.81
properties.lox 2.799 s 3.201 s 0.87
string_equality.lox 2.185 s 2.273 s 0.96
trees.lox 14.073 s 22.050 s 0.64
zoo.lox 1.962 s 3.208 s 0.61

You can find the benchmark scripts here.

You might also like...
Regorus - Rego interpreter, analyzer and validator written in Rust

regorus THIS REPOSITORY IS IN ACTIVE DEVELOPMENT AND NOT INTENDED FOR PRODUCTION USE. Regorus is a Rego interpreter, analyzer and checker written in R

This crate defines a single macro that is a brainfunct compile-time interpreter.

Compile Protection This crate defines a single macro that is a brainfunct compile-time interpreter. One example is as follows #![recursion_limit = "18

PICNIC Is Config Notation Interpreter/Converter
PICNIC Is Config Notation Interpreter/Converter

PICNIC Is Config Notation Interpreter/Converter 🦀 PICNIC PICNIC's name is powered by AI, which immediately makes it worth your time: Human: Please co

A language server implementation for the WGSL shading language

wgsl-analyzer wgsl-analyzer is a language server plugin for the WGSL Shading language. It comes with a VS Code plugin located in ./editors/code, but d

tr-lang is a language that aims to bring programming language syntax closer to Turkish.

tr-lang Made with ❤️ in 🇹🇷 tr-lang is a language that aims to bring programming language syntax closer to Turkish. tr-lang is a stack based language

 RusTiny -- A Rust implementation of Tiny+ language
RusTiny -- A Rust implementation of Tiny+ language

RusTiny -- A Rust implementation of Tiny+ language 编译器实践 基本要求: 参考《编译原理及实践》的TINY语言编译器(已上传到群中)完成TINY+ 语言(见附录 A)的解释器:即给定满足 TINY+语言的源代码输入,你的解 释器可以给出对其的解释执

A language server for lua written in rust

lua-analyzer lua-analyzer is a lsp server for lua. This is mostly for me to learn the lsp protocol and language analysis so suggestions are helpful. T

A Simple, But amazing telegram bot, Made using the Rust language!

Telegram bot in Rust A fun Telegram bot made using Rust language.

Analogous, indented syntax for the Rust programming language.

Note: After experimenting with this in the wild, I have found representing keywords as symbols to be far less readable in large codebases. Additionall

Owner
Paul Fedorow
Paul Fedorow
Simplistic complier~virtual-machine that transforms AST into a Rust function, with basic type checking

rast-jit-vm rast-jit-vm is a simplistic, proof-of-concept~ish compiler / virtual machine that transforms syntax tree into a Rust function, type-checki

Patryk Wychowaniec 4 Oct 23, 2022
The brainfuck language interpreter written in Rust

The brainfuck language interpreter written in Rust

Jan Štaffa 1 Feb 21, 2022
A simple interpreter written in Rust programming language.

Interpreter in Rust A simple interpreter written in Rust programming language. Getting Started These instructions will get you a copy of the project u

Ismail Mosleh 5 Feb 17, 2023
Compiler & Interpreter for the (rather new and very experimental) Y programming language.

Y Lang Why would anyone build a new (and rather experimental) language with no real world use case. Design Y (pronounced as why) is based on the idea

Louis Meyer 8 Mar 5, 2023
Brainfuck interpreter written in rust

Brainfuck Interpreter Written in Rust Simple Interpreter that runs bare Brainfuck and extends it with debug command # which prints content of first te

Was 1 Nov 28, 2021
A Brainf** interpreter written in rust 🦀

Brainf Interpreter An interpreter for the esoteric programming language Brainfuck written in rust ?? Compilation NOTE: To compile the project, you nee

Chitram Dasgupta 2 Sep 12, 2022
Risc-V assembly interpreter built with pure Rust

Risc-V Interpreter Interpreter for Risc-V assembly built with Rust Report bug · Request feature Table of contents Quick start Exemple Program Instruct

null 2 Aug 24, 2022
Brainf - A brainfuck interpreter written in Rust 🦀

brainf A brainfuck interpreter written in Rust ?? . Do not I wrote this in my spare time... but still its good! Run Locally Clone the project git cl

Nav 3 Oct 8, 2022
Brainfu*k interpreter and REPL written in Rust🦀

brainfuck interpreter: a simple brainfuck interpreter and REPL writen in rust ?? Read this in other languages. AR Arabic-العربية Features Run brainfuc

Anas Elgarhy 7 Feb 1, 2023
A fast, powerful and configurable interpreter written in Rust

brainfuck-interpreter Overview A fast, powerful and configurable interpreter written in Rust, which allows various options to meet different demends,

Justin Chen 4 Feb 12, 2023