SCM Repository
Annotation of /trunk/src/compiler/translate/translate.sml
Parent Directory
|
Revision Log
Revision 168 - (view) (download)
1 : | jhr | 137 | (* translate.sml |
2 : | * | ||
3 : | * COPYRIGHT (c) 2010 The Diderot Project (http://diderot.cs.uchicago.edu) | ||
4 : | * All rights reserved. | ||
5 : | * | ||
6 : | * Translate AST code into the IL representation. | ||
7 : | *) | ||
8 : | |||
9 : | structure Translate : sig | ||
10 : | |||
11 : | val translate : AST.program -> ?? | ||
12 : | |||
13 : | end = struct | ||
14 : | |||
15 : | structure VMap = Var.Map | ||
16 : | jhr | 168 | structure IL = HighIL |
17 : | jhr | 137 | |
18 : | jhr | 168 | (* expression translation *) |
19 : | fun cvtExpr (env, exp, kont) = let | ||
20 : | fun cvt e = (case e | ||
21 : | of AST.E_Var(x, tyArgs, ty) => | ||
22 : | | AST.E_Lit lit => | ||
23 : | | AST.E_Tuple es => | ||
24 : | | AST.E_Apply(f, tyArgs, args, ty) => | ||
25 : | | AST.E_Cons of expr list | ||
26 : | | AST.E_Cond(e1, e2, e3) => | ||
27 : | (* end case *)) | ||
28 : | in | ||
29 : | end | ||
30 : | |||
31 : | and cvtStmt (env, stm) = (case stm | ||
32 : | of AST.S_Block of stmt list | ||
33 : | | AST.S_Decl of var_decl | ||
34 : | | AST.S_IfThenElse of expr * stmt * stmt | ||
35 : | | AST.S_Assign of var * expr | ||
36 : | | AST.S_New of Atom.atom * expr list | ||
37 : | | AST.S_Die | ||
38 : | | AST.S_Stabilize | ||
39 : | (* end case *)) | ||
40 : | |||
41 : | jhr | 137 | end |
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |