aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
authorEdvard Thörnros <edvard.thornros@gmail.com>2021-01-10 16:15:52 +0100
committerEdvard Thörnros <edvard.thornros@gmail.com>2021-01-10 16:15:52 +0100
commitd61370656d9f3deb39bb37f9c1d45e8ddc62efd5 (patch)
tree9fa83578abc1e18c4415c97bbfce10886bbc2daa /src/main.rs
parent64576ba8f08990dc8bc94ef1bec4dd502d5cef06 (diff)
downloadsylt-d61370656d9f3deb39bb37f9c1d45e8ddc62efd5.tar.gz
More errors!
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs
index ed85961..bcda641 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,9 +1,12 @@
use std::path::{Path, PathBuf};
+mod error;
mod tokenizer;
mod vm;
mod compiler;
+use error::Error;
+
fn main() {
let file = file_from_args().unwrap_or_else(|| Path::new("tests/simple.tdy").to_owned());
if let Err(err) = run_file(&file) {
@@ -15,7 +18,7 @@ fn file_from_args() -> Option<PathBuf> {
std::env::args().skip(1).map(|s| Path::new(&s).to_owned()).find(|p| p.is_file())
}
-fn run_file(path: &Path) -> Result<(), vm::Error> {
+fn run_file(path: &Path) -> Result<(), Error> {
let tokens = tokenizer::file_to_tokens(path);
let block = compiler::compile("main", path, tokens); // path -> str might fail
vm::run_block(block)