brooks_lib/mel/interpreter/mod.rs
1// brooks, Copyright 2026, Will Hawkins
2//
3// This file is part of brooks.
4
5// This file is free software: you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program. If not, see <https://www.gnu.org/licenses/>.
17
18//! MEL interpreter
19
20pub mod builtins;
21pub mod error;
22pub mod interpret;
23pub mod values;
24
25#[cfg(test)]
26pub mod tests;
27
28use crate::mel::{
29 analysis::Analyzed,
30 ast::{AstVisitorDriver, Expr},
31 interpreter::interpret::{MelInterp, MelInterpContext, MelInterpResult},
32};
33
34/// Interpret analyzed MEL expression
35pub fn interpret(expr: &Expr<Analyzed>, context: MelInterpContext) -> MelInterpResult {
36 let driver = AstVisitorDriver {};
37 let visitor = MelInterp {};
38
39 driver.visit(expr, &visitor, context)
40}