Make ablescript -f run interpreter

`ablescript -f foo.able` will now both parse and interpret `foo.able`,
rather than just parsing it.
This commit is contained in:
Alexander Bethel 2021-05-20 18:24:18 -05:00
parent e31b8fb00d
commit 464337bd53

View file

@ -10,6 +10,7 @@ mod repl;
mod variables; mod variables;
use clap::{App, Arg}; use clap::{App, Arg};
use interpret::Scope;
use logos::Source; use logos::Source;
use parser::Parser; use parser::Parser;
@ -38,7 +39,11 @@ fn main() {
let mut parser = Parser::new(&source); let mut parser = Parser::new(&source);
let ast = parser.init(); let ast = parser.init();
match ast { match ast {
Ok(ast) => println!("{:#?}", ast), Ok(ast) => {
println!("{:#?}", ast);
let mut ctx = Scope::new();
println!("{:?}", ctx.eval_items(&ast));
}
Err(e) => { Err(e) => {
println!( println!(
"Error `{:?}` occured at span: {:?} = `{:?}`", "Error `{:?}` occured at span: {:?} = `{:?}`",