use std::rc::Rc; use std::fmt::Debug; use crate::ast::types::{Identity, Value}; /// A generic AST Node wrapper to preserve identity and metadata #[derive(Debug, Clone)] pub struct Node { pub identity: Identity, pub kind: K, pub ty: T, } /// The base for custom node types (extensions) pub trait CustomNode: Debug { fn display_name(&self) -> &'static str; } #[derive(Debug)] pub enum UntypedKind { Nop, Constant(Value), Identifier(Rc), If { cond: Box>, then_br: Box>, else_br: Option>>, }, Def { name: Rc, value: Box>, }, Assign { target: Box>, value: Box>, }, Lambda { params: Vec>, body: Rc>, }, Call { callee: Box>, args: Vec>, }, Block { exprs: Vec>, }, Tuple { elements: Vec>, }, Map { entries: Vec<(Node, Node)>, }, Extension(Box), }