about summary refs log tree commit diff
path: root/users/tazjin/rlox/src/main.rs
blob: 13a5748187ade4fa1eaa190b87c35a406a7cc5b4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use std::env;
use std::fs;
use std::io;
use std::io::Write;
use std::process;

mod bytecode;
mod errors;
mod parser;
mod scanner;
mod treewalk;

fn main() {
    match env::var("LOX_INTERPRETER").as_ref().map(String::as_str) {
        Ok("treewalk") => treewalk::main(),
        _ => bytecode::main(),
    }
}

fn report_errors(errors: Vec<errors::Error>) {
    for error in errors {
        errors::report(&error);
    }
}