Absyn

    (* MLPolyR Abstract Syntax (AST with type information) *)
    datatype exp =
        LETexp of (def * Types.depth) list * exp
      | IFexp of exp * exp * exp * typ
      | LCASEexp of exp * exp * pat * pat * exp * typ
      | WHEREexp of exp * typ * exp field list * typ
      | BINOPexp of binop * exp * exp * typ
      | UOPexp of uop * exp * typ
      | APPexp of exp * exp * typ
      | ASSIGNexp of exp * typ * RecordLabel.label * exp
      | SELexp of exp * typ * RecordLabel.label * typ
      | FETCHexp of exp * typ * RecordLabel.label * typ
      | BOOLexp of bool
      | NUMBERexp of integer
      | STRINGexp of string
      | UNITexp
      | VARexp of symbol * typ * Types.pri (* after generalization *)
      | SEQexp of exp * exp
      | LISTexp of exp list * typ
      | RECORDexp of exp field list * (exp * typ * exp field list) option * typ
      | CONexp of exp field * typ
      | SWIDENexp of exp * typ * RecordLabel.label * typ
      | MCASEexp of exp * exp * typ
      | FNexp of pat * exp * typ
      | MARKexp of exp * region

    and def =
	VALdef of pat * Symbol.Set.set * exp
      | FUNdef of function list * Types.pri (* before generalization *)

    and pat' =
	WILDpat
      | VARpat of symbol
      | RECORDpat of pat field list * pat option * Types.pri
      | ANDpat of pat' * pat'
      | MARKpat of pat' * region

    and function = { f: symbol * typ, params: pat list, body: exp }

    and rule = pat field * exp

    type program = exp