From ea211fc3b093b12d44a18974c88fdf7d4e8676af Mon Sep 17 00:00:00 2001 From: Alexander Bethel Date: Thu, 20 May 2021 18:24:18 -0500 Subject: [PATCH] Make `ablescript -f` run interpreter `ablescript -f foo.able` will now both parse and interpret `foo.able`, rather than just parsing it. --- src/main.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 05782302..94626c8b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -10,6 +10,7 @@ mod repl; mod variables; use clap::{App, Arg}; +use interpret::Scope; use logos::Source; use parser::Parser; @@ -38,7 +39,11 @@ fn main() { let mut parser = Parser::new(&source); let ast = parser.init(); match ast { - Ok(ast) => println!("{:#?}", ast), + Ok(ast) => { + println!("{:#?}", ast); + let mut ctx = Scope::new(); + println!("{:?}", ctx.eval_items(&ast)); + } Err(e) => { println!( "Error `{:?}` occured at span: {:?} = `{:?}`",