Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /sml/trunk/src/compiler/TopLevel/bootstrap/boot.sml
ViewVC logotype

Diff of /sml/trunk/src/compiler/TopLevel/bootstrap/boot.sml

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

revision 44, Sun Mar 22 20:10:57 1998 UTC revision 45, Sun Mar 22 20:11:09 1998 UTC
# Line 12  Line 12 
12    
13  local  local
14    structure SS = Substring    structure SS = Substring
15    structure Compile = VC.Compile    structure C  = VC.Compile
16      structure BU = VC.BatchUtil
17    structure SE = StaticEnv    structure SE = StaticEnv
18    structure SC = SCStaticEnv    structure SC = SCStaticEnv
19    open ErrorMsg Modules ModuleUtil    open ErrorMsg Modules ModuleUtil
# Line 33  Line 34 
34    infix //    infix //
35    val op // = SC.atop    val op // = SC.atop
36    
37    fun load (env,fname) : loadres =    fun loadcomp (env,fname) : loadres =
38        let val _ = say (concat ["[Elaborating ", fname, "]\n"])        let val _ = say (concat ["[Elaborating ", fname, "]\n"])
39            val stream = TextIO.openIn fname            val stream = TextIO.openIn fname
40            val source = Source.newSource (            val source = Source.newSource (
41                  fname, 1, stream, false, ErrorMsg.defaultConsumer ())                  fname, 1, stream, false, ErrorMsg.defaultConsumer ())
42            val ast = Compile.parse source            val ast = C.parse source
43            val compInfo =            val cinfo = C.mkCompInfo(source, #get EnvRef.core (), fn x=>x)
44                 Compile.mkCompInfo(source, #get EnvRef.core (), fn x=>x)            val {absyn, newstatenv=newenv, exportPid, ...} =
45            val {absyn, newenv, exportPid, ...} =                 C.elaborate{statenv=env, compInfo = cinfo, ast=ast}
46                 Compile.elaborate{compenv=env, compInfo = compInfo, ast=ast}  
47              (* ZHONG commented this out, because why bother ?
48    
49            val showenv = StaticEnv.atop(SC.unSC newenv, SC.unSC env)            val showenv = StaticEnv.atop(SC.unSC newenv, SC.unSC env)
50            fun show (Absyn.SEQdec decs) = app show decs            fun show (Absyn.SEQdec decs) = app show decs
51              | show (Absyn.MARKdec (d,_)) = show d              | show (Absyn.MARKdec (d,_)) = show d
# Line 53  Line 56 
56                                   dynamic = DynamicEnv.empty,                                   dynamic = DynamicEnv.empty,
57                                   symbolic = SymbolicEnv.empty}                                   symbolic = SymbolicEnv.empty}
58                        ppstrm (absyn,[]))                        ppstrm (absyn,[]))
59         in show absyn handle _ => say "ppDec raised exception\n";             *)
60           in (* show absyn handle _ => say "ppDec raised exception\n"; *)
61            TextIO.closeIn stream;            TextIO.closeIn stream;
62            {scsenv = newenv, exportPid = exportPid}            {scsenv = newenv, exportPid = exportPid}
63        end        end
# Line 81  Line 85 
85    
86    (* some standard pathnames (in OS independent syntax) *)    (* some standard pathnames (in OS independent syntax) *)
87    local    local
88      fun bootFile f = OS.Path.joinDirFile { dir = "0-Boot", file = f }      fun bootFile f = OS.Path.joinDirFile { dir = "Basis", file = f }
89    in    in
90      val assembly_sig = bootFile "assembly.sig"      val assembly_sig = bootFile "assembly.sig"
91      val dummy_sml = bootFile "dummy.sml"      val dummy_sml = bootFile "dummy.sml"
# Line 143  Line 147 
147        end        end
148    
149    (* elabCompiler accumulates compiler environment atop the pervasive env *)    (* elabCompiler accumulates compiler environment atop the pervasive env *)
150    fun elabCompiler (pervEnv, bindir) =    fun elabCompiler (load, pervEnv, bindir) =
151        let val srclist = readBinFile(bindir, "SRCLIST")        let val srclist = readBinFile(bindir, "SRCLIST")
152            (* don't elaborate the last file! it's the glue that hasn't            (* don't elaborate the last file! it's the glue that hasn't
153             * finished executing.             * finished executing.
# Line 164  Line 168 
168                      flush ();                      flush ();
169                      raise ex)                      raise ex)
170    
171    val bindir = ref ("bin." ^ Compile.architecture)    val bindir = ref ("bin." ^ VC.architecture)
172    val full = ref false    val full = ref false
173    
174    val _ =    val _ =
# Line 203  Line 207 
207                    say (concat ["Loading static bin for ", sourcename, "\n"])                    say (concat ["Loading static bin for ", sourcename, "\n"])
208                  val f = BinIO.openIn (tnamer sourcename)                  val f = BinIO.openIn (tnamer sourcename)
209    
210                  val cu = VC.CUnitUtil.readUnit { name=tnamer sourcename,                  val cu = BU.readUnit { name=tnamer sourcename,
211                                                   stream = f,                                                   stream = f,
212                                                   pids2iid = fn _ => (),                                                   pids2iid = fn _ => (),
213                                                   senv = env0,                                                   senv = env0,
214                                                   keep_code = false }                                                   keep_code = false }
215                  val exportPid = VC.CUnitUtil.exportCU cu                  val exportPid = BU.exportCU cu
216                  val senv = VC.CUnitUtil.senvCU cu                  val senv = BU.senvCU cu
217                  val symenv = VC.CUnitUtil.symenvCU cu                  val symenv = BU.symenvCU cu
218    
219               in theSymEnv := SymbolicEnv.atop (symenv, !theSymEnv);               in theSymEnv := SymbolicEnv.atop (symenv, !theSymEnv);
220                  BinIO.closeIn f;                  BinIO.closeIn f;
# Line 218  Line 222 
222              end              end
223    
224            fun getVisComp env0 =            fun getVisComp env0 =
225                let val srcname = Compile.architecture ^ "vis.sml"                let val srcname = VC.architecture ^ "vis.sml"
226                    val files = readBinFile(!bindir, "SRCLIST")                    val files = readBinFile(!bindir, "SRCLIST")
227                    fun f (env, fname :: rest) =                    fun f (env, fname :: rest) =
228                        let val {scsenv, ...} = getbin(env,fname)                        let val {scsenv, ...} = getbin(env,fname)
# Line 236  Line 240 
240                    let val _ = say "\nNow elaborating boot directory\n"                    let val _ = say "\nNow elaborating boot directory\n"
241                        val savedOverloadKW = !VC.Control.overloadKW                        val savedOverloadKW = !VC.Control.overloadKW
242                        val _ = VC.Control.overloadKW := true                        val _ = VC.Control.overloadKW := true
243                        val (pSE, pids) = newBootEnv (load, !bindir)                        val (pSE, pids) = newBootEnv (loadcomp, !bindir)
244                        val (vSE, morepids) = elabCompiler (pSE, !bindir)                        val (vSE, morepids) =
245                            elabCompiler (loadcomp, pSE, !bindir)
246                     in VC.Control.overloadKW := savedOverloadKW;                     in VC.Control.overloadKW := savedOverloadKW;
247                        ((pSE, pids @ morepids), vSE)                        ((pSE, pids @ morepids), vSE)
248                    end                    end
# Line 250  Line 255 
255            val pervStatEnv = SE.consolidate(SC.unSC pervStatEnv)            val pervStatEnv = SE.consolidate(SC.unSC pervStatEnv)
256            val visCompEnv = SE.consolidate(SC.unSC visCompEnv)            val visCompEnv = SE.consolidate(SC.unSC visCompEnv)
257    
258            val vcSym = Symbol.strSymbol (sname (Compile.architecture) ^ "VisComp")            val vcSym = Symbol.strSymbol (sname (VC.architecture) ^ "VisComp")
259            val vcBind as Bindings.STRbind(vcStr) =            val vcBind as Bindings.STRbind(vcStr) =
260                  SE.look(visCompEnv, vcSym)                  SE.look(visCompEnv, vcSym)
261    

Legend:
Removed from v.44  
changed lines
  Added in v.45

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