From 3ff7aac2d2eb2cbf2f854793fc0d7bc6f1f7d927 Mon Sep 17 00:00:00 2001 From: Rose Hogenson Date: Sun, 9 Jan 2022 08:40:09 -0800 Subject: Initial commit. Not sure if everything here will be needed eventually, but we have a working bytecode interpreter. Next I will write the linker, then the core compiler, and finish with the macro expander. --- bytecode/src/main.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 bytecode/src/main.rs (limited to 'bytecode/src/main.rs') diff --git a/bytecode/src/main.rs b/bytecode/src/main.rs new file mode 100644 index 0000000..b5a05ef --- /dev/null +++ b/bytecode/src/main.rs @@ -0,0 +1,13 @@ +mod bytecode; +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 exit_code = bytecode::eval(&prog).unwrap(); + std::process::exit(i32::from(exit_code)); +} -- cgit v1.3.1