use crate::{symbol::Symbol, val::Val}; #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub enum Ident { /// `x` Local(Symbol), /// `^x` Return(Symbol), } #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] pub enum BinOp { Add, Sub, Mul, Div, Mod, Pow, Eq, Lt, Le, } // TODO: great display repr for this for testing (yes it's allowed) #[derive(Debug, Clone)] pub enum Ast { /// `x`, `^x` Var(Ident), /// `x := y; #=> y` Set(Ident, Box), /// `fn ([a b] [c d]) ( ... )` Fn { inputs: Vec, outputs: Vec, body: Vec, }, /// `{^x; ^y := z}` Map(Vec), /// `f x` App(Box, Box), /// `x + y` (only builtins, sorry) BinOp(Box, BinOp, Box), /// `3` Num(f64), /// `(println bla; 3) #=> 3` Block(Vec), }