| Crates.io | chimpanzee |
| lib.rs | chimpanzee |
| version | 0.2.5 |
| created_at | 2023-08-12 10:47:28.313677+00 |
| updated_at | 2024-05-06 15:59:57.160302+00 |
| description | Monkey programming language implementation (interpreter, compiler and formatter), with added features |
| homepage | https://github.com/Yag000/monkey-rs |
| repository | https://github.com/Yag000/monkey-rs |
| max_upload_size | |
| id | 942681 |
| size | 386,976 |
The Monkey language is a language created by Thorsten Ball for his book Writing an Interpreter in Go. It is a dynamically typed language with C-like syntax. It supports integers, booleans, strings, arrays, hashes, and functions. It also has first-class functions, closures, and lexical scope.
Chimpazee is an implementation of the Monkey language in Rust. It is based on the books Writing an Interpreter in Go and Writing a Compiler in Go.
This implementation is still in development. For now an interpreter and a compiler are fully implemented, allowing to run a REPL and to run Monkey files (.monkey extension).
There are some issues that I want to fix before I can call this implementation complete.
To start the REPL, run the following command:
monkey
To run a Monkey file, run the following command:
monkey <path-to-file>
You can also test the compiler, parser and lexer in the same way, adding the following flag after the path to the file:
monkey --mode <mode>
Where <mode> can be compiler, parser, lexer or interpreter.
Example:
monkey <path-to-file> --mode compiler
A monkey formatter is also available, with the binary monkeyfmt. I will format any correct piece of monkey code.
To use it you only need to run the following command:
monkeyfmt <path-to-file>
Adding the -r flag after the file name will replace the contents of the file with the
formatted code. If the flag is not activated, the formatted code will be printed to
stdout.
To see the help, run the following command:
monkey --help
Chimpanzee is available as a cargo crate, which means that you can install it
by simple using:
cargo install chimpanzee
To install it from source you bust clone the repo. Once you have clone it you build the project
cargo build --release
This step can take some time, the expected time is less that 2 minutes, but it can be even longer.
In the directory target/directory the two executables will be now available: monkey and monkeyfmt.
Information about the monkey language is available in the MONKEY file.