feat(tazjin/rlox): Bootstrap program
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
This commit is contained in:
parent
312d76acba
commit
0618ff11cc
5 changed files with 48 additions and 0 deletions
23
users/tazjin/rlox/src/main.rs
Normal file
23
users/tazjin/rlox/src/main.rs
Normal file
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue