(* Oukseh Lee Copyright(c) 2000-2004 KAIST/SNU Research On Program Analysis System (National Creative Research Initiative Center 1998-2003) http://ropas.snu.ac.kr/n All rights reserved. This file is distributed under the terms of an Open Source License. *) structure Lambda = struct type const = Int of int | Real of real | String of string | Char of char | Bool of bool | Unit type conid = int type exnid = string type var = int type kappa = Normal of conid | Except of exnid and data = kappa * ty and opclass = Unary | Binary and opid = string and op = opclass * opid and value = Const of const | Op of op | Data of data | Var of var and tname = int and ty = Tname of tname | Tfun of ty * ty | Ttuple of ty list | Tlam of tname * ty | Tapp of ty * ty | Trecsum of tname * tname list * ty list | Tconst of tyconst | Tbullet | Tarray of ty | Tref of ty and tyconst = Tint | Treal | Tstring | Tchar | Tbool | Tunit type expr = Value of value | Fun of var * ty * expr | App of value list | Tyfun of tname * expr | Tyapp of value * ty | Let of (var * ty * expr) list * expr | Letrec of (var * ty * expr) list * expr | Case of value * match | Raise of value | Handle of expr * match | Tuple of value array | Pi of int * value | Seq of expr list | Array of value array | Sub of value * value | Ref of value | Bang of value | Assign of value * value | For of var * value * expr * expr * expr and match = (pat * expr) list and pat = Pconst of const | Pvar of var | Pdata of data | Pdataarg of data * var val var_counter = ref 0 fun new_var() = let val i = !var_counter in var_counter++; i end end