derekstride/monkey

I'm following along the book "Writing An Interpreter In Go" by Thorsten Ball and

I'm following along the book "Writing a Compiler in Go" by Thorsten Ball implementing a toy language call Monkey

Monkey

I'm following along the book "Writing An Interpreter In Go" by Thorsten Ball and "Writing a Compiler in Go" by Thorsten Ball implementing a toy language call Monkey.

I am using Rust instead of Go to help learn the language.

Results

➜ monkey cargo bench

running 5 tests
test tests::bench_compile ... bench:      22,297 ns/iter (+/- 1,732)
test tests::bench_eval    ... bench:  49,248,606 ns/iter (+/- 3,758,017)
test tests::bench_parse   ... bench:      24,604 ns/iter (+/- 1,191)
test tests::bench_rust    ... bench:           0 ns/iter (+/- 0)
test tests::bench_vm      ... bench:   1,466,072 ns/iter (+/- 97,031)

test result: ok. 0 passed; 0 failed; 0 ignored; 5 measured; 0 filtered out; finished in 17.81s

➜ monkey cargo run --bin=bench
    Finished dev [unoptimized + debuginfo] target(s) in 0.01s
     Running `target/debug/bench`
Running:
fibonacci(28);

Rust
Result: 317811
Duration: 0.3984s

Vm
Result: 317811
Duration: 7.276345s

Eval
Result: 317811
Duration: 111.487040s

Vm is 15.32x faster than Eval

Use the following commands to generate flamegraphs with cargo flamegraph

cargo flamegraph --dev --bin=flamegraph --root -o tmp/flamegraph-vm.svg -- --engine=vm
cargo flamegraph --dev --bin=flamegraph --root -o tmp/flamegraph-eval.svg -- --engine=eval

Flamegraph for the Vm engine

Information - Updated Jul 30, 2022

Stars: 1
Forks: 1
Issues: 0

A fantasy deathcrawl in Rust

To run, with Rust compiler and Cargo package manager installed:

A fantasy deathcrawl in Rust

MIRAI is an abstract interpreter for the Rust compiler's mid-level intermediate

MIRAI is an abstract interpreter for the mid-level intermediate

MIRAI is an abstract interpreter for the Rust compiler's mid-level intermediate

Rust compiler toolkit for WebAssembly apps in the WasmEdge Runtime

Developers: Getting started with the Tencent Serverless Functions for AI inference, or WasmEdge Runtime

Rust compiler toolkit for WebAssembly apps in the WasmEdge Runtime

guessing_game_rust

A repo used to learn rust using the Rust compiler

guessing_game_rust

owner-thing-rust

A repo used to learn rust using the Rust compiler

owner-thing-rust

enums_thing_rust

A repo used to learn rust using the Rust compiler

enums_thing_rust

collections-rust

A repo used to learn rust using the Rust compiler

collections-rust

A snake game written in Rust

Download Rust compiler from

A snake game written in Rust

C Compiler in Rust

A basic C compiler written in Rust, roughly following the tutorial official Rust compiler was taken as inspiration

C Compiler in Rust

It is rust bindings and wrapper around libconfig library

It is rust bindings and wrapper around Rust Compiler

It is rust bindings and wrapper around libconfig library

Toy Rust Compiler

A compiler can be broken down into 4 parts

Toy Rust Compiler
Facebook Instagram Twitter GitHub Dribbble
Privacy