Skip to content

Commit

Permalink
feat: vm as separated crate
Browse files Browse the repository at this point in the history
  • Loading branch information
Mateusz Russak committed Dec 2, 2023
1 parent b1e095f commit a6776a6
Show file tree
Hide file tree
Showing 8 changed files with 346 additions and 307 deletions.
14 changes: 14 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ lexer = { path = "./crates/lexer" }
parser = { path = "./crates/parser" }
interpreter = { path = "./crates/interpreter" }
compiler = { path = "./crates/compiler" }
vm = { path = "./crates/vm" }
cli = { path = "./bins/cli" }
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

1 change: 1 addition & 0 deletions crates/compiler/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ crate-type = ["lib"]
[dependencies]
enum-display = "0.1.3"
lexer = { path = "../lexer" }
vm = { path = "../vm" }
num = "0.4.1"
num-derive = "0.4.1"
num-traits = "0.2.17"
Expand Down
15 changes: 1 addition & 14 deletions crates/compiler/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,21 +1,8 @@
mod vm;
mod op_code;
mod instr;

extern crate num;
#[macro_use]
extern crate num_derive;
#[macro_use]
extern crate enum_display;

use std::{fmt::{Display, Formatter}};

use lexer::PError;
use parser::{Node, Op, Value};
pub use vm::VM;
pub use instr::{Instr, Instrs};
pub use op_code::OpCode;

use vm::OpCode;

struct Instruction {
op_code: OpCode,
Expand Down
19 changes: 19 additions & 0 deletions crates/vm/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[package]
name = "vm"
version = "0.1.0"
edition = "2021"

[lib]
tests = true
path = "src/lib.rs"
crate-type = ["lib"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
enum-display = "0.1.3"
lexer = { path = "../lexer" }
num = "0.4.1"
num-derive = "0.4.1"
num-traits = "0.2.17"
parser = { path = "../parser" }
Loading

0 comments on commit a6776a6

Please sign in to comment.