Skip to content

Commit

Permalink
use interpreter/codegen only when needed
Browse files Browse the repository at this point in the history
  • Loading branch information
Noxtal committed Sep 9, 2022
1 parent c0104de commit 677ae0b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mindblown"
version = "0.2.0"
version = "0.2.1"
description = "A brainf**k to x86 ELF compiler written in Rust meant for Linux and Windows under WSL."
license = "MIT"
edition = "2021"
Expand Down
6 changes: 4 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@ mod parser;
use crate::parser::*;

mod interpreter;
use crate::interpreter::*;

mod codegen;
use crate::codegen::*;

fn main() {
println!(
Expand All @@ -33,6 +31,8 @@ fn main() {
}

fn compile(path: &str) {
use crate::codegen::*;

let contents = fs::read_to_string(&path).expect("Could not read specified file/path!");
let nodes = Parser::parse(&contents);
let asm = Codegen::generate(&nodes);
Expand Down Expand Up @@ -102,6 +102,8 @@ fn compile(path: &str) {
}

fn repl() {
use crate::interpreter::*;

let mut interpreter = Interpreter::new();
loop {
print!("mindblown> ");
Expand Down

0 comments on commit 677ae0b

Please sign in to comment.