handball/src/ast.rs

24 lines
425 B
Rust

use std::rc::Rc;
#[derive(Debug, debug2::Debug, PartialEq)]
crate enum Tree {
Leaf(Literal),
Define(String, Box<Tree>),
If(Box<[Tree; 3]>),
Lambda(Lambda),
Branch(Vec<Tree>),
}
#[derive(Debug, debug2::Debug, PartialEq, Clone)]
crate struct Lambda(crate Rc<[String]>, crate Rc<[Tree]>);
#[derive(Debug, debug2::Debug, PartialEq)]
crate enum Literal {
Sym(String),
Num(f64),
Bool(bool),
}