1pub mod bytecode;
9pub mod carry;
10pub mod compiled_block;
11pub mod context;
12pub mod error;
13pub mod evaluator;
14pub mod math_functions;
15
16pub use bytecode::{CompileError as BytecodeCompileError, CompiledBytecode};
17pub use carry::{PerPointParallelism, analyse_per_point};
18pub use compiled_block::CompiledBlock;
19pub use context::{MilkContext, Q_CHANNEL_NAMES_32};
20pub use error::{EvalError, Result};
21pub use evaluator::{MilkEvaluator, ShapeInstance, WavePoint};
22pub use math_functions::{list_math_functions, register_math_functions};
23
24pub use evalexpr::Node;
28
29pub fn eval_simple(expression: &str) -> Result<f64> {
40 let mut evaluator = MilkEvaluator::new();
41 evaluator.eval(expression)
42}
43
44#[cfg(test)]
45mod tests {
46 use super::*;
47
48 #[test]
49 fn test_eval_simple() {
50 let result = eval_simple("10 * 5").unwrap();
51 assert_eq!(result, 50.0);
52 }
53
54 #[test]
55 fn test_eval_with_math() {
56 let result = eval_simple("sin(0) + cos(0)").unwrap();
57 assert!((result - 1.0).abs() < 1e-10);
58 }
59}