about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--users/tazjin/rlox/.gitignore3
-rw-r--r--users/tazjin/rlox/Cargo.lock6
-rw-r--r--users/tazjin/rlox/Cargo.toml9
-rw-r--r--users/tazjin/rlox/README.md7
-rw-r--r--users/tazjin/rlox/src/main.rs23
5 files changed, 48 insertions, 0 deletions
diff --git a/users/tazjin/rlox/.gitignore b/users/tazjin/rlox/.gitignore
new file mode 100644
index 000000000000..29e65519ba35
--- /dev/null
+++ b/users/tazjin/rlox/.gitignore
@@ -0,0 +1,3 @@
+result
+/target
+**/*.rs.bk
diff --git a/users/tazjin/rlox/Cargo.lock b/users/tazjin/rlox/Cargo.lock
new file mode 100644
index 000000000000..d8107726e067
--- /dev/null
+++ b/users/tazjin/rlox/Cargo.lock
@@ -0,0 +1,6 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+[[package]]
+name = "rlox"
+version = "0.1.0"
+
diff --git a/users/tazjin/rlox/Cargo.toml b/users/tazjin/rlox/Cargo.toml
new file mode 100644
index 000000000000..1562e7ecc2a3
--- /dev/null
+++ b/users/tazjin/rlox/Cargo.toml
@@ -0,0 +1,9 @@
+[package]
+name = "rlox"
+version = "0.1.0"
+authors = ["Vincent Ambo <mail@tazj.in>"]
+edition = "2018"
+
+# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+
+[dependencies]
diff --git a/users/tazjin/rlox/README.md b/users/tazjin/rlox/README.md
new file mode 100644
index 000000000000..1d2692d09cc1
--- /dev/null
+++ b/users/tazjin/rlox/README.md
@@ -0,0 +1,7 @@
+This is an interpreter for the Lox language, based on the book "[Crafting
+Interpreters](https://craftinginterpreters.com/)".
+
+The book's original code uses Java, but I don't want to use Java, so I've
+decided to take on the extra complexity of porting it to Rust.
+
+Note: This implements the first of two Lox interpreters.
diff --git a/users/tazjin/rlox/src/main.rs b/users/tazjin/rlox/src/main.rs
new file mode 100644
index 000000000000..3f173673a177
--- /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();
+    }
+}