about summary refs log tree commit diff
path: root/users/tazjin/rlox/src/main.rs
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2020-11-22T23·47+0100
committertazjin <mail@tazj.in>2020-11-23T01·15+0000
commit0618ff11ccf50fd6e8a6e0bd7820f19b100ca44a (patch)
treea0dea473f205242b043962bf7b3481439aff59f2 /users/tazjin/rlox/src/main.rs
parent312d76acba238d448112e3223fda1e9c5560be6c (diff)
feat(tazjin/rlox): Bootstrap program r/1912
This is going to be the first of two interpreters from "Crafting
Interpreters".

Change-Id: I354ddd2357444648d0245f35d92176dd176525d8
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2142
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
Diffstat (limited to '')
-rw-r--r--users/tazjin/rlox/src/main.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/users/tazjin/rlox/src/main.rs b/users/tazjin/rlox/src/main.rs
new file mode 100644
index 0000000000..3f173673a1
--- /dev/null
+++ b/users/tazjin/rlox/src/main.rs
@@ -0,0 +1,23 @@
+use std::process;
+use std::env;
+
+fn run_file(_file: &str) {
+    unimplemented!("no file support yet")
+}
+
+fn run_prompt() {
+    unimplemented!("no prompt support yet")
+}
+
+fn main() {
+    let mut args = env::args();
+
+    if args.len() > 1 {
+        println!("Usage: rlox [script]");
+        process::exit(1);
+    } else if let Some(file) = args.next() {
+        run_file(&file);
+    } else {
+        run_prompt();
+    }
+}