blob: a12add48b55201302a2603c2cc8138c4f44b8abf (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
use rnix::{self, types::TypedNode};
use crate::{errors::EvalResult, value::Value};
pub fn interpret(code: &str) -> EvalResult<Value> {
let ast = rnix::parse(code);
let errors = ast.errors();
if !errors.is_empty() {
todo!()
}
if let Ok(_) = std::env::var("TVIX_DISPLAY_AST") {
println!("{}", ast.root().dump());
}
let code = crate::compiler::compile(ast)?;
println!("code: {:?}", code);
crate::vm::run_chunk(code)
}
|