(* Aufgabe IV.2 *)

type id = string

datatype dec =                  (* d ::= *)
    ValDec of id * exp             (* val x = a *)
  | FunDec of id * id * exp        (* fun x1 x2 = a *)
and exp =                       (* a ::= *)
    ConstExp of const              (* c *)
  | VarExp of id                   (* x *)
  | IfExp of exp * exp * exp       (* if a1 then a2 else a3 *)
  | AppExp of exp * exp            (* a1 a2 *)
  | FnExp of id * exp              (* fn x => a *)
  | LetExp of dec * exp            (* let d in a end *)
and const =                     (* c ::= *)
    IntConst of int                (* 0 | 1 | ~1 | 2 | ~2 | ... *)
  | BoolConst of bool              (* true | false *)

type program = dec list