#[derive(Debug, Clone)] pub enum Token { Negation, Conjunction, Disjunction, ExclusiveDisjunction, MaterialCondition, LogicalEquivalence } #[derive(Debug, Clone)] pub enum Node { Leaf(T), Unary { operator: Token, operand: Box> }, Binary { operator: Token, lhs: Box>, rhs: Box>, }, } pub fn add_unary_node(stack: &mut Vec>, token: Token) { let operand = Box::new(stack.pop().unwrap()); stack.push(Node::Unary { operator: token, operand, }); } pub fn add_binary_node(stack: &mut Vec>, token: Token) { let lhs = Box::new(stack.pop().unwrap()); let rhs = Box::new(stack.pop().unwrap()); stack.push(Node::Binary { operator: token, lhs, rhs }); }