From d8547997552293988a155a377ee2952a489a465c Mon Sep 17 00:00:00 2001 From: Furkan Date: Sun, 13 Sep 2020 00:53:16 +0300 Subject: [PATCH] update to v0.2.0 Signed-off-by: Furkan --- Cargo.toml | 8 ++++++-- README.md | 30 ++++++++++++++++++++++-------- src/main.rs | 2 +- 3 files changed, 29 insertions(+), 11 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ab45efe..e8fb151 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] -name = "Monkey" -version = "0.1.0" +name = "monkey" +version = "0.2.0" authors = ["Furkan "] edition = "2018" keywords = ["interpreter"] @@ -8,3 +8,7 @@ license = "MIT" [dependencies] byteorder = "1.3.4" + +[[bin]] +name = "benchmark" +path = "src/benchmark.rs" diff --git a/README.md b/README.md index eae9dc4..123affd 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![Build](https://travis-ci.org/Dentrax/Monkey.svg?branch=master)](https://travis-ci.org/Dentrax/Monkey) -**Yet another Monkey interpreter implementation in Rust, based on Thorsten Ball's [Writing An Interpreter In Go](https://interpreterbook.com/) book.** +**Yet another Monkey interpreter & compiler implementation in Rust, based on Thorsten Ball's [Writing An Interpreter In Go](https://interpreterbook.com/) and [Writing A Compiler In Go](https://compilerbook.com/) books.** ## Features * AST @@ -10,7 +10,11 @@ * Parser * Lexer * Evaluator +* Compiler +* SymbolTable +* VirtualMachine * Builtin Functions +* Functions & Closures * Read–Eval–Print Loop ## Usage @@ -20,18 +24,18 @@ ### 2. Test -```rust -cargo test --all +```sh +$ cargo test --all ``` ### 3. Run -```rust -cargo run +```sh +$ cargo run --bin monkey ``` ```bash -Monkey Interpreter v0.1.0 +Monkey Compiler v0.2.0 >>> "Hello, " + "World!" Hello, World! >>> @@ -130,9 +134,19 @@ let getAge = fn(person) { person["name"]; }; return getAge(people[0]) + getAge(people[1]); ``` +## Benchmark + +```sh +$ cargo run --release --bin benchmark -- --vm +$ cargo run --release --bin benchmark -- --eval +``` + ## TODO -- [ ] Impl Compiler -- [ ] Impl VM +- [X] Impl Compiler +- [X] Impl VM +- [ ] Add Pipeline with Stages: `fmt`, `check`, `clippy`, `test`, `build` +- [ ] Optimize overall performance +- [ ] Fix `clippy` warnings ## License diff --git a/src/main.rs b/src/main.rs index 9e8ee1e..f8171c4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,7 +3,7 @@ use monkey::repl; fn main() { //Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:37:02) [MSC v.1924 64 bit (AMD64)] on win32 - println!("{name} Interpreter v{version}", + println!("{name} Compiler v{version}", name = env!("CARGO_PKG_NAME"), version = env!("CARGO_PKG_VERSION"), );