(* ** Course: Concepts of Programming Languages (BU CAS CS 320) ** Semester: Summer I, 2009 ** Instructor: Hongwei Xi (hwxi AT cs DOT bu DOT edu) *) // // Author: Hongwei Xi (hwxi AT cs DOT bu DOT edu) // Time: June, 2009 // (* ****** ****** *) // // An interpreter for STFPL (a simple typed functional programming language) // The code was originally written by Hongwei Xi in May 2005 // (* ****** ****** *) local staload TR1 = "trans1_tc.sats" (* staload TR1 = "trans1_ti.sats" *) in typedef v1ar = $TR1.v1ar typedef v1arlst = $TR1.v1arlst typedef e1xp = $TR1.e1xp end (* ****** ****** *) datatype v1al = | V1ALbool of bool | V1ALint of int | V1ALstr of string | V1ALtup of list0 v1al | V1ALclo of (env, v1arlst, e1xp) | V1ALref of ref (v1al) where env = list0 @(v1ar, v1al) (* ****** ****** *) fun fprint_v1al (out: FILEref, v: v1al): void fun fprint_v1allst (out: FILEref, vs: list0 v1al): void fun print_v1al (v: v1al): void and prerr_v1al (v: v1al): void (* ****** ****** *) fun interp1_exp (e: e1xp): v1al (* ****** ****** *) (* end of [interp1.sats] *)