about summary refs log tree commit diff
path: root/tvix/eval/src/eval.rs
blob: 5e6c53cd8bf5a746ed945d322095bfae98e58d97 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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!()
    }

    println!("{}", ast.root().dump());

    let code = crate::compiler::compile(ast)?;
    println!("code: {:?}", code);

    crate::vm::run_chunk(code)
}