feat(tvix/eval): Expose interpret + related types from lib
Add a new `lib.rs` to tvix/eval, which `pub use`s the `interpret` function, and all types mentioned in its return type, and then uses *this* instead of direct `mod` statements in the `main.rs` to implement the entrypoints to the interpreter. This is in preparation for calling these functions from integrated benchmarking infrastructure using Criterion, though other things (like integration tests) might want to do that as well. Change-Id: I7b585134a96b1c56a2ac64d2036b0e51d321bd27 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6155 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI Autosubmit: grfn <grfn@gws.fyi>
This commit is contained in:
parent
63a0cc83d1
commit
f648cec78e
2 changed files with 15 additions and 12 deletions
14
tvix/eval/src/lib.rs
Normal file
14
tvix/eval/src/lib.rs
Normal file
|
@ -0,0 +1,14 @@
|
|||
mod chunk;
|
||||
mod compiler;
|
||||
mod errors;
|
||||
mod eval;
|
||||
mod opcode;
|
||||
mod value;
|
||||
mod vm;
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
||||
pub use crate::errors::EvalResult;
|
||||
pub use crate::eval::interpret;
|
||||
pub use crate::value::Value;
|
|
@ -4,17 +4,6 @@ use std::{
|
|||
mem, process,
|
||||
};
|
||||
|
||||
mod chunk;
|
||||
mod compiler;
|
||||
mod errors;
|
||||
mod eval;
|
||||
mod opcode;
|
||||
mod value;
|
||||
mod vm;
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
||||
fn main() {
|
||||
let mut args = env::args();
|
||||
if args.len() > 2 {
|
||||
|
@ -50,7 +39,7 @@ fn run_prompt() {
|
|||
}
|
||||
|
||||
fn run(code: String) {
|
||||
match eval::interpret(&code) {
|
||||
match tvix_eval::interpret(&code) {
|
||||
Ok(result) => println!("=> {} :: {}", result, result.type_of()),
|
||||
Err(err) => eprintln!("{}", err),
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue