type ast = Value of String | Add of ast * ast | Sub of ast * ast | Mult of ast * ast | Div of ast * ast;;let rec evaluator tree = match tree withlet rec lookup v env = match env with (x,y)::xs -> if x = v then y else lookup v xs |[] -> raise ("undef var")let rec eval env t = match t with |Value(s) -> int_of_string s (* convert to int *) |Var(s) -> lookup s env |Let(s, e1, e2) -> let v1 = eval env e1 in let v2 = eval ((s, v1)::env) e2 in v2 |Add(t1, t2) -> (evaluator t1) + (evaluator t2) |Sub(t1, t2) -> (evaluator t1) - (evalulator t2) |Div(t1, t2) -> (evaluator t1) / (evaluator t2) |Mult(t1, t2) -> (evaluator t1) * (evaluator t2) |_ -> failwith "error lil bro your code sucks 💀 how tf you manage to misconstruct an AST lil bro we literally have a parser function 💀"