Skip to main content

cl_interpret/
lib.rs

1//! Walks a Conlang AST, interpreting it as a program.
2#![warn(clippy::all)]
3#![feature(decl_macro, rev_into_inner, string_into_chars)]
4#![expect(unused, reason = "Work in progress")]
5
6use cl_ast::types::Symbol as Sym;
7use convalue::ConValue;
8use env::Environment;
9use error::{Error, ErrorKind, IResult};
10use interpret::Interpret;
11
12/// Callable types can be called from within a Conlang program
13pub trait Callable {
14    /// Calls this [Callable] in the provided [Environment], with [ConValue] args  \
15    /// The Callable is responsible for checking the argument count and validating types
16    fn call(&self, interpreter: &mut Environment, args: &[ConValue]) -> IResult<ConValue>;
17    /// Returns the common name of this callable, if it has one.
18    fn name(&self) -> Option<Sym>;
19}
20
21pub mod typeinfo;
22
23pub mod place;
24
25pub mod convalue;
26
27pub mod interpret;
28
29pub mod function;
30
31pub mod builtin;
32
33pub mod env;
34
35pub mod error;
36
37#[cfg(test)]
38mod tests;