Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /trunk/src/compiler/simplify/simplify.sml
ViewVC logotype

Diff of /trunk/src/compiler/simplify/simplify.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 510, Tue Feb 8 16:12:38 2011 UTC revision 511, Tue Feb 8 17:01:43 2011 UTC
# Line 27  Line 27 
27      fun simplifyProgram (AST.Program dcls) = let      fun simplifyProgram (AST.Program dcls) = let
28            val globals = ref []            val globals = ref []
29            val globalInit = ref []            val globalInit = ref []
30            val actors = ref []            val strands = ref []
31            fun simplifyDecl dcl = (case dcl            fun simplifyDecl dcl = (case dcl
32                   of AST.D_Input(x, NONE) => let                   of AST.D_Input(x, NONE) => let
33                        val e' = S.E_Input(Var.monoTypeOf x, Var.nameOf x, NONE)                        val e' = S.E_Input(Var.monoTypeOf x, Var.nameOf x, NONE)
# Line 48  Line 48 
48                          globals := x :: !globals;                          globals := x :: !globals;
49                          globalInit := S.S_Assign(x, e') :: (stms @ !globalInit)                          globalInit := S.S_Assign(x, e') :: (stms @ !globalInit)
50                        end                        end
51                    | AST.D_Actor info => actors := simplifyActor info :: !actors                    | AST.D_Strand info => strands := simplifyStrand info :: !strands
52                    | AST.D_InitialArray(e, iters) => () (* FIXME *)                    | AST.D_InitialArray(e, iters) => () (* FIXME *)
53                    | AST.D_InitialCollection(e, iters) => () (* FIXME *)                    | AST.D_InitialCollection(e, iters) => () (* FIXME *)
54                  (* end case *))                  (* end case *))
# Line 57  Line 57 
57              S.Program{              S.Program{
58                  globals = List.rev(!globals),                  globals = List.rev(!globals),
59                  globalInit = mkBlock (!globalInit),                  globalInit = mkBlock (!globalInit),
60                  actors = List.rev(!actors)                  strands = List.rev(!strands)
61                }                }
62            end            end
63    
64      and simplifyActor {name, params, state, methods} = let      and simplifyStrand {name, params, state, methods} = let
65            fun simplifyState ([], xs, stms) = (List.rev xs, mkBlock stms)            fun simplifyState ([], xs, stms) = (List.rev xs, mkBlock stms)
66              | simplifyState (AST.VD_Decl(x, e) :: r, xs, stms) = let              | simplifyState (AST.VD_Decl(x, e) :: r, xs, stms) = let
67                  val (stms, e') = simplifyExp (e, stms)                  val (stms, e') = simplifyExp (e, stms)
# Line 70  Line 70 
70                  end                  end
71            val (xs, stm) = simplifyState (state, [], [])            val (xs, stm) = simplifyState (state, [], [])
72            in            in
73              S.Actor{              S.Strand{
74                  name = name,                  name = name,
75                  params = params,                  params = params,
76                  state = xs, stateInit = stm,                  state = xs, stateInit = stm,

Legend:
Removed from v.510  
changed lines
  Added in v.511

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0