aboutsummaryrefslogtreecommitdiffstats
path: root/bytecode/src/main.rs
diff options
context:
space:
mode:
authorRose Hogenson <rhogenson@posteo.net>2022-07-29 22:41:17 -0700
committerRose Hogenson <rhogenson@posteo.net>2022-07-29 22:41:17 -0700
commitc7ff0b98146693b60a3f075818f96764f646b2d5 (patch)
treeb8d2f409a934ae8c3858a30f42d1799b8abee5da /bytecode/src/main.rs
parentInsert an exit op at the end of the program. (diff)
downloadchromatopelma-c7ff0b98146693b60a3f075818f96764f646b2d5.tar.zst
Fix the bytecode interpreter.
I'm too scared to actually try to run it right now.
Diffstat (limited to 'bytecode/src/main.rs')
-rw-r--r--bytecode/src/main.rs6
1 files changed, 1 insertions, 5 deletions
diff --git a/bytecode/src/main.rs b/bytecode/src/main.rs
index 683ff26..8315d5a 100644
--- a/bytecode/src/main.rs
+++ b/bytecode/src/main.rs
@@ -3,12 +3,8 @@ mod data;
mod encoding;
mod heap;
-use std::io::Read;
-
fn main() {
- let mut buf = Vec::new();
- std::io::stdin().lock().read_to_end(&mut buf).unwrap();
- let prog = encoding::decode(&buf).unwrap();
+ let prog = encoding::decode(&mut std::io::stdin().lock()).unwrap();
let exit_code = bytecode::eval(&prog).unwrap();
std::process::exit(i32::from(exit_code));
}