From 464337bd53c1e9709e80bb433fdd3d60ee53549d 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 0578230..94626c8 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: {:?} = `{:?}`",