24 |
(* end case *)) |
(* end case *)) |
25 |
|
|
26 |
(* expression translation *) |
(* expression translation *) |
27 |
fun cvtExpr (env, exp) = (case exp |
fun cvtExpr (env, lhs, exp) = (case exp |
28 |
of S.E_Var x => IL.VAR(lookup env x) |
of S.E_Var x => [(lhs, IL.VAR(lookup env x))] |
29 |
| S.E_Lit lit => IL.LIT lit |
| S.E_Lit lit => [(lhs, IL.LIT lit)] |
30 |
| S.E_Tuple xs => raise Fail "E_Tuple not implemeted" |
| S.E_Tuple xs => raise Fail "E_Tuple not implemeted" |
31 |
| S.E_Apply(f, tyArgs, args, ty) => |
| S.E_Apply(f, tyArgs, args, ty) => let |
32 |
| S.E_Cons args => IL.CONS(List.map (lookup env) args) |
val args' = List.map (lookup env) args |
33 |
|
in |
34 |
|
TranslateBasis.translate (lhs, f, tyArgs, args') |
35 |
|
end |
36 |
|
| S.E_Cons args => [(lhs, IL.CONS(List.map (lookup env) args))] |
37 |
(* end case *)) |
(* end case *)) |
38 |
|
|
39 |
and cvtStmt (env, stm) = (case stm |
and cvtStmt (env, stm) = (case stm |