spl/src/main.rs

20 lines
475 B
Rust
Raw Normal View History

2023-02-18 01:53:48 +01:00
use spl::{lexer::lex, runtime::*};
2023-02-17 22:47:45 +01:00
use std::fs;
2023-02-17 20:00:39 +01:00
2023-02-19 02:03:06 +01:00
fn main() -> OError {
2023-02-17 22:47:45 +01:00
let rt = Runtime::new();
2023-02-17 20:00:39 +01:00
rt.set();
2023-02-19 04:57:32 +01:00
let mut stack = Stack::new_in(FrameInfo {
file: "std.spl".to_owned(),
function: "root".to_owned(),
});
let words = lex(fs::read_to_string("std.spl").unwrap()).map_err(|x| Error {
2023-02-19 02:03:06 +01:00
kind: ErrorKind::LexError(format!("{x:?}")),
stack: Vec::new(),
})?;
words.exec(&mut stack)?;
2023-02-17 20:00:39 +01:00
Runtime::reset();
2023-02-19 02:03:06 +01:00
Ok(())
2023-02-17 20:00:39 +01:00
}