aboutsummaryrefslogtreecommitdiffstats
path: root/bytecode/src/main.rs
diff options
context:
space:
mode:
authorRose Hogenson <rhogenson@posteo.net>2022-01-09 08:40:09 -0800
committerRose Hogenson <rhogenson@posteo.net>2022-01-09 08:40:09 -0800
commit3ff7aac2d2eb2cbf2f854793fc0d7bc6f1f7d927 (patch)
treecef8ca0e77c40a70daaca40af25572437d563105 /bytecode/src/main.rs
downloadchromatopelma-3ff7aac2d2eb2cbf2f854793fc0d7bc6f1f7d927.tar.zst
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.
Diffstat (limited to 'bytecode/src/main.rs')
-rw-r--r--bytecode/src/main.rs13
1 files changed, 13 insertions, 0 deletions
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));
+}