mini_lang/eval/
mod.rs

1mod eager;
2mod lazy;
3mod namespace;
4mod operation;
5
6pub use eager::EagerEval;
7pub use lazy::LazyEval;
8
9use namespace::NameSpace;
10use operation::operation;
11
12use crate::ir::Program;
13use crate::Printer;
14
15/// The trait to provide kinds of evaluation (or compilation).
16pub trait Evaluator {
17    /// The error type that evaluator will provide.
18    type Err: std::error::Error + 'static;
19    /// Evaluate `Program` and print expression by `printer`.
20    fn evaluate<P: Printer>(&self, ir: Program, printer: &mut P) -> Result<(), Self::Err>;
21}