(* translate.sml * * COPYRIGHT (c) 2010 The Diderot Project (http://diderot.cs.uchicago.edu) * All rights reserved. * * Translate Simple-AST code into the IL representation. *) structure Translate : sig val translate : Simple.program -> HighIL.program end = struct structure S = Simple structure VMap = Var.Map structure IL = HighIL fun lookup env x = (case VMap.find x of SOME x' => x' | NONE => raise Fail(concat[ "no binding for ", Var.toString x, " in environment" ]) (* end case *)) (* expression translation *) fun cvtExpr (env, lhs, exp) = (case exp of S.E_Var x => [(lhs, IL.VAR(lookup env x))] | S.E_Lit lit => [(lhs, IL.LIT lit)] | S.E_Tuple xs => raise Fail "E_Tuple not implemeted" | S.E_Apply(f, tyArgs, args, ty) => let val args' = List.map (lookup env) args in TranslateBasis.translate (lhs, f, tyArgs, args') end | S.E_Cons args => [(lhs, IL.CONS(List.map (lookup env) args))] (* end case *)) and cvtStmt (env, stm) = (case stm of S.S_Block stms => | S.S_Assign(x, e) => | S.S_IfThenElse(x, s1, s2) => | S.S_New(name, xs) => | S.S_Die => | S.S_Stabilize => (* end case *)) fun translate (S.Program{globals, globaInit, actors}) = ?? end
Click to toggle
does not end with </html> tag
does not end with </body> tag
The output has ended thus: abilize => (* end case *)) fun translate (S.Program{globals, globaInit, actors}) = ?? end