SCM Repository
Annotation of /sml/trunk/src/cm/Patch-compiler-110.17
Parent Directory
|
Revision Log
Revision 344 - (view) (download)
1 : | blume | 344 | Attached below you'll find a context diff to patch the compiler |
2 : | sources and one line in one file of the current (= old) CM sources. | ||
3 : | These changes should be completely benign -- I made them to accomodate | ||
4 : | my new implementation of CM. (I just want to get the changes in now | ||
5 : | so I don't have to carry them through all the time.) | ||
6 : | |||
7 : | These changes include: | ||
8 : | |||
9 : | 1. Slightly extended functionality of the ErrorMsg module. | ||
10 : | 2. Parsing moved out of the Binfile module and made into a new | ||
11 : | "Smlfile" module. This is to have parsing be outside the | ||
12 : | machine-dependent part of the compiler (so I don't have to | ||
13 : | functorize the corresponding parts of CM). | ||
14 : | |||
15 : | Apply the context diff that I include below sitting in the "src" | ||
16 : | directory: | ||
17 : | |||
18 : | patch -p1 <this-message | ||
19 : | |||
20 : | There is also a brand-new file: | ||
21 : | |||
22 : | src/compiler/TopLevel/batch/smlfile.sml | ||
23 : | |||
24 : | I put the contents below (before the context diff). | ||
25 : | |||
26 : | --------- CONTENTS of src/compiler/TopLevel/batch/smlfile.sml -------- | ||
27 : | (* COPYRIGHT (c) 1999 Bell Labs, Lucent Technologies *) | ||
28 : | (* smlfile.sml *) | ||
29 : | signature SMLFILE = sig | ||
30 : | exception Compile of string | ||
31 : | val parseOne : Source.inputSource -> unit -> Ast.dec option | ||
32 : | val parse : Source.inputSource -> Ast.dec | ||
33 : | end | ||
34 : | |||
35 : | structure SmlFile :> SMLFILE = struct | ||
36 : | |||
37 : | exception Compile of string | ||
38 : | |||
39 : | structure FE = FrontEnd | ||
40 : | |||
41 : | val parsePhase = Stats.makePhase "Compiler 010 parse" | ||
42 : | |||
43 : | fun fail s = raise (Compile s) | ||
44 : | |||
45 : | fun parseOne source = let | ||
46 : | val parser = FE.parse source | ||
47 : | val parser = Stats.doPhase parsePhase parser (* for correct timing *) | ||
48 : | fun doit () = | ||
49 : | case parser () of | ||
50 : | FE.EOF => NONE | ||
51 : | | FE.ABORT => fail "syntax error" | ||
52 : | | FE.ERROR => fail "syntax error" | ||
53 : | | FE.PARSE ast => SOME ast | ||
54 : | in | ||
55 : | doit | ||
56 : | end | ||
57 : | |||
58 : | fun parse source = let | ||
59 : | val parser = FE.parse source | ||
60 : | val parser = Stats.doPhase parsePhase parser (* for correct timing *) | ||
61 : | fun loop asts = | ||
62 : | case parser () of | ||
63 : | FE.EOF => Ast.SeqDec(rev asts) | ||
64 : | | FE.ABORT => fail "syntax error" | ||
65 : | | FE.ERROR => fail "syntax error" | ||
66 : | | FE.PARSE ast => loop(ast::asts) | ||
67 : | in | ||
68 : | loop nil | ||
69 : | end | ||
70 : | end | ||
71 : | --------- END of src/compiler/TopLevel/batch/smlfile.sml -------- | ||
72 : | |||
73 : | ------------------------ context diff -------------------------------- | ||
74 : | diff -c -r src.orig/cm/compile/cunit.sml src/cm/compile/cunit.sml | ||
75 : | *** src.orig/cm/compile/cunit.sml Fri Oct 16 23:02:03 1998 | ||
76 : | --- src/cm/compile/cunit.sml Thu Jun 3 16:26:23 1999 | ||
77 : | *************** | ||
78 : | *** 218,224 **** | ||
79 : | { linewidth = !Print.linewidth, | ||
80 : | flush = Print.flush, | ||
81 : | consumer = Print.say }) | ||
82 : | ! val ast = BF.parse source | ||
83 : | handle BF.Compile msg => (TextIO.closeIn s; raise Compile msg) | ||
84 : | | exn => (TextIO.closeIn s; raise exn) | ||
85 : | in | ||
86 : | --- 218,224 ---- | ||
87 : | { linewidth = !Print.linewidth, | ||
88 : | flush = Print.flush, | ||
89 : | consumer = Print.say }) | ||
90 : | ! val ast = GenericVC.SmlFile.parse source | ||
91 : | handle BF.Compile msg => (TextIO.closeIn s; raise Compile msg) | ||
92 : | | exn => (TextIO.closeIn s; raise exn) | ||
93 : | in | ||
94 : | diff -c -r src.orig/compiler/MiscUtil/util/errormsg.sig src/compiler/MiscUtil/util/errormsg.sig | ||
95 : | *** src.orig/compiler/MiscUtil/util/errormsg.sig Thu Apr 9 03:39:16 1998 | ||
96 : | --- src/compiler/MiscUtil/util/errormsg.sig Thu Jun 3 16:08:59 1999 | ||
97 : | *************** | ||
98 : | *** 14,19 **** | ||
99 : | --- 14,22 ---- | ||
100 : | val defaultConsumer : unit -> PrettyPrint.ppconsumer | ||
101 : | val nullErrorBody : PrettyPrint.ppstream -> unit | ||
102 : | val error : Source.inputSource -> SourceMap.region -> complainer | ||
103 : | + (* with a known location string but without access to the actual source: *) | ||
104 : | + val errorNoSource : | ||
105 : | + PrettyPrint.ppconsumer * bool ref -> string -> complainer | ||
106 : | val errorNoFile : PrettyPrint.ppconsumer * bool ref -> SourceMap.region | ||
107 : | -> complainer | ||
108 : | |||
109 : | diff -c -r src.orig/compiler/MiscUtil/util/errormsg.sml src/compiler/MiscUtil/util/errormsg.sml | ||
110 : | *** src.orig/compiler/MiscUtil/util/errormsg.sml Thu Apr 9 03:39:16 1998 | ||
111 : | --- src/compiler/MiscUtil/util/errormsg.sml Thu Jun 3 16:09:30 1999 | ||
112 : | *************** | ||
113 : | *** 107,112 **** | ||
114 : | --- 107,115 ---- | ||
115 : | (ppmsg(errConsumer,(location_string source (p1,p2)),severity,msg,body); | ||
116 : | record(severity,anyErrors)) | ||
117 : | |||
118 : | + fun errorNoSource (cons, anyE) locs sev msg body = | ||
119 : | + (ppmsg (cons, locs, sev, msg, body); record (sev, anyE)) | ||
120 : | + | ||
121 : | fun errorNoFile (errConsumer,anyErrors) ((p1,p2): region) severity msg body = | ||
122 : | (ppmsg(errConsumer, | ||
123 : | if p2>0 then concat[Int.toString p1, "-", Int.toString p2] | ||
124 : | diff -c -r src.orig/compiler/TopLevel/batch/binfile.sig src/compiler/TopLevel/batch/binfile.sig | ||
125 : | *** src.orig/compiler/TopLevel/batch/binfile.sig Fri Oct 16 23:03:43 1998 | ||
126 : | --- src/compiler/TopLevel/batch/binfile.sig Thu Jun 3 15:51:05 1999 | ||
127 : | *************** | ||
128 : | *** 51,58 **** | ||
129 : | -> unit | ||
130 : | |||
131 : | val exec: bfContent * denv -> env | ||
132 : | - | ||
133 : | - val parse: Source.inputSource -> Ast.dec | ||
134 : | end (* signature BINFILE *) | ||
135 : | |||
136 : | (* | ||
137 : | --- 51,56 ---- | ||
138 : | diff -c -r src.orig/compiler/TopLevel/batch/binfile.sml src/compiler/TopLevel/batch/binfile.sml | ||
139 : | *** src.orig/compiler/TopLevel/batch/binfile.sml Thu Dec 31 05:21:26 1998 | ||
140 : | --- src/compiler/TopLevel/batch/binfile.sml Thu Jun 3 15:52:41 1999 | ||
141 : | *************** | ||
142 : | *** 505,512 **** | ||
143 : | dynamic = ndenv, | ||
144 : | symbolic = symenvOf bfc } | ||
145 : | end | ||
146 : | - | ||
147 : | - val parse = C.parse | ||
148 : | end | ||
149 : | end | ||
150 : | |||
151 : | --- 505,510 ---- | ||
152 : | diff -c -r src.orig/compiler/TopLevel/main/compile.sml src/compiler/TopLevel/main/compile.sml | ||
153 : | *** src.orig/compiler/TopLevel/main/compile.sml Thu Apr 15 00:35:04 1999 | ||
154 : | --- src/compiler/TopLevel/main/compile.sml Thu Jun 3 15:57:44 1999 | ||
155 : | *************** | ||
156 : | *** 1,10 **** | ||
157 : | (* COPYRIGHT (c) 1996 Bell Laboratories *) | ||
158 : | (* compile.sml *) | ||
159 : | |||
160 : | - local | ||
161 : | - exception Compile of string | ||
162 : | - in | ||
163 : | - | ||
164 : | functor CompileF(structure M : CODEGENERATOR | ||
165 : | structure CC : CCONFIG) : COMPILE0 = | ||
166 : | struct | ||
167 : | --- 1,6 ---- | ||
168 : | *************** | ||
169 : | *** 28,34 **** | ||
170 : | fun debugmsg msg = | ||
171 : | if !debugging then (say msg; say "\n"; Control.Print.flush()) else () | ||
172 : | |||
173 : | ! exception Compile = Compile (* raised during compilation only *) | ||
174 : | exception SilentException = CC.SilentException (* raised by CM *) | ||
175 : | exception TopLevelException of exn (* raised during executation only *) | ||
176 : | exception TopLevelCallcc (* raised during executation only *) | ||
177 : | --- 24,30 ---- | ||
178 : | fun debugmsg msg = | ||
179 : | if !debugging then (say msg; say "\n"; Control.Print.flush()) else () | ||
180 : | |||
181 : | ! exception Compile = SmlFile.Compile (* raised during compilation only *) | ||
182 : | exception SilentException = CC.SilentException (* raised by CM *) | ||
183 : | exception TopLevelException of exn (* raised during executation only *) | ||
184 : | exception TopLevelCallcc (* raised during executation only *) | ||
185 : | *************** | ||
186 : | *** 68,98 **** | ||
187 : | * PARSING * | ||
188 : | *****************************************************************************) | ||
189 : | |||
190 : | ! (** take the input source and turn it into the concrete syntax *) | ||
191 : | ! val parsePhase = ST.makePhase "Compiler 010 parse" | ||
192 : | ! fun parseOne (source : source) = | ||
193 : | ! let val parser = FE.parse source | ||
194 : | ! val parser = ST.doPhase parsePhase parser (* for correct timing *) | ||
195 : | ! in fn () => | ||
196 : | ! case parser () | ||
197 : | ! of FE.EOF => NONE | ||
198 : | ! | FE.ABORT => fail "syntax error" | ||
199 : | ! | FE.ERROR => fail "syntax error" | ||
200 : | ! | FE.PARSE ast => SOME ast | ||
201 : | ! end | ||
202 : | ! | ||
203 : | ! fun parse (source : source) = | ||
204 : | ! let val parser = FE.parse source | ||
205 : | ! val parser = ST.doPhase parsePhase parser (* for correct timing *) | ||
206 : | ! fun loop asts = | ||
207 : | ! case parser() | ||
208 : | ! of FE.EOF => Ast.SeqDec(rev asts) | ||
209 : | ! | FE.ABORT => fail "syntax error" | ||
210 : | ! | FE.ERROR => fail "syntax error" | ||
211 : | ! | FE.PARSE ast => loop(ast::asts) | ||
212 : | ! in loop nil | ||
213 : | ! end | ||
214 : | ! | ||
215 : | |||
216 : | (***************************************************************************** | ||
217 : | * ELABORATION * | ||
218 : | --- 64,71 ---- | ||
219 : | * PARSING * | ||
220 : | *****************************************************************************) | ||
221 : | |||
222 : | ! val parseOne = SmlFile.parseOne | ||
223 : | ! val parse = SmlFile.parse | ||
224 : | |||
225 : | (***************************************************************************** | ||
226 : | * ELABORATION * | ||
227 : | *************** | ||
228 : | *** 329,337 **** | ||
229 : | |||
230 : | end (* local of CompileF *) | ||
231 : | end (* functor CompileF *) | ||
232 : | - | ||
233 : | - end (* local of exception Compile *) | ||
234 : | - | ||
235 : | |||
236 : | (* | ||
237 : | * $Log$ | ||
238 : | * Revision 1.1 1999/06/20 03:14:55 blume | ||
239 : | * installation instructions; keep_going off by default | ||
240 : | * | ||
241 : | --- 302,307 ---- | ||
242 : | diff -c -r src.orig/compiler/TopLevel/viscomp/generic-vc.sig src/compiler/TopLevel/viscomp/generic-vc.sig | ||
243 : | *** src.orig/compiler/TopLevel/viscomp/generic-vc.sig Fri Oct 16 23:04:03 1998 | ||
244 : | --- src/compiler/TopLevel/viscomp/generic-vc.sig Thu Jun 3 16:00:03 1999 | ||
245 : | *************** | ||
246 : | *** 17,22 **** | ||
247 : | --- 17,23 ---- | ||
248 : | structure SourceMap : SOURCE_MAP | ||
249 : | structure ErrorMsg : ERRORMSG | ||
250 : | structure Symbol : SYMBOL | ||
251 : | + structure SymPath : SYMPATH | ||
252 : | structure StaticEnv : STATICENV | ||
253 : | structure DynamicEnv : DYNENV | ||
254 : | structure BareEnvironment : ENVIRONMENT | ||
255 : | *************** | ||
256 : | *** 36,41 **** | ||
257 : | --- 37,43 ---- | ||
258 : | -> PersStamps.persstamp | ||
259 : | end | ||
260 : | structure Ast : AST | ||
261 : | + structure SmlFile : SMLFILE | ||
262 : | |||
263 : | structure PrintHooks : PRINTHOOKS | ||
264 : | |||
265 : | diff -c -r src.orig/compiler/TopLevel/viscomp/generic-vc.sml src/compiler/TopLevel/viscomp/generic-vc.sml | ||
266 : | *** src.orig/compiler/TopLevel/viscomp/generic-vc.sml Fri Oct 16 23:04:03 1998 | ||
267 : | --- src/compiler/TopLevel/viscomp/generic-vc.sml Thu Jun 3 16:00:33 1999 | ||
268 : | *************** | ||
269 : | *** 12,17 **** | ||
270 : | --- 12,18 ---- | ||
271 : | structure SourceMap = SourceMap | ||
272 : | structure ErrorMsg = ErrorMsg | ||
273 : | structure Symbol = Symbol | ||
274 : | + structure SymPath = SymPath | ||
275 : | structure StaticEnv = StaticEnv | ||
276 : | structure DynamicEnv = DynamicEnv | ||
277 : | structure BareEnvironment = Environment | ||
278 : | *************** | ||
279 : | *** 32,37 **** | ||
280 : | --- 33,39 ---- | ||
281 : | #hash (PickMod.pickleEnv (context, CMStaticEnv.unCM se)) | ||
282 : | end | ||
283 : | structure Ast = Ast | ||
284 : | + structure SmlFile = SmlFile | ||
285 : | |||
286 : | structure PrintHooks : PRINTHOOKS = struct | ||
287 : | fun prAbsyn env d = | ||
288 : | Only in src/compiler: bin.x86-unix | ||
289 : | diff -c -r src.orig/compiler/viscomp-lib.cm src/compiler/viscomp-lib.cm | ||
290 : | *** src.orig/compiler/viscomp-lib.cm Fri Apr 16 23:52:59 1999 | ||
291 : | --- src/compiler/viscomp-lib.cm Thu Jun 3 16:03:30 1999 | ||
292 : | *************** | ||
293 : | *** 30,35 **** | ||
294 : | --- 30,36 ---- | ||
295 : | TopLevel/batch/batchconfig.sml | ||
296 : | TopLevel/batch/binfile.sig | ||
297 : | TopLevel/batch/binfile.sml | ||
298 : | + TopLevel/batch/smlfile.sml | ||
299 : | TopLevel/bootstrap/boot.sml | ||
300 : | TopLevel/batch/cmsa.sig | ||
301 : | TopLevel/batch/cmsa.sml | ||
302 : | --------------------- end of context diff ---------------------------- | ||
303 : |
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |