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:
parent
eccc00ff81
commit
ea211fc3b0
|
@ -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: {:?} = `{:?}`",
|
||||||
|
|
Loading…
Reference in a new issue