Skip to content
Monkey language implemented with rust
Rust JavaScript HTML
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
assets
bin
pkg
src
web
.gitignore
Cargo.toml
LICENSE
README.md

README.md

monkey

About

Rust implementation of Monkey programming language from the book Writing an Interpreter in Go. This interpreter is also compiled into WebAssembly format so it can run on browser.

Prerequisite

Install Rust Toolchain

Follow these instructions to install Rust Toolchain

Install npm

npm is not necessary if you are only running the REPL Follow these instructions to install npm

If you already have npm installed, make sure it is up to date with the command below:

$ sudo npm install npm@latest -g

Usage

Running the REPL

Build the project using cargo

$ cargo build --release
	...
    Finished release [optimized] target(s) in 5m 16s 

Start the repl

$ target/release/monkey_repl
Welcome to the Monkey programming language!
Feel free to type in commands
>> 1 + 1
2
>> exit

Running it on browsers

Install the dependencies

In the web directory, run npm install to install the local development server and its dependencies.

$ sudo npm install

Use the local package in web

In the pkg directory, run npm link so that the local package can be depended upon by other local packages without publishing them to npm.

$ sudo npm link

In the web directory, run npm link monkey_wasm to use the linked verstion of the monkey_wasm.

$ sudo npm link monkey_wasm

Serving Locally

Run the server with npm run start and navigate your Web browser to http://localhost:8080/ and you should be able to run monkey language on the browser.

playground

You can’t perform that action at this time.