Import Upstream version 20180207
[hcoop/debian/mlton.git] / benchmark / tests / hamlet.sml
CommitLineData
7f918cf1
CE
1(*
2 * 2001-2-14.
3 * Stephen Weeks (sweeks@sweeks.com) generated this file from the hamlet SML
4 * interpreter written by Andreas Rossberg.
5 * The sources are from http://www.ps.uni-sb.de/~rossberg/hamlet/hamlet.tar
6 *
7 * The file consists of the concatenation of all of the source code (plus SML/NJ
8 * library code) in the correct order, with a simple test case to test the
9 * interpreter at the end.
10 *
11 * I also removed uses of the nonstandard Unsafe structure.
12 *
13 * I also made a minor change so that it could read in from a file instead of
14 * from stdIn.
15 *)
16
17val ins = ref TextIO.stdIn
18
19(* start of STAMP.sml *)
20(*
21 * Stamp generator.
22 *)
23
24
25signature STAMP =
26 sig
27
28 eqtype stamp
29
30 val stamp: unit -> stamp
31 val toString: stamp -> string
32
33 val reset: unit -> unit
34
35 val compare: stamp * stamp -> order
36
37 end
38(* stop of STAMP.sml *)
39(* start of Stamp.sml *)
40(*
41 * Stamp generator.
42 *)
43
44
45structure Stamp :> STAMP =
46 struct
47
48 type stamp = int
49
50 val r = ref 0
51
52 fun reset() = r := 0
53 fun stamp() = (r := !r + 1; !r)
54
55 val toString = Int.toString
56 val compare = Int.compare
57
58 end
59(* stop of Stamp.sml *)
60(* start of smlnj-lib/Util/ord-key-sig.sml *)
61(* ord-key-sig.sml
62 *
63 * COPYRIGHT (c) 1993 by AT&T Bell Laboratories. See COPYRIGHT file for details.
64 *
65 * Abstract linearly ordered keys.
66 *
67 *)
68
69signature ORD_KEY =
70 sig
71 type ord_key
72
73 val compare : ord_key * ord_key -> order
74
75 end (* ORD_KEY *)
76(* stop of smlnj-lib/Util/ord-key-sig.sml *)
77(* start of smlnj-lib/Util/lib-base-sig.sml *)
78(* lib-base-sig.sml
79 *
80 * COPYRIGHT (c) 1993 by AT&T Bell Laboratories. See COPYRIGHT file for details.
81 *)
82
83signature LIB_BASE =
84 sig
85
86 exception Unimplemented of string
87 (* raised to report unimplemented features *)
88 exception Impossible of string
89 (* raised to report internal errors *)
90
91 exception NotFound
92 (* raised by searching operations *)
93
94 val failure : {module : string, func : string, msg : string} -> 'a
95 (* raise the exception Fail with a standard format message. *)
96
97 val version : {date : string, system : string, version_id : int list}
98 val banner : string
99
100 end (* LIB_BASE *)
101
102(* stop of smlnj-lib/Util/lib-base-sig.sml *)
103(* start of smlnj-lib/Util/lib-base.sml *)
104(* lib-base.sml
105 *
106 * COPYRIGHT (c) 1993 by AT&T Bell Laboratories. See COPYRIGHT file for details.
107 *)
108
109structure LibBase : LIB_BASE =
110 struct
111
112 (* raised to report unimplemented features *)
113 exception Unimplemented of string
114
115 (* raised to report internal errors *)
116 exception Impossible of string
117
118 (* raised by searching operations *)
119 exception NotFound
120
121 (* raise the exception Fail with a standard format message. *)
122 fun failure {module, func, msg} =
123 raise (Fail(concat[module, ".", func, ": ", msg]))
124
125 val version = {
126 date = "June 1, 1996",
127 system = "SML/NJ Library",
128 version_id = [1, 0]
129 }
130
131 fun f ([], l) = l
132 | f ([x : int], l) = (Int.toString x)::l
133 | f (x::r, l) = (Int.toString x) :: "." :: f(r, l)
134
135 val banner = concat (
136 #system version :: ", Version " ::
137 f (#version_id version, [", ", #date version]))
138
139 end (* LibBase *)
140
141(* stop of smlnj-lib/Util/lib-base.sml *)
142(* start of smlnj-lib/Util/ord-map-sig.sml *)
143(* ord-map-sig.sml
144 *
145 * COPYRIGHT (c) 1996 by AT&T Research. See COPYRIGHT file for details.
146 *
147 * Abstract signature of an applicative-style finite maps (dictionaries)
148 * structure over ordered monomorphic keys.
149 *)
150
151signature ORD_MAP =
152 sig
153
154 structure Key : ORD_KEY
155
156 type 'a map
157
158 val empty : 'a map
159 (* The empty map *)
160
161 val isEmpty : 'a map -> bool
162 (* Return true if and only if the map is empty *)
163
164 val singleton : (Key.ord_key * 'a) -> 'a map
165 (* return the specified singleton map *)
166
167 val insert : 'a map * Key.ord_key * 'a -> 'a map
168 val insert' : ((Key.ord_key * 'a) * 'a map) -> 'a map
169 (* Insert an item. *)
170
171 val find : 'a map * Key.ord_key -> 'a option
172 (* Look for an item, return NONE if the item doesn't exist *)
173
174 val inDomain : ('a map * Key.ord_key) -> bool
175 (* return true, if the key is in the domain of the map *)
176
177 val remove : 'a map * Key.ord_key -> 'a map * 'a
178 (* Remove an item, returning new map and value removed.
179 * Raises LibBase.NotFound if not found.
180 *)
181
182 val first : 'a map -> 'a option
183 val firsti : 'a map -> (Key.ord_key * 'a) option
184 (* return the first item in the map (or NONE if it is empty) *)
185
186 val numItems : 'a map -> int
187 (* Return the number of items in the map *)
188
189 val listItems : 'a map -> 'a list
190 val listItemsi : 'a map -> (Key.ord_key * 'a) list
191 (* Return an ordered list of the items (and their keys) in the map. *)
192
193 val listKeys : 'a map -> Key.ord_key list
194 (* return an ordered list of the keys in the map. *)
195
196 val collate : ('a * 'a -> order) -> ('a map * 'a map) -> order
197 (* given an ordering on the map's range, return an ordering
198 * on the map.
199 *)
200
201 val unionWith : ('a * 'a -> 'a) -> ('a map * 'a map) -> 'a map
202 val unionWithi : (Key.ord_key * 'a * 'a -> 'a) -> ('a map * 'a map) -> 'a map
203 (* return a map whose domain is the union of the domains of the two input
204 * maps, using the supplied function to define the map on elements that
205 * are in both domains.
206 *)
207
208 val intersectWith : ('a * 'b -> 'c) -> ('a map * 'b map) -> 'c map
209 val intersectWithi : (Key.ord_key * 'a * 'b -> 'c) -> ('a map * 'b map) -> 'c map
210 (* return a map whose domain is the intersection of the domains of the
211 * two input maps, using the supplied function to define the range.
212 *)
213
214 val app : ('a -> unit) -> 'a map -> unit
215 val appi : ((Key.ord_key * 'a) -> unit) -> 'a map -> unit
216 (* Apply a function to the entries of the map in map order. *)
217
218 val map : ('a -> 'b) -> 'a map -> 'b map
219 val mapi : (Key.ord_key * 'a -> 'b) -> 'a map -> 'b map
220 (* Create a new map by applying a map function to the
221 * name/value pairs in the map.
222 *)
223
224 val foldl : ('a * 'b -> 'b) -> 'b -> 'a map -> 'b
225 val foldli : (Key.ord_key * 'a * 'b -> 'b) -> 'b -> 'a map -> 'b
226 (* Apply a folding function to the entries of the map
227 * in increasing map order.
228 *)
229
230 val foldr : ('a * 'b -> 'b) -> 'b -> 'a map -> 'b
231 val foldri : (Key.ord_key * 'a * 'b -> 'b) -> 'b -> 'a map -> 'b
232 (* Apply a folding function to the entries of the map
233 * in decreasing map order.
234 *)
235
236 val filter : ('a -> bool) -> 'a map -> 'a map
237 val filteri : (Key.ord_key * 'a -> bool) -> 'a map -> 'a map
238 (* Filter out those elements of the map that do not satisfy the
239 * predicate. The filtering is done in increasing map order.
240 *)
241
242 val mapPartial : ('a -> 'b option) -> 'a map -> 'b map
243 val mapPartiali : (Key.ord_key * 'a -> 'b option) -> 'a map -> 'b map
244 (* map a partial function over the elements of a map in increasing
245 * map order.
246 *)
247
248 end (* ORD_MAP *)
249(* stop of smlnj-lib/Util/ord-map-sig.sml *)
250(* start of smlnj-lib/Util/binary-map-fn.sml *)
251(* binary-map-fn.sml
252 *
253 * COPYRIGHT (c) 1993 by AT&T Bell Laboratories. See COPYRIGHT file for details.
254 *
255 * This code was adapted from Stephen Adams' binary tree implementation
256 * of applicative integer sets.
257 *
258 * Copyright 1992 Stephen Adams.
259 *
260 * This software may be used freely provided that:
261 * 1. This copyright notice is attached to any copy, derived work,
262 * or work including all or part of this software.
263 * 2. Any derived work must contain a prominent notice stating that
264 * it has been altered from the original.
265 *
266 *
267 * Name(s): Stephen Adams.
268 * Department, Institution: Electronics & Computer Science,
269 * University of Southampton
270 * Address: Electronics & Computer Science
271 * University of Southampton
272 * Southampton SO9 5NH
273 * Great Britian
274 * E-mail: sra@ecs.soton.ac.uk
275 *
276 * Comments:
277 *
278 * 1. The implementation is based on Binary search trees of Bounded
279 * Balance, similar to Nievergelt & Reingold, SIAM J. Computing
280 * 2(1), March 1973. The main advantage of these trees is that
281 * they keep the size of the tree in the node, giving a constant
282 * time size operation.
283 *
284 * 2. The bounded balance criterion is simpler than N&R's alpha.
285 * Simply, one subtree must not have more than `weight' times as
286 * many elements as the opposite subtree. Rebalancing is
287 * guaranteed to reinstate the criterion for weight>2.23, but
288 * the occasional incorrect behaviour for weight=2 is not
289 * detrimental to performance.
290 *
291 *)
292
293functor BinaryMapFn (K : ORD_KEY) : ORD_MAP =
294 struct
295
296 structure Key = K
297
298 (*
299 ** val weight = 3
300 ** fun wt i = weight * i
301 *)
302 fun wt (i : int) = i + i + i
303
304 datatype 'a map
305 = E
306 | T of {
307 key : K.ord_key,
308 value : 'a,
309 cnt : int,
310 left : 'a map,
311 right : 'a map
312 }
313
314 val empty = E
315
316 fun isEmpty E = true
317 | isEmpty _ = false
318
319 fun numItems E = 0
320 | numItems (T{cnt,...}) = cnt
321
322 (* return the first item in the map (or NONE if it is empty) *)
323 fun first E = NONE
324 | first (T{value, left=E, ...}) = SOME value
325 | first (T{left, ...}) = first left
326
327 (* return the first item in the map and its key (or NONE if it is empty) *)
328 fun firsti E = NONE
329 | firsti (T{key, value, left=E, ...}) = SOME(key, value)
330 | firsti (T{left, ...}) = firsti left
331
332local
333 fun N(k,v,E,E) = T{key=k,value=v,cnt=1,left=E,right=E}
334 | N(k,v,E,r as T n) = T{key=k,value=v,cnt=1+(#cnt n),left=E,right=r}
335 | N(k,v,l as T n,E) = T{key=k,value=v,cnt=1+(#cnt n),left=l,right=E}
336 | N(k,v,l as T n,r as T n') =
337 T{key=k,value=v,cnt=1+(#cnt n)+(#cnt n'),left=l,right=r}
338
339 fun single_L (a,av,x,T{key=b,value=bv,left=y,right=z,...}) =
340 N(b,bv,N(a,av,x,y),z)
341 | single_L _ = raise Match
342 fun single_R (b,bv,T{key=a,value=av,left=x,right=y,...},z) =
343 N(a,av,x,N(b,bv,y,z))
344 | single_R _ = raise Match
345 fun double_L (a,av,w,T{key=c,value=cv,left=T{key=b,value=bv,left=x,right=y,...},right=z,...}) =
346 N(b,bv,N(a,av,w,x),N(c,cv,y,z))
347 | double_L _ = raise Match
348 fun double_R (c,cv,T{key=a,value=av,left=w,right=T{key=b,value=bv,left=x,right=y,...},...},z) =
349 N(b,bv,N(a,av,w,x),N(c,cv,y,z))
350 | double_R _ = raise Match
351
352 fun T' (k,v,E,E) = T{key=k,value=v,cnt=1,left=E,right=E}
353 | T' (k,v,E,r as T{right=E,left=E,...}) =
354 T{key=k,value=v,cnt=2,left=E,right=r}
355 | T' (k,v,l as T{right=E,left=E,...},E) =
356 T{key=k,value=v,cnt=2,left=l,right=E}
357
358 | T' (p as (_,_,E,T{left=T _,right=E,...})) = double_L p
359 | T' (p as (_,_,T{left=E,right=T _,...},E)) = double_R p
360
361 (* these cases almost never happen with small weight*)
362 | T' (p as (_,_,E,T{left=T{cnt=ln,...},right=T{cnt=rn,...},...})) =
363 if ln < rn then single_L p else double_L p
364 | T' (p as (_,_,T{left=T{cnt=ln,...},right=T{cnt=rn,...},...},E)) =
365 if ln > rn then single_R p else double_R p
366
367 | T' (p as (_,_,E,T{left=E,...})) = single_L p
368 | T' (p as (_,_,T{right=E,...},E)) = single_R p
369
370 | T' (p as (k,v,l as T{cnt=ln,left=ll,right=lr,...},
371 r as T{cnt=rn,left=rl,right=rr,...})) =
372 if rn >= wt ln then (*right is too big*)
373 let val rln = numItems rl
374 val rrn = numItems rr
375 in
376 if rln < rrn then single_L p else double_L p
377 end
378
379 else if ln >= wt rn then (*left is too big*)
380 let val lln = numItems ll
381 val lrn = numItems lr
382 in
383 if lrn < lln then single_R p else double_R p
384 end
385
386 else T{key=k,value=v,cnt=ln+rn+1,left=l,right=r}
387
388 local
389 fun min (T{left=E,key,value,...}) = (key,value)
390 | min (T{left,...}) = min left
391 | min _ = raise Match
392
393 fun delmin (T{left=E,right,...}) = right
394 | delmin (T{key,value,left,right,...}) = T'(key,value,delmin left,right)
395 | delmin _ = raise Match
396 in
397 fun delete' (E,r) = r
398 | delete' (l,E) = l
399 | delete' (l,r) = let val (mink,minv) = min r in
400 T'(mink,minv,l,delmin r)
401 end
402 end
403in
404 fun mkDict () = E
405
406 fun singleton (x,v) = T{key=x,value=v,cnt=1,left=E,right=E}
407
408 fun insert (E,x,v) = T{key=x,value=v,cnt=1,left=E,right=E}
409 | insert (T(set as {key,left,right,value,...}),x,v) =
410 case K.compare (key,x) of
411 GREATER => T'(key,value,insert(left,x,v),right)
412 | LESS => T'(key,value,left,insert(right,x,v))
413 | _ => T{key=x,value=v,left=left,right=right,cnt= #cnt set}
414 fun insert' ((k, x), m) = insert(m, k, x)
415
416 fun inDomain (set, x) = let
417 fun mem E = false
418 | mem (T(n as {key,left,right,...})) = (case K.compare (x,key)
419 of GREATER => mem right
420 | EQUAL => true
421 | LESS => mem left
422 (* end case *))
423 in
424 mem set
425 end
426
427 fun find (set, x) = let
428 fun mem E = NONE
429 | mem (T(n as {key,left,right,...})) = (case K.compare (x,key)
430 of GREATER => mem right
431 | EQUAL => SOME(#value n)
432 | LESS => mem left
433 (* end case *))
434 in
435 mem set
436 end
437
438 fun remove (E,x) = raise LibBase.NotFound
439 | remove (set as T{key,left,right,value,...},x) = (
440 case K.compare (key,x)
441 of GREATER => let
442 val (left', v) = remove(left, x)
443 in
444 (T'(key, value, left', right), v)
445 end
446 | LESS => let
447 val (right', v) = remove (right, x)
448 in
449 (T'(key, value, left, right'), v)
450 end
451 | _ => (delete'(left,right),value)
452 (* end case *))
453
454 fun listItems d = let
455 fun d2l (E, l) = l
456 | d2l (T{key,value,left,right,...}, l) =
457 d2l(left, value::(d2l(right,l)))
458 in
459 d2l (d,[])
460 end
461
462 fun listItemsi d = let
463 fun d2l (E, l) = l
464 | d2l (T{key,value,left,right,...}, l) =
465 d2l(left, (key,value)::(d2l(right,l)))
466 in
467 d2l (d,[])
468 end
469
470 fun listKeys d = let
471 fun d2l (E, l) = l
472 | d2l (T{key,left,right,...}, l) = d2l(left, key::(d2l(right,l)))
473 in
474 d2l (d,[])
475 end
476
477 local
478 fun next ((t as T{right, ...})::rest) = (t, left(right, rest))
479 | next _ = (E, [])
480 and left (E, rest) = rest
481 | left (t as T{left=l, ...}, rest) = left(l, t::rest)
482 in
483 fun collate cmpRng (s1, s2) = let
484 fun cmp (t1, t2) = (case (next t1, next t2)
485 of ((E, _), (E, _)) => EQUAL
486 | ((E, _), _) => LESS
487 | (_, (E, _)) => GREATER
488 | ((T{key=x1, value=y1, ...}, r1), (T{key=x2, value=y2, ...}, r2)) => (
489 case Key.compare(x1, x2)
490 of EQUAL => (case cmpRng(y1, y2)
491 of EQUAL => cmp (r1, r2)
492 | order => order
493 (* end case *))
494 | order => order
495 (* end case *))
496 (* end case *))
497 in
498 cmp (left(s1, []), left(s2, []))
499 end
500 end (* local *)
501
502 fun appi f d = let
503 fun app' E = ()
504 | app' (T{key,value,left,right,...}) = (
505 app' left; f(key, value); app' right)
506 in
507 app' d
508 end
509 fun app f d = let
510 fun app' E = ()
511 | app' (T{value,left,right,...}) = (
512 app' left; f value; app' right)
513 in
514 app' d
515 end
516
517 fun mapi f d = let
518 fun map' E = E
519 | map' (T{key,value,left,right,cnt}) = let
520 val left' = map' left
521 val value' = f(key, value)
522 val right' = map' right
523 in
524 T{cnt=cnt, key=key, value=value', left = left', right = right'}
525 end
526 in
527 map' d
528 end
529 fun map f d = mapi (fn (_, x) => f x) d
530
531 fun foldli f init d = let
532 fun fold (E, v) = v
533 | fold (T{key,value,left,right,...}, v) =
534 fold (right, f(key, value, fold(left, v)))
535 in
536 fold (d, init)
537 end
538 fun foldl f init d = foldli (fn (_, v, accum) => f (v, accum)) init d
539
540 fun foldri f init d = let
541 fun fold (E,v) = v
542 | fold (T{key,value,left,right,...},v) =
543 fold (left, f(key, value, fold(right, v)))
544 in
545 fold (d, init)
546 end
547 fun foldr f init d = foldri (fn (_, v, accum) => f (v, accum)) init d
548
549(** To be implemented **
550 val filter : ('a -> bool) -> 'a map -> 'a map
551 val filteri : (Key.ord_key * 'a -> bool) -> 'a map -> 'a map
552**)
553
554 end (* local *)
555
556(* the following are generic implementations of the unionWith and intersectWith
557 * operetions. These should be specialized for the internal representations
558 * at some point.
559 *)
560 fun unionWith f (m1, m2) = let
561 fun ins f (key, x, m) = (case find(m, key)
562 of NONE => insert(m, key, x)
563 | (SOME x') => insert(m, key, f(x, x'))
564 (* end case *))
565 in
566 if (numItems m1 > numItems m2)
567 then foldli (ins (fn (a, b) => f (b, a))) m1 m2
568 else foldli (ins f) m2 m1
569 end
570 fun unionWithi f (m1, m2) = let
571 fun ins f (key, x, m) = (case find(m, key)
572 of NONE => insert(m, key, x)
573 | (SOME x') => insert(m, key, f(key, x, x'))
574 (* end case *))
575 in
576 if (numItems m1 > numItems m2)
577 then foldli (ins (fn (k, a, b) => f (k, b, a))) m1 m2
578 else foldli (ins f) m2 m1
579 end
580
581 fun intersectWith f (m1, m2) = let
582 (* iterate over the elements of m1, checking for membership in m2 *)
583 fun intersect f (m1, m2) = let
584 fun ins (key, x, m) = (case find(m2, key)
585 of NONE => m
586 | (SOME x') => insert(m, key, f(x, x'))
587 (* end case *))
588 in
589 foldli ins empty m1
590 end
591 in
592 if (numItems m1 > numItems m2)
593 then intersect f (m1, m2)
594 else intersect (fn (a, b) => f(b, a)) (m2, m1)
595 end
596 fun intersectWithi f (m1, m2) = let
597 (* iterate over the elements of m1, checking for membership in m2 *)
598 fun intersect f (m1, m2) = let
599 fun ins (key, x, m) = (case find(m2, key)
600 of NONE => m
601 | (SOME x') => insert(m, key, f(key, x, x'))
602 (* end case *))
603 in
604 foldli ins empty m1
605 end
606 in
607 if (numItems m1 > numItems m2)
608 then intersect f (m1, m2)
609 else intersect (fn (k, a, b) => f(k, b, a)) (m2, m1)
610 end
611
612 (* this is a generic implementation of filter. It should
613 * be specialized to the data-structure at some point.
614 *)
615 fun filter predFn m = let
616 fun f (key, item, m) = if predFn item
617 then insert(m, key, item)
618 else m
619 in
620 foldli f empty m
621 end
622 fun filteri predFn m = let
623 fun f (key, item, m) = if predFn(key, item)
624 then insert(m, key, item)
625 else m
626 in
627 foldli f empty m
628 end
629
630 (* this is a generic implementation of mapPartial. It should
631 * be specialized to the data-structure at some point.
632 *)
633 fun mapPartial f m = let
634 fun g (key, item, m) = (case f item
635 of NONE => m
636 | (SOME item') => insert(m, key, item')
637 (* end case *))
638 in
639 foldli g empty m
640 end
641 fun mapPartiali f m = let
642 fun g (key, item, m) = (case f(key, item)
643 of NONE => m
644 | (SOME item') => insert(m, key, item')
645 (* end case *))
646 in
647 foldli g empty m
648 end
649
650 end (* functor BinaryMapFn *)
651(* stop of smlnj-lib/Util/binary-map-fn.sml *)
652(* start of FIN_MAP.sml *)
653(*
654 * Standard ML finite maps
655 *
656 * Definition, section 4.2
657 *
658 * Note:
659 * This signature just extends the one available in the SML/NJ lib.
660 * Actually, the operation added here would be general purpose and useful enough
661 * (and more efficient) to be in the lib. Also see FIN_SET.
662 *)
663
664signature FIN_MAP =
665 sig
666
667 include ORD_MAP
668
669 val fromList: (Key.ord_key * 'a) list -> 'a map
670
671 val all: ('a -> bool) -> 'a map -> bool
672 val exists: ('a -> bool) -> 'a map -> bool
673 val alli: (Key.ord_key * 'a -> bool) -> 'a map -> bool
674 val existsi: (Key.ord_key * 'a -> bool) -> 'a map -> bool
675
676 val disjoint: 'a map * 'a map -> bool
677
678 end
679(* stop of FIN_MAP.sml *)
680(* start of FinMapFn.sml *)
681(*
682 * Standard ML finite maps
683 *
684 * Definition, section 4.2
685 *
686 * Note:
687 * This functor just extends the one available in the SML/NJ lib.
688 * Actually, the operation added here would be general purpose and useful enough
689 * (and more efficient) to be in the lib. Also see FinSetFn.
690 *)
691
692functor FinMapFn(Key: ORD_KEY) :> FIN_MAP where type Key.ord_key = Key.ord_key =
693 struct
694
695 structure BinaryMap = BinaryMapFn(Key)
696
697 open BinaryMap
698
699 fun fromList kvs = List.foldl (fn((k, v),m) => insert(m, k, v)) empty kvs
700
701 fun all p = foldl (fn(v, b) => b andalso p v) true
702 fun exists p = foldl (fn(v, b) => b orelse p v) false
703 fun alli p = foldli (fn(k, v, b) => b andalso p(k, v)) true
704 fun existsi p = foldli (fn(k, v, b) => b orelse p(k, v)) false
705
706 fun disjoint(m1,m2) = isEmpty(intersectWith #2 (m1, m2))
707
708 end
709(* stop of FinMapFn.sml *)
710(* start of ID.sml *)
711(*
712 * Standard ML identifiers
713 *
714 * Definition, section 2.4
715 *
716 * Note:
717 * This is a generic signature to represent all kinds of identifiers (except
718 * for labels and tyvars).
719 *)
720
721
722signature ID =
723 sig
724
725 (* Type [Section 2.4] *)
726
727 eqtype Id (* [id] *)
728
729 (* Operations *)
730
731 val invent: unit -> Id
732
733 val fromString: string -> Id
734 val toString: Id -> string
735
736 val compare: Id * Id -> order
737
738 end
739(* stop of ID.sml *)
740(* start of IdFn.sml *)
741(*
742 * Standard ML identifiers
743 *
744 * Definition, section 2.4
745 *
746 * Note:
747 * This is a generic functor to represent all kinds of identifiers (except
748 * for labels tyvars).
749 *)
750
751
752functor IdFn() :> ID =
753 struct
754
755 (* Type [Section 2.4] *)
756
757 type Id = string (* [id] *)
758
759
760 (* Creation *)
761
762 fun invent() = "_id" ^ Stamp.toString(Stamp.stamp())
763
764 fun fromString s = s
765 fun toString s = s
766
767
768 (* Ordering *)
769
770 val compare = String.compare
771
772 end
773(* stop of IdFn.sml *)
774(* start of IdsModule.sml *)
775(*
776 * Standard ML identifiers for modules
777 *
778 * Definition, section 3.2
779 *)
780
781
782structure SigId = IdFn()
783structure FunId = IdFn()
784(* stop of IdsModule.sml *)
785(* start of AssembliesModule.sml *)
786(*
787 * Standard ML sets and maps for the module semantics
788 *
789 * Definition, sections 5.1 and 7.2
790 *)
791
792structure SigIdMap = FinMapFn(type ord_key = SigId.Id
793 val compare = SigId.compare)
794
795structure FunIdMap = FinMapFn(type ord_key = FunId.Id
796 val compare = FunId.compare)
797(* stop of AssembliesModule.sml *)
798(* start of LONGID.sml *)
799(*
800 * Standard ML long identifiers
801 *
802 * Definition, section 2.4
803 *
804 * Note:
805 * This is a generic signature to represent all kinds of long identifiers.
806 *)
807
808
809signature LONGID =
810 sig
811
812 (* Import *)
813
814 structure Id: ID
815 structure StrId: ID
816
817 type Id = Id.Id
818 type StrId = StrId.Id
819
820
821 (* Type [Section 2.4] *)
822
823 eqtype longId (* [longid] *)
824
825
826 (* Operations *)
827
828 val invent: unit -> longId
829 val fromId: Id -> longId
830 val toId: longId -> Id
831 val toString: longId -> string
832
833 val strengthen: StrId * longId -> longId
834 val implode: StrId list * Id -> longId
835 val explode: longId -> StrId list * Id
836
837 val isUnqualified: longId -> bool
838
839 val compare: longId * longId -> order
840
841 end
842(* stop of LONGID.sml *)
843(* start of LongIdFn.sml *)
844(*
845 * Standard ML long identifiers
846 *
847 * Definition, section 2.4
848 *
849 * Note:
850 * This is a generic functor that generates a long identifier type from a
851 * given identifier type and the StrId type.
852 *)
853
854
855functor LongIdFn(structure Id: ID
856 structure StrId: ID
857 ) :> LONGID where type Id.Id = Id.Id
858 and type StrId.Id = StrId.Id
859 =
860 struct
861
862 (* Import *)
863
864 structure Id = Id
865 structure StrId = StrId
866
867 type Id = Id.Id
868 type StrId = StrId.Id
869
870
871 (* Type [Section 2.4] *)
872
873 type longId = StrId list * Id (* [longid] *)
874
875
876 (* Conversions *)
877
878 fun toId(strid, id) = id
879 fun fromId id = ([],id)
880 fun invent() = ([],Id.invent())
881
882 fun toString(strids, id) =
883 let
884 fun prefix [] = Id.toString id
885 | prefix(id::ids) = StrId.toString id ^ "." ^ prefix ids
886 in
887 prefix strids
888 end
889
890 fun strengthen(strid, (strids, id)) = (strid::strids, id)
891
892 fun implode longid = longid
893 fun explode longid = longid
894
895 fun isUnqualified (strids,id) = List.null strids
896
897
898 (* Ordering *)
899
900 fun compare(longid1, longid2) =
901 String.compare(toString longid1, toString longid2)
902
903 end
904(* stop of LongIdFn.sml *)
905(* start of IdsCore.sml *)
906(*
907 * Standard ML identifiers for the core
908 *
909 * Definition, section 2.4
910 *)
911
912
913structure VId = IdFn()
914structure TyCon = IdFn()
915structure StrId = IdFn()
916
917structure LongVId = LongIdFn(structure Id = VId
918 structure StrId = StrId)
919structure LongTyCon = LongIdFn(structure Id = TyCon
920 structure StrId = StrId)
921structure LongStrId = LongIdFn(structure Id = StrId
922 structure StrId = StrId)
923(* stop of IdsCore.sml *)
924(* start of smlnj-lib/Util/ord-set-sig.sml *)
925(* ordset-sig.sml
926 *
927 * COPYRIGHT (c) 1993 by AT&T Bell Laboratories. See COPYRIGHT file for details.
928 *
929 * Signature for a set of values with an order relation.
930 *)
931
932signature ORD_SET =
933 sig
934
935 structure Key : ORD_KEY
936
937 type item = Key.ord_key
938 type set
939
940 val empty : set
941 (* The empty set *)
942
943 val singleton : item -> set
944 (* Create a singleton set *)
945
946 val add : set * item -> set
947 val add' : (item * set) -> set
948 (* Insert an item. *)
949
950 val addList : set * item list -> set
951 (* Insert items from list. *)
952
953 val delete : set * item -> set
954 (* Remove an item. Raise NotFound if not found. *)
955
956 val member : set * item -> bool
957 (* Return true if and only if item is an element in the set *)
958
959 val isEmpty : set -> bool
960 (* Return true if and only if the set is empty *)
961
962 val equal : (set * set) -> bool
963 (* Return true if and only if the two sets are equal *)
964
965 val compare : (set * set) -> order
966 (* does a lexical comparison of two sets *)
967
968 val isSubset : (set * set) -> bool
969 (* Return true if and only if the first set is a subset of the second *)
970
971 val numItems : set -> int
972 (* Return the number of items in the table *)
973
974 val listItems : set -> item list
975 (* Return an ordered list of the items in the set *)
976
977 val union : set * set -> set
978 (* Union *)
979
980 val intersection : set * set -> set
981 (* Intersection *)
982
983 val difference : set * set -> set
984 (* Difference *)
985
986 val map : (item -> item) -> set -> set
987 (* Create a new set by applying a map function to the elements
988 * of the set.
989 *)
990
991 val app : (item -> unit) -> set -> unit
992 (* Apply a function to the entries of the set
993 * in decreasing order
994 *)
995
996 val foldl : (item * 'b -> 'b) -> 'b -> set -> 'b
997 (* Apply a folding function to the entries of the set
998 * in increasing order
999 *)
1000
1001 val foldr : (item * 'b -> 'b) -> 'b -> set -> 'b
1002 (* Apply a folding function to the entries of the set
1003 * in decreasing order
1004 *)
1005
1006 val filter : (item -> bool) -> set -> set
1007
1008 val exists : (item -> bool) -> set -> bool
1009
1010 val find : (item -> bool) -> set -> item option
1011
1012 end (* ORD_SET *)
1013(* stop of smlnj-lib/Util/ord-set-sig.sml *)
1014(* start of smlnj-lib/Util/binary-set-fn.sml *)
1015(* binary-set-fn.sml
1016 *
1017 * COPYRIGHT (c) 1993 by AT&T Bell Laboratories. See COPYRIGHT file for details.
1018 *
1019 * This code was adapted from Stephen Adams' binary tree implementation
1020 * of applicative integer sets.
1021 *
1022 * Copyright 1992 Stephen Adams.
1023 *
1024 * This software may be used freely provided that:
1025 * 1. This copyright notice is attached to any copy, derived work,
1026 * or work including all or part of this software.
1027 * 2. Any derived work must contain a prominent notice stating that
1028 * it has been altered from the original.
1029 *
1030 * Name(s): Stephen Adams.
1031 * Department, Institution: Electronics & Computer Science,
1032 * University of Southampton
1033 * Address: Electronics & Computer Science
1034 * University of Southampton
1035 * Southampton SO9 5NH
1036 * Great Britian
1037 * E-mail: sra@ecs.soton.ac.uk
1038 *
1039 * Comments:
1040 *
1041 * 1. The implementation is based on Binary search trees of Bounded
1042 * Balance, similar to Nievergelt & Reingold, SIAM J. Computing
1043 * 2(1), March 1973. The main advantage of these trees is that
1044 * they keep the size of the tree in the node, giving a constant
1045 * time size operation.
1046 *
1047 * 2. The bounded balance criterion is simpler than N&R's alpha.
1048 * Simply, one subtree must not have more than `weight' times as
1049 * many elements as the opposite subtree. Rebalancing is
1050 * guaranteed to reinstate the criterion for weight>2.23, but
1051 * the occasional incorrect behaviour for weight=2 is not
1052 * detrimental to performance.
1053 *
1054 * 3. There are two implementations of union. The default,
1055 * hedge_union, is much more complex and usually 20% faster. I
1056 * am not sure that the performance increase warrants the
1057 * complexity (and time it took to write), but I am leaving it
1058 * in for the competition. It is derived from the original
1059 * union by replacing the split_lt(gt) operations with a lazy
1060 * version. The `obvious' version is called old_union.
1061 *
1062 * 4. Most time is spent in T', the rebalancing constructor. If my
1063 * understanding of the output of *<file> in the sml batch
1064 * compiler is correct then the code produced by NJSML 0.75
1065 * (sparc) for the final case is very disappointing. Most
1066 * invocations fall through to this case and most of these cases
1067 * fall to the else part, i.e. the plain contructor,
1068 * T(v,ln+rn+1,l,r). The poor code allocates a 16 word vector
1069 * and saves lots of registers into it. In the common case it
1070 * then retrieves a few of the registers and allocates the 5
1071 * word T node. The values that it retrieves were live in
1072 * registers before the massive save.
1073 *
1074 * Modified to functor to support general ordered values
1075 *)
1076
1077functor BinarySetFn (K : ORD_KEY) : ORD_SET =
1078 struct
1079
1080 structure Key = K
1081
1082 type item = K.ord_key
1083
1084 datatype set
1085 = E
1086 | T of {
1087 elt : item,
1088 cnt : int,
1089 left : set,
1090 right : set
1091 }
1092
1093 fun numItems E = 0
1094 | numItems (T{cnt,...}) = cnt
1095
1096 fun isEmpty E = true
1097 | isEmpty _ = false
1098
1099 fun mkT(v,n,l,r) = T{elt=v,cnt=n,left=l,right=r}
1100
1101 (* N(v,l,r) = T(v,1+numItems(l)+numItems(r),l,r) *)
1102 fun N(v,E,E) = mkT(v,1,E,E)
1103 | N(v,E,r as T{cnt=n,...}) = mkT(v,n+1,E,r)
1104 | N(v,l as T{cnt=n,...}, E) = mkT(v,n+1,l,E)
1105 | N(v,l as T{cnt=n,...}, r as T{cnt=m,...}) = mkT(v,n+m+1,l,r)
1106
1107 fun single_L (a,x,T{elt=b,left=y,right=z,...}) = N(b,N(a,x,y),z)
1108 | single_L _ = raise Match
1109 fun single_R (b,T{elt=a,left=x,right=y,...},z) = N(a,x,N(b,y,z))
1110 | single_R _ = raise Match
1111 fun double_L (a,w,T{elt=c,left=T{elt=b,left=x,right=y,...},right=z,...}) =
1112 N(b,N(a,w,x),N(c,y,z))
1113 | double_L _ = raise Match
1114 fun double_R (c,T{elt=a,left=w,right=T{elt=b,left=x,right=y,...},...},z) =
1115 N(b,N(a,w,x),N(c,y,z))
1116 | double_R _ = raise Match
1117
1118 (*
1119 ** val weight = 3
1120 ** fun wt i = weight * i
1121 *)
1122 fun wt (i : int) = i + i + i
1123
1124 fun T' (v,E,E) = mkT(v,1,E,E)
1125 | T' (v,E,r as T{left=E,right=E,...}) = mkT(v,2,E,r)
1126 | T' (v,l as T{left=E,right=E,...},E) = mkT(v,2,l,E)
1127
1128 | T' (p as (_,E,T{left=T _,right=E,...})) = double_L p
1129 | T' (p as (_,T{left=E,right=T _,...},E)) = double_R p
1130
1131 (* these cases almost never happen with small weight*)
1132 | T' (p as (_,E,T{left=T{cnt=ln,...},right=T{cnt=rn,...},...})) =
1133 if ln<rn then single_L p else double_L p
1134 | T' (p as (_,T{left=T{cnt=ln,...},right=T{cnt=rn,...},...},E)) =
1135 if ln>rn then single_R p else double_R p
1136
1137 | T' (p as (_,E,T{left=E,...})) = single_L p
1138 | T' (p as (_,T{right=E,...},E)) = single_R p
1139
1140 | T' (p as (v,l as T{elt=lv,cnt=ln,left=ll,right=lr},
1141 r as T{elt=rv,cnt=rn,left=rl,right=rr})) =
1142 if rn >= wt ln (*right is too big*)
1143 then
1144 let val rln = numItems rl
1145 val rrn = numItems rr
1146 in
1147 if rln < rrn then single_L p else double_L p
1148 end
1149 else if ln >= wt rn (*left is too big*)
1150 then
1151 let val lln = numItems ll
1152 val lrn = numItems lr
1153 in
1154 if lrn < lln then single_R p else double_R p
1155 end
1156 else mkT(v,ln+rn+1,l,r)
1157
1158 fun add (E,x) = mkT(x,1,E,E)
1159 | add (set as T{elt=v,left=l,right=r,cnt},x) =
1160 case K.compare(x,v) of
1161 LESS => T'(v,add(l,x),r)
1162 | GREATER => T'(v,l,add(r,x))
1163 | EQUAL => mkT(x,cnt,l,r)
1164 fun add' (s, x) = add(x, s)
1165
1166 fun concat3 (E,v,r) = add(r,v)
1167 | concat3 (l,v,E) = add(l,v)
1168 | concat3 (l as T{elt=v1,cnt=n1,left=l1,right=r1}, v,
1169 r as T{elt=v2,cnt=n2,left=l2,right=r2}) =
1170 if wt n1 < n2 then T'(v2,concat3(l,v,l2),r2)
1171 else if wt n2 < n1 then T'(v1,l1,concat3(r1,v,r))
1172 else N(v,l,r)
1173
1174 fun split_lt (E,x) = E
1175 | split_lt (T{elt=v,left=l,right=r,...},x) =
1176 case K.compare(v,x) of
1177 GREATER => split_lt(l,x)
1178 | LESS => concat3(l,v,split_lt(r,x))
1179 | _ => l
1180
1181 fun split_gt (E,x) = E
1182 | split_gt (T{elt=v,left=l,right=r,...},x) =
1183 case K.compare(v,x) of
1184 LESS => split_gt(r,x)
1185 | GREATER => concat3(split_gt(l,x),v,r)
1186 | _ => r
1187
1188 fun min (T{elt=v,left=E,...}) = v
1189 | min (T{left=l,...}) = min l
1190 | min _ = raise Match
1191
1192 fun delmin (T{left=E,right=r,...}) = r
1193 | delmin (T{elt=v,left=l,right=r,...}) = T'(v,delmin l,r)
1194 | delmin _ = raise Match
1195
1196 fun delete' (E,r) = r
1197 | delete' (l,E) = l
1198 | delete' (l,r) = T'(min r,l,delmin r)
1199
1200 fun concat (E, s) = s
1201 | concat (s, E) = s
1202 | concat (t1 as T{elt=v1,cnt=n1,left=l1,right=r1},
1203 t2 as T{elt=v2,cnt=n2,left=l2,right=r2}) =
1204 if wt n1 < n2 then T'(v2,concat(t1,l2),r2)
1205 else if wt n2 < n1 then T'(v1,l1,concat(r1,t2))
1206 else T'(min t2,t1, delmin t2)
1207
1208
1209 local
1210 fun trim (lo,hi,E) = E
1211 | trim (lo,hi,s as T{elt=v,left=l,right=r,...}) =
1212 if K.compare(v,lo) = GREATER
1213 then if K.compare(v,hi) = LESS then s else trim(lo,hi,l)
1214 else trim(lo,hi,r)
1215
1216 fun uni_bd (s,E,_,_) = s
1217 | uni_bd (E,T{elt=v,left=l,right=r,...},lo,hi) =
1218 concat3(split_gt(l,lo),v,split_lt(r,hi))
1219 | uni_bd (T{elt=v,left=l1,right=r1,...},
1220 s2 as T{elt=v2,left=l2,right=r2,...},lo,hi) =
1221 concat3(uni_bd(l1,trim(lo,v,s2),lo,v),
1222 v,
1223 uni_bd(r1,trim(v,hi,s2),v,hi))
1224 (* inv: lo < v < hi *)
1225
1226 (* all the other versions of uni and trim are
1227 * specializations of the above two functions with
1228 * lo=-infinity and/or hi=+infinity
1229 *)
1230
1231 fun trim_lo (_, E) = E
1232 | trim_lo (lo,s as T{elt=v,right=r,...}) =
1233 case K.compare(v,lo) of
1234 GREATER => s
1235 | _ => trim_lo(lo,r)
1236
1237 fun trim_hi (_, E) = E
1238 | trim_hi (hi,s as T{elt=v,left=l,...}) =
1239 case K.compare(v,hi) of
1240 LESS => s
1241 | _ => trim_hi(hi,l)
1242
1243 fun uni_hi (s,E,_) = s
1244 | uni_hi (E,T{elt=v,left=l,right=r,...},hi) =
1245 concat3(l,v,split_lt(r,hi))
1246 | uni_hi (T{elt=v,left=l1,right=r1,...},
1247 s2 as T{elt=v2,left=l2,right=r2,...},hi) =
1248 concat3(uni_hi(l1,trim_hi(v,s2),v),v,uni_bd(r1,trim(v,hi,s2),v,hi))
1249
1250 fun uni_lo (s,E,_) = s
1251 | uni_lo (E,T{elt=v,left=l,right=r,...},lo) =
1252 concat3(split_gt(l,lo),v,r)
1253 | uni_lo (T{elt=v,left=l1,right=r1,...},
1254 s2 as T{elt=v2,left=l2,right=r2,...},lo) =
1255 concat3(uni_bd(l1,trim(lo,v,s2),lo,v),v,uni_lo(r1,trim_lo(v,s2),v))
1256
1257 fun uni (s,E) = s
1258 | uni (E,s) = s
1259 | uni (T{elt=v,left=l1,right=r1,...},
1260 s2 as T{elt=v2,left=l2,right=r2,...}) =
1261 concat3(uni_hi(l1,trim_hi(v,s2),v), v, uni_lo(r1,trim_lo(v,s2),v))
1262
1263 in
1264 val hedge_union = uni
1265 end
1266
1267 (* The old_union version is about 20% slower than
1268 * hedge_union in most cases
1269 *)
1270 fun old_union (E,s2) = s2
1271 | old_union (s1,E) = s1
1272 | old_union (T{elt=v,left=l,right=r,...},s2) =
1273 let val l2 = split_lt(s2,v)
1274 val r2 = split_gt(s2,v)
1275 in
1276 concat3(old_union(l,l2),v,old_union(r,r2))
1277 end
1278
1279 val empty = E
1280 fun singleton x = T{elt=x,cnt=1,left=E,right=E}
1281
1282 fun addList (s,l) = List.foldl (fn (i,s) => add(s,i)) s l
1283
1284 val add = add
1285
1286 fun member (set, x) = let
1287 fun pk E = false
1288 | pk (T{elt=v, left=l, right=r, ...}) = (
1289 case K.compare(x,v)
1290 of LESS => pk l
1291 | EQUAL => true
1292 | GREATER => pk r
1293 (* end case *))
1294 in
1295 pk set
1296 end
1297
1298 local
1299 (* true if every item in t is in t' *)
1300 fun treeIn (t,t') = let
1301 fun isIn E = true
1302 | isIn (T{elt,left=E,right=E,...}) = member(t',elt)
1303 | isIn (T{elt,left,right=E,...}) =
1304 member(t',elt) andalso isIn left
1305 | isIn (T{elt,left=E,right,...}) =
1306 member(t',elt) andalso isIn right
1307 | isIn (T{elt,left,right,...}) =
1308 member(t',elt) andalso isIn left andalso isIn right
1309 in
1310 isIn t
1311 end
1312 in
1313 fun isSubset (E,_) = true
1314 | isSubset (_,E) = false
1315 | isSubset (t as T{cnt=n,...},t' as T{cnt=n',...}) =
1316 (n<=n') andalso treeIn (t,t')
1317
1318 fun equal (E,E) = true
1319 | equal (t as T{cnt=n,...},t' as T{cnt=n',...}) =
1320 (n=n') andalso treeIn (t,t')
1321 | equal _ = false
1322 end
1323
1324 local
1325 fun next ((t as T{right, ...})::rest) = (t, left(right, rest))
1326 | next _ = (E, [])
1327 and left (E, rest) = rest
1328 | left (t as T{left=l, ...}, rest) = left(l, t::rest)
1329 in
1330 fun compare (s1, s2) = let
1331 fun cmp (t1, t2) = (case (next t1, next t2)
1332 of ((E, _), (E, _)) => EQUAL
1333 | ((E, _), _) => LESS
1334 | (_, (E, _)) => GREATER
1335 | ((T{elt=e1, ...}, r1), (T{elt=e2, ...}, r2)) => (
1336 case Key.compare(e1, e2)
1337 of EQUAL => cmp (r1, r2)
1338 | order => order
1339 (* end case *))
1340 (* end case *))
1341 in
1342 cmp (left(s1, []), left(s2, []))
1343 end
1344 end
1345
1346 fun delete (E,x) = raise LibBase.NotFound
1347 | delete (set as T{elt=v,left=l,right=r,...},x) =
1348 case K.compare(x,v) of
1349 LESS => T'(v,delete(l,x),r)
1350 | GREATER => T'(v,l,delete(r,x))
1351 | _ => delete'(l,r)
1352
1353 val union = hedge_union
1354
1355 fun intersection (E, _) = E
1356 | intersection (_, E) = E
1357 | intersection (s, T{elt=v,left=l,right=r,...}) = let
1358 val l2 = split_lt(s,v)
1359 val r2 = split_gt(s,v)
1360 in
1361 if member(s,v)
1362 then concat3(intersection(l2,l),v,intersection(r2,r))
1363 else concat(intersection(l2,l),intersection(r2,r))
1364 end
1365
1366 fun difference (E,s) = E
1367 | difference (s,E) = s
1368 | difference (s, T{elt=v,left=l,right=r,...}) =
1369 let val l2 = split_lt(s,v)
1370 val r2 = split_gt(s,v)
1371 in
1372 concat(difference(l2,l),difference(r2,r))
1373 end
1374
1375 fun map f set = let
1376 fun map'(acc, E) = acc
1377 | map'(acc, T{elt,left,right,...}) =
1378 map' (add (map' (acc, left), f elt), right)
1379 in
1380 map' (E, set)
1381 end
1382
1383 fun app apf =
1384 let fun apply E = ()
1385 | apply (T{elt,left,right,...}) =
1386 (apply left;apf elt; apply right)
1387 in
1388 apply
1389 end
1390
1391 fun foldl f b set = let
1392 fun foldf (E, b) = b
1393 | foldf (T{elt,left,right,...}, b) =
1394 foldf (right, f(elt, foldf (left, b)))
1395 in
1396 foldf (set, b)
1397 end
1398
1399 fun foldr f b set = let
1400 fun foldf (E, b) = b
1401 | foldf (T{elt,left,right,...}, b) =
1402 foldf (left, f(elt, foldf (right, b)))
1403 in
1404 foldf (set, b)
1405 end
1406
1407 fun listItems set = foldr (op::) [] set
1408
1409 fun filter pred set =
1410 foldl (fn (item, s) => if (pred item) then add(s, item) else s)
1411 empty set
1412
1413 fun find p E = NONE
1414 | find p (T{elt,left,right,...}) = (case find p left
1415 of NONE => if (p elt)
1416 then SOME elt
1417 else find p right
1418 | a => a
1419 (* end case *))
1420
1421 fun exists p E = false
1422 | exists p (T{elt, left, right,...}) =
1423 (exists p left) orelse (p elt) orelse (exists p right)
1424
1425 end (* BinarySetFn *)
1426(* stop of smlnj-lib/Util/binary-set-fn.sml *)
1427(* start of FIN_SET.sml *)
1428(*
1429 * Standard ML finite sets
1430 *
1431 * Definition, section 4.2
1432 *
1433 * Note:
1434 * This signature just extends the one available in the SML/NJ lib.
1435 * Actually, the operation added here would be general purpose and useful enough
1436 * to be in the lib. Also see FIN_MAP.
1437 *)
1438
1439signature FIN_SET =
1440 sig
1441
1442 include ORD_SET
1443
1444 val fromList: item list -> set
1445
1446 end
1447(* stop of FIN_SET.sml *)
1448(* start of FinSetFn.sml *)
1449(*
1450 * Standard ML finite sets
1451 *
1452 * Definition, section 4.2
1453 *
1454 * Note:
1455 * This functor just extends the one available in the SML/NJ lib.
1456 * Actually, the operation added here would be general purpose and useful enough
1457 * to be in the lib. Also see FinMapFn.
1458 *)
1459
1460functor FinSetFn(Key: ORD_KEY) :> FIN_SET where type Key.ord_key = Key.ord_key =
1461 struct
1462
1463 structure BinarySet = BinarySetFn(Key)
1464
1465 open BinarySet
1466
1467 fun fromList xs = addList(empty, xs)
1468
1469 end
1470(* stop of FinSetFn.sml *)
1471(* start of TYVAR.sml *)
1472(*
1473 * Standard ML type variables
1474 *
1475 * Definition, sections 2.4 and 4.1
1476 *)
1477
1478
1479signature TYVAR =
1480 sig
1481
1482 (* Type [Sections 2.4 and 4.1]*)
1483
1484 eqtype TyVar (* [alpha] or [tyvar] *)
1485
1486
1487 (* Operations *)
1488
1489 val invent: bool -> TyVar
1490 val fromIndex: bool -> int -> TyVar
1491 val fromString: string -> TyVar
1492 val toString: TyVar -> string
1493
1494 val admitsEquality: TyVar -> bool
1495 val isExplicit: TyVar -> bool
1496
1497 val instance: TyVar -> TyVar
1498 val normalise: TyVar * int -> TyVar
1499
1500 val compare: TyVar * TyVar -> order
1501
1502 end
1503(* stop of TYVAR.sml *)
1504(* start of TyVar.sml *)
1505(*
1506 * Standard ML type variables
1507 *
1508 * Definition, sections 2.4 and 4.1
1509 *
1510 * Note:
1511 * - Internally generated tyvars get names '#xxx, where xxx is a stamp number.
1512 * - Tyvars generated from integers are mapped to 'a,'b,..,'z,'aa,'bb,..,'zz,
1513 * 'aaa,...
1514 *)
1515
1516
1517structure TyVar :> TYVAR =
1518 struct
1519
1520 (* Type [Sections 2.4 and 4.1]*)
1521
1522 type TyVar = { name: string, equality: bool } (* [alpha] or [tyvar] *)
1523
1524
1525 (* Creation *)
1526
1527 fun invent equality =
1528 { name="'#" ^ Stamp.toString(Stamp.stamp()),
1529 equality=equality }
1530
1531 fun fromIndex equality n =
1532 let
1533 fun rep(0,c) = c
1534 | rep(n,c) = c ^ rep(n-1,c)
1535
1536 val c = String.str(Char.chr(Char.ord #"a" + n mod 26))
1537 val name = (if equality then "''" else "'") ^ rep(n div 26, c)
1538 in
1539 { name=name, equality=equality }
1540 end
1541
1542 fun fromString s =
1543 { name = s,
1544 equality = String.size(s) > 1 andalso String.sub(s,1) = #"'" }
1545
1546 fun toString{name,equality} = name
1547
1548
1549 (* Attributes [Section 4.1] *)
1550
1551 fun admitsEquality{name,equality} = equality
1552
1553 fun isExplicit{name,equality} =
1554 String.size name = 1 orelse String.sub(name,1) <> #"#"
1555
1556
1557 (* Small helpers *)
1558
1559 fun normalise({name,equality}, n) = fromIndex equality n
1560
1561 fun instance{name,equality} = invent equality
1562
1563
1564 (* Ordering *)
1565
1566 fun compare(alpha1: TyVar, alpha2: TyVar) =
1567 String.compare(#name alpha1, #name alpha2)
1568
1569 end
1570(* stop of TyVar.sml *)
1571(* start of TYNAME.sml *)
1572(*
1573 * Standard ML type names
1574 *
1575 * Definition, section 4.1
1576 *
1577 * Notes:
1578 * - Equality is not a boolean attribute. We distinguish a 3rd kind of special
1579 * type names which have equality regardless of the types applied. This
1580 * implements ref, array, and equivalent types.
1581 * - For easy checking of pattern exhaustiveness we add an attribute
1582 * `span' counting the number of constructors of the type.
1583 *)
1584
1585
1586signature TYNAME =
1587 sig
1588
1589 (* Import *)
1590
1591 type TyCon = TyCon.Id
1592
1593
1594 (* Type [Section 4.1] *)
1595
1596 eqtype TyName (* [t] *)
1597
1598 datatype Equality = NOEQ | EQ | SPECIALEQ
1599
1600
1601 (* Operations *)
1602
1603 val tyname: TyCon * int * Equality * int -> TyName
1604 val invent: int * Equality -> TyName
1605 val rename: TyName -> TyName
1606 val removeEquality: TyName -> TyName
1607 val Abs: TyName -> TyName
1608
1609 val arity: TyName -> int
1610 val equality: TyName -> Equality
1611 val span: TyName -> int
1612 val tycon: TyName -> TyCon
1613 val toString: TyName -> string
1614
1615 val compare: TyName * TyName -> order
1616
1617 end
1618(* stop of TYNAME.sml *)
1619(* start of TyName.sml *)
1620(*
1621 * Standard ML type names
1622 *
1623 * Definition, section 4.1
1624 *
1625 * Notes:
1626 * - Equality is not a boolean attribute. We distinguish a 3rd kind of special
1627 * type names which have equality regardless of the types applied. This
1628 * implements ref, array, and equivalent types.
1629 * - For easy checking of pattern exhaustiveness we add an attribute
1630 * `span' counting the number of constructors of the type.
1631 *)
1632
1633
1634structure TyName :> TYNAME =
1635 struct
1636
1637 (* Import *)
1638
1639 type TyCon = TyCon.Id
1640 type stamp = Stamp.stamp
1641
1642
1643 (* Type [Section 4.1] *)
1644
1645 datatype Equality = NOEQ | EQ | SPECIALEQ
1646
1647 type TyName = (* [t] *)
1648 { tycon: TyCon
1649 , stamp: stamp
1650 , arity: int
1651 , equality: Equality
1652 , span: int
1653 }
1654
1655
1656 (* Creation *)
1657
1658 fun tyname(tycon, arity, equality, span) =
1659 { tycon = tycon
1660 , stamp = Stamp.stamp()
1661 , arity = arity
1662 , equality = equality
1663 , span = span
1664 }
1665
1666 fun invent(arity, equality) = tyname(TyCon.invent(), arity, equality, 0)
1667
1668
1669 (* Creation from existing *)
1670
1671 fun rename{tycon, stamp, arity, equality, span} =
1672 tyname(tycon, arity, equality, span)
1673
1674 fun removeEquality{tycon, stamp, arity, equality, span} =
1675 tyname(tycon, arity, NOEQ, span)
1676
1677 fun Abs{tycon, stamp, arity, equality, span} =
1678 tyname(tycon, arity, NOEQ, 0)
1679
1680
1681 (* Attributes [Section 4.1] *)
1682
1683 fun arity {tycon, stamp, arity, equality, span} = arity
1684 fun equality{tycon, stamp, arity, equality, span} = equality
1685 fun span {tycon, stamp, arity, equality, span} = span
1686 fun tycon {tycon, stamp, arity, equality, span} = tycon
1687
1688 fun toString{tycon, stamp, arity, equality, span} = TyCon.toString tycon
1689
1690
1691 (* Ordering *)
1692
1693 fun compare(t1: TyName, t2: TyName) = Stamp.compare(#stamp t1, #stamp t2)
1694
1695 end
1696(* stop of TyName.sml *)
1697(* start of SCON.sml *)
1698(*
1699 * Standard ML special constants
1700 *
1701 * Definition, section 2.2
1702 *)
1703
1704
1705signature SCON =
1706 sig
1707
1708 (* Type [Section 2.2] *)
1709
1710 datatype SCon = (* [scon] *)
1711 INT of int
1712 | WORD of word
1713 | STRING of string
1714 | CHAR of char
1715 | REAL of real
1716
1717 (* Operations *)
1718
1719 val fromInt: int -> SCon
1720 val fromWord: word -> SCon
1721 val fromString: string -> SCon
1722 val fromChar: char -> SCon
1723 val fromReal: real -> SCon
1724
1725 val toString: SCon -> string
1726
1727 val compare: SCon * SCon -> order
1728
1729 end
1730(* stop of SCON.sml *)
1731(* start of SCon.sml *)
1732(*
1733 * Standard ML special constants
1734 *
1735 * Definition, section 2.2
1736 *)
1737
1738
1739structure SCon :> SCON =
1740 struct
1741
1742 (* Type [Section 2.2] *)
1743
1744 datatype SCon = (* [scon] *)
1745 INT of int
1746 | WORD of word
1747 | STRING of string
1748 | CHAR of char
1749 | REAL of real
1750
1751
1752 (* Conversions *)
1753
1754 val fromInt = INT
1755 val fromWord = WORD
1756 val fromString = STRING
1757 val fromChar = CHAR
1758 val fromReal = REAL
1759
1760 fun toString(INT i) = Int.toString i
1761 | toString(WORD w) = "0wx" ^ Word.toString w
1762 | toString(STRING s) = "\"" ^ String.toCString s ^ "\""
1763 | toString(CHAR c) = "\"#" ^ Char.toCString c ^ "\""
1764 | toString(REAL r) = Real.toString r
1765
1766
1767 (* Ordering *)
1768
1769 fun compare(INT n1, INT n2) = Int.compare(n1, n2)
1770 | compare(WORD w1, WORD w2) = Word.compare(w1, w2)
1771 | compare(STRING s1, STRING s2) = String.compare(s1, s2)
1772 | compare(CHAR c1, CHAR c2) = Char.compare(c1, c2)
1773 | compare(REAL x1, REAL x2) = Real.compare(x1, x2)
1774 | compare _ = raise Domain
1775
1776 end
1777(* stop of SCon.sml *)
1778(* start of LAB.sml *)
1779(*
1780 * Standard ML label identifiers
1781 *
1782 * Definition, section 2.4
1783 *)
1784
1785
1786signature LAB =
1787 sig
1788
1789 (* Type [Section 2.4] *)
1790
1791 eqtype Lab (* [lab] *)
1792
1793
1794 (* Operations *)
1795
1796 val fromString: string -> Lab
1797 val fromInt: int -> Lab
1798 val toString: Lab -> string
1799
1800 val compare: Lab * Lab -> order
1801
1802 end
1803(* stop of LAB.sml *)
1804(* start of Lab.sml *)
1805(*
1806 * Standard ML label identifiers
1807 *
1808 * Definition, section 2.4
1809 *)
1810
1811
1812structure Lab :> LAB =
1813 struct
1814
1815 (* Type [Section 2.4] *)
1816
1817 type Lab = string (* [lab] *)
1818
1819
1820 (* Conversions *)
1821
1822 fun fromString s = s
1823 val fromInt = Int.toString
1824 fun toString s = s
1825
1826
1827 (* Ordering *)
1828
1829 fun compare(lab1,lab2) =
1830 case (Int.fromString lab1, Int.fromString lab2)
1831 of (SOME i1, SOME i2) => Int.compare(i1,i2)
1832 | _ => String.compare(lab1,lab2)
1833
1834 end
1835(* stop of Lab.sml *)
1836(* start of AssembliesCoreStatic.sml *)
1837(*
1838 * Standard ML sets and maps for the static semantics of the core
1839 *
1840 * Definition, section 4.2
1841 *)
1842
1843structure TyVarSet = FinSetFn(type ord_key = TyVar.TyVar
1844 val compare = TyVar.compare)
1845
1846structure TyNameSet = FinSetFn(type ord_key = TyName.TyName
1847 val compare = TyName.compare)
1848
1849structure SConSet = FinSetFn(type ord_key = SCon.SCon
1850 val compare = SCon.compare)
1851
1852structure VIdSet = FinSetFn(type ord_key = VId.Id
1853 val compare = VId.compare)
1854
1855structure LongVIdSet = FinSetFn(type ord_key = LongVId.longId
1856 val compare = LongVId.compare)
1857
1858
1859structure LabMap = FinMapFn(type ord_key = Lab.Lab
1860 val compare = Lab.compare)
1861
1862structure VIdMap = FinMapFn(type ord_key = VId.Id
1863 val compare = VId.compare)
1864
1865structure TyConMap = FinMapFn(type ord_key = TyCon.Id
1866 val compare = TyCon.compare)
1867
1868structure TyVarMap = FinMapFn(type ord_key = TyVar.TyVar
1869 val compare = TyVar.compare)
1870
1871structure TyNameMap = FinMapFn(type ord_key = TyName.TyName
1872 val compare = TyName.compare)
1873
1874structure StrIdMap = FinMapFn(type ord_key = StrId.Id
1875 val compare = StrId.compare)
1876(* stop of AssembliesCoreStatic.sml *)
1877(* start of OVERLOADINGCLASS.sml *)
1878(*
1879 * Standard ML overloading classes
1880 *
1881 * Definition, appendix E
1882 *
1883 * Note:
1884 * Overloading -- and defaulting in particular -- is not well formalised in
1885 * the Definition. We describe an overloading class as a pair (T,t) of a set
1886 * of type names (like the definition does), plus the default type name t.
1887 * For overloading to be sound some well-formedness properties have to be
1888 * enforced for all existing overloading classes (T,t):
1889 * (1) t elem T
1890 * (2) Eq T = 0 \/ t admits equality
1891 * (3) forall (T',t') . ( TT' = 0 \/ t = t' )
1892 * where Eq T = { t elem T | t admits equality } and we write TT' for the
1893 * T intersect T' and 0 for the empty set.
1894 * The reason for (1) is obvious. (2) guarantees that we do not loose the
1895 * default if we enforce equality. (3) ensures the same if we have to unify
1896 * two overloading classes. (2) and (3) also allow the resulting set to become
1897 * empty which will cause a type error.
1898 *)
1899
1900signature OVERLOADINGCLASS =
1901 sig
1902
1903 (* Import types *)
1904
1905 type TyName = TyName.TyName
1906 type TyNameSet = TyNameSet.set
1907
1908
1909 (* Type *)
1910
1911 type OverloadingClass (* [O] *)
1912
1913
1914 (* Operations *)
1915
1916 val make: TyNameSet * TyName -> OverloadingClass
1917
1918 val isEmpty: OverloadingClass -> bool
1919 val isSingular: OverloadingClass -> bool
1920 val default: OverloadingClass -> TyName
1921 val set: OverloadingClass -> TyNameSet
1922 val member: OverloadingClass * TyName -> bool
1923 val getItem: OverloadingClass -> TyName
1924
1925 val makeEquality: OverloadingClass -> OverloadingClass option
1926 val intersection: OverloadingClass * OverloadingClass ->
1927 OverloadingClass option
1928 val union: OverloadingClass * OverloadingClass ->
1929 OverloadingClass
1930
1931 end
1932(* stop of OVERLOADINGCLASS.sml *)
1933(* start of OverloadingClass.sml *)
1934(*
1935 * Standard ML overloading classes
1936 *
1937 * Definition, appendix E
1938 *
1939 * Note:
1940 * Overloading -- and defaulting in particular -- is not well formalised in
1941 * the Definition. We describe an overloading class as a pair (T,t) of a set
1942 * of type names (like the definition does), plus the default type name t.
1943 * For overloading to be sound some well-formedness properties have to be
1944 * enforced for all existing overloading classes (T,t):
1945 * (1) t elem T
1946 * (2) Eq T = 0 \/ t admits equality
1947 * (3) forall (T',t') . ( TT' = 0 \/ t = t' )
1948 * where Eq T = { t elem T | t admits equality } and we write TT' for the
1949 * T intersect T' and 0 for the empty set.
1950 * The reason for (1) is obvious. (2) guarantees that we do not loose the
1951 * default if we enforce equality. (3) ensures the same if we have to unify
1952 * two overloading classes. (2) and (3) also allow the resulting set to become
1953 * empty which will cause a type error.
1954 *)
1955
1956structure OverloadingClass :> OVERLOADINGCLASS =
1957 struct
1958
1959 (* Import types *)
1960
1961 type TyName = TyName.TyName
1962 type TyNameSet = TyNameSet.set
1963
1964
1965 (* Type *)
1966
1967 type OverloadingClass = TyNameSet * TyName (* [O] *)
1968
1969
1970 (* Simple operations *)
1971
1972 fun make O = O
1973
1974 fun isEmpty (T,t) = TyNameSet.isEmpty T
1975 fun isSingular (T,t) = TyNameSet.numItems T = 1
1976 fun default (T,t) = t
1977 fun set (T,t) = T
1978 fun member((T,t), t') = TyNameSet.member(T, t')
1979 fun getItem (T,t) = valOf(TyNameSet.find (fn _ => true) T)
1980
1981
1982 (* Filter equality types *)
1983
1984 fun makeEquality (T,t) =
1985 let
1986 val T' = TyNameSet.filter (fn t => TyName.equality t = TyName.EQ) T
1987 in
1988 if TyNameSet.isEmpty T' then
1989 NONE
1990 else if TyName.equality t <> TyName.NOEQ then
1991 SOME(T',t)
1992 else
1993 raise Fail "OverloadingClass.makeEquality: \
1994 \inconsistent overloading classes"
1995 end
1996
1997
1998 (* Intersection and union *)
1999
2000 fun intersection((T1,t1), (T2,t2)) =
2001 let
2002 val T' = TyNameSet.intersection(T1,T2)
2003 in
2004 if TyNameSet.isEmpty T' then
2005 NONE
2006 else if t1 = t2 then
2007 SOME(T',t1)
2008 else
2009 raise Fail "OverloadingClass.intersect: \
2010 \inconsistent overloading classes"
2011 end
2012
2013
2014 fun union((T1,t1), (T2,t2)) = ( TyNameSet.union(T1,T2), t2 )
2015
2016 end
2017(* stop of OverloadingClass.sml *)
2018(* start of TYPE.sml *)
2019(*
2020 * Standard ML types
2021 *
2022 * Definition, section 4.2 and 4.4
2023 *
2024 * Notes:
2025 * - Types are references so that unification can work via side effects.
2026 * We need links (forwards) to unify two type variables.
2027 * - Types built bottom-up have to be `normalised' to induce the required
2028 * sharing on type variables.
2029 * - Care has to be taken to clone types at the proper places.
2030 * - Substitution creates a clone, but shares free type variables.
2031 * - To represent overloaded type (variables), we add a special type.
2032 * - Record types may contain a row variable to represent open record types
2033 * (which appear during type inference). Flexible rows have to carry an
2034 * equality flag to properly propagate equality enforced by unification
2035 * when extending a row.
2036 *)
2037
2038signature TYPE =
2039 sig
2040
2041 (* Import types *)
2042
2043 type Lab = Lab.Lab
2044 type TyVar = TyVar.TyVar
2045 type TyVarSet = TyVarSet.set
2046 type TyName = TyName.TyName
2047 type TyNameSet = TyNameSet.set
2048 type OverloadingClass = OverloadingClass.OverloadingClass
2049 type 'a LabMap = 'a LabMap.map
2050 type 'a TyVarMap = 'a TyVarMap.map
2051 type 'a TyNameMap = 'a TyNameMap.map
2052
2053
2054 (* Types [Section 4.2] *)
2055
2056 datatype RowVar = CLOSEDRow | FLEXRow of bool (* [r] *)
2057
2058 datatype Type' = (* [tau] *)
2059 TyVar of TyVar
2060 | RowType of (*RowType*) (Type' ref LabMap * RowVar)
2061 | FunType of (*FunType*) (Type' ref * Type' ref)
2062 | ConsType of (*ConsType*)(Type' ref list * TyName)
2063 | Overloaded of OverloadingClass
2064 | Link of (*Type*) Type' ref
2065
2066 type Type = Type' ref
2067
2068 type RowType = Type LabMap * RowVar (* [rho] *)
2069 type FunType = Type * Type
2070 type ConsType = Type list * TyName
2071
2072 type TypeFcn = TyVar list * Type (* [theta] *)
2073
2074 type Substitution = Type TyVarMap (* [mu] *)
2075 type Realisation = TypeFcn TyNameMap (* [phi] *)
2076
2077
2078 (* Operations *)
2079
2080 val invent: unit -> Type
2081 val fromTyVar: TyVar -> Type
2082 val fromRowType: RowType -> Type
2083 val fromFunType: FunType -> Type
2084 val fromConsType: ConsType -> Type
2085 val fromOverloadingClass: OverloadingClass -> Type
2086
2087 val range: Type -> Type
2088 val tyname: Type -> TyName
2089
2090 val normalise: Type -> Type
2091 val substitute: Substitution -> Type -> Type
2092 val realise: Realisation -> Type -> Type
2093
2094 val tyvars: Type -> TyVarSet
2095 val tynames: Type -> TyNameSet
2096 val admitsEquality: Type -> bool
2097 val isFlexible: Type -> bool
2098
2099 exception Unify
2100 val unify: Type * Type -> unit (* Unify *)
2101 val unifyRestricted: TyVarSet -> Type * Type -> unit (* Unify *)
2102 val makeEquality: Type -> unit (* Unify *)
2103
2104 val defaultOverloaded: Type -> unit
2105
2106
2107 (* Operations on rows *)
2108
2109 val emptyRho: RowType
2110 val singletonRho: Lab * Type -> RowType
2111 val insertRho: RowType * Lab * Type -> RowType
2112 val inventRho: unit -> RowType
2113 val findLab: RowType * Lab -> Type option
2114
2115 end
2116(* stop of TYPE.sml *)
2117(* start of Type.sml *)
2118(*
2119 * Standard ML types
2120 *
2121 * Definition, section 4.2 and 4.4
2122 *
2123 * Notes:
2124 * - Types are references so that unification can work via side effects.
2125 * We need links (forwards) to unify two type variables.
2126 * - Types built bottom-up have to be `normalised' to induce the required
2127 * sharing on type variables.
2128 * - Care has to be taken to clone types at the proper places.
2129 * - Substitution creates a clone, but shares free type variables.
2130 * - To represent overloaded type (variables), we add a special type.
2131 * - Record types may contain a row variable to represent open record types
2132 * (which appear during type inference). Flexible rows have to carry an
2133 * equality flag to properly propagate equality enforced by unification
2134 * when extending a row.
2135 *)
2136
2137structure Type :> TYPE =
2138 struct
2139
2140 (* Import types *)
2141
2142 type Lab = Lab.Lab
2143 type TyVar = TyVar.TyVar
2144 type TyVarSet = TyVarSet.set
2145 type TyName = TyName.TyName
2146 type TyNameSet = TyNameSet.set
2147 type OverloadingClass = OverloadingClass.OverloadingClass
2148 type 'a LabMap = 'a LabMap.map
2149 type 'a TyVarMap = 'a TyVarMap.map
2150 type 'a TyNameMap = 'a TyNameMap.map
2151
2152
2153 (* Types [Section 4.2] *)
2154
2155 datatype RowVar = CLOSEDRow | FLEXRow of bool (* [r] *)
2156
2157 datatype Type' = (* [tau] *)
2158 TyVar of TyVar
2159 | RowType of RowType
2160 | FunType of FunType
2161 | ConsType of ConsType
2162 | Overloaded of OverloadingClass
2163 | Link of Type
2164
2165 withtype Type = Type' ref
2166
2167 and RowType = Type' ref LabMap * RowVar (* [rho] *)
2168 and FunType = Type' ref * Type' ref
2169 and ConsType = Type' ref list * TyName
2170
2171 type TypeFcn = TyVar list * Type (* [theta] *)
2172
2173 type Substitution = Type TyVarMap (* [mu] *)
2174 type Realisation = TypeFcn TyNameMap (* [phi] *)
2175
2176
2177 (* Creation *)
2178
2179 fun invent() = ref(TyVar(TyVar.invent false))
2180
2181 fun fromTyVar alpha = ref(TyVar alpha)
2182 fun fromRowType rho = ref(RowType rho)
2183 fun fromFunType x = ref(FunType x)
2184 fun fromConsType x = ref(ConsType x)
2185 fun fromOverloadingClass O = ref(Overloaded O)
2186
2187
2188 (* Projections *)
2189
2190 fun range(ref(FunType(tau1,tau2))) = tau2
2191 | range tau = tau
2192
2193 fun tyname(ref(ConsType(taus,t))) = t
2194 | tyname _ =
2195 raise Fail "Type.tyname: non-constructed type"
2196
2197
2198 (* Induce sharing on equal type variables in a type *)
2199
2200 fun normalise tau =
2201 let
2202 (* Note that Overloaded nodes also have to be shared.
2203 * But since such types are always pre-built rather than
2204 * infered, we just take care that we construct them with
2205 * proper sharing and ignore Overloaded nodes here.
2206 *)
2207
2208 val alphas = ref []
2209
2210 fun normalise(tau as ref(TyVar(alpha))) =
2211 (case List.find (fn(alpha1,_) => alpha1 = alpha) (!alphas)
2212 of SOME(_,tau1) => tau1
2213 | NONE => ( alphas := (alpha,tau) :: !alphas
2214 ; tau
2215 )
2216 )
2217 | normalise(ref(Link(tau))) = normalise tau
2218 | normalise(tau as ref tau') = ( tau := normalise' tau' ; tau )
2219
2220 and normalise'(RowType(Rho,r)) =
2221 RowType(LabMap.map normalise Rho, r)
2222
2223 | normalise'(FunType(tau1,tau2)) =
2224 FunType(normalise tau1, normalise tau2)
2225
2226 | normalise'(ConsType(taus,t)) =
2227 ConsType(List.map normalise taus, t)
2228
2229 | normalise'(Overloaded(O)) =
2230 Overloaded(O)
2231
2232 | normalise' _ =
2233 raise Fail "Type.normalise: bypassed type variable or link"
2234 in
2235 normalise tau
2236 end
2237
2238
2239
2240 (* Cloning under a substitution and a type realisation *)
2241
2242 fun clone (mu,phi) tau =
2243 let
2244 (* Cloning must respect sharing, so an association list is used
2245 * to remember nodes already visited together with their copy.
2246 *)
2247
2248 val mu' = ref mu
2249 val cloned = ref []
2250
2251 fun clone tau =
2252 case List.find (fn(tau1,_) => tau1 = tau) (!cloned)
2253 of SOME(_,tau2) => tau2
2254 | NONE => let val tau2 = clone' tau in
2255 cloned := (tau,tau2) :: !cloned
2256 ; tau2
2257 end
2258
2259 and clone'(tau as ref(TyVar(alpha))) =
2260 (case TyVarMap.find(!mu', alpha)
2261 of NONE => tau
2262 | SOME tau => tau
2263 )
2264 | clone'(ref(RowType(Rho,r))) =
2265 ref(RowType(LabMap.map clone Rho, r))
2266
2267 | clone'(ref(FunType(tau1,tau2))) =
2268 ref(FunType(clone tau1, clone tau2))
2269
2270 | clone'(tau as ref(ConsType(taus,t))) =
2271 let
2272 val taus2 = List.map clone taus
2273 in
2274 case TyNameMap.find(phi, t)
2275 of NONE => ref(ConsType(taus2,t))
2276 | SOME(alphas,tau1) =>
2277 let
2278 val cloned' = !cloned
2279 in
2280 mu' := ListPair.foldl
2281 (fn(alpha,tau2,mu) =>
2282 TyVarMap.insert(mu,alpha,tau2))
2283 (!mu') (alphas,taus2)
2284 ; clone' tau1
2285 before cloned := cloned'
2286 end
2287 end
2288
2289 | clone'(ref(Overloaded(O))) =
2290 ref(Overloaded(O))
2291
2292 | clone'(ref(Link(tau))) =
2293 clone tau
2294 in
2295 clone tau
2296 end
2297
2298
2299 (* Substitution, and realisation [Section 5.2] *)
2300
2301 fun substitute mu = clone(mu,TyNameMap.empty)
2302 fun realise phi = clone(TyVarMap.empty,phi)
2303
2304
2305 (* Type variable and type name extraction [Section 4.2] *)
2306
2307 fun tyvars(ref tau') = tyvars' tau'
2308
2309 and tyvars'(TyVar(alpha)) = TyVarSet.singleton alpha
2310
2311 | tyvars'(RowType(Rho,r)) =
2312 LabMap.foldl (fn(tau,U) => TyVarSet.union(U, tyvars tau))
2313 TyVarSet.empty Rho
2314
2315 | tyvars'(FunType(tau1,tau2)) =
2316 TyVarSet.union(tyvars tau1, tyvars tau2)
2317
2318 | tyvars'(ConsType(taus,t)) =
2319 List.foldl (fn(tau,U) => TyVarSet.union(U, tyvars tau))
2320 TyVarSet.empty taus
2321
2322 | tyvars'(Overloaded(O)) =
2323 TyVarSet.empty
2324
2325 | tyvars'(Link(tau)) =
2326 tyvars tau
2327
2328
2329 fun tynames(ref tau') = tynames' tau'
2330
2331 and tynames'(TyVar(alpha)) = TyNameSet.empty
2332
2333 | tynames'(RowType(Rho,r)) =
2334 LabMap.foldl (fn(tau,T) =>
2335 TyNameSet.union(T, tynames tau)) TyNameSet.empty Rho
2336
2337 | tynames'(FunType(tau1,tau2)) =
2338 TyNameSet.union(tynames tau1, tynames tau2)
2339
2340 | tynames'(ConsType(taus,t)) =
2341 let
2342 val T = List.foldl (fn(tau,T) => TyNameSet.union(T, tynames tau))
2343 TyNameSet.empty taus
2344 in
2345 TyNameSet.add(T, t)
2346 end
2347
2348 | tynames'(Overloaded(O)) =
2349 (* Conservative approximation *)
2350 OverloadingClass.set O
2351
2352 | tynames'(Link(tau)) =
2353 tynames tau
2354
2355
2356
2357 (* Check for equality type [Section 4.4] *)
2358
2359 fun admitsEquality(ref tau') = admitsEquality' tau'
2360
2361 and admitsEquality'(TyVar alpha) =
2362 TyVar.admitsEquality alpha orelse
2363 not(TyVar.isExplicit alpha)
2364
2365 | admitsEquality'(RowType(Rho,CLOSEDRow)) =
2366 LabMap.all admitsEquality Rho
2367
2368 | admitsEquality'(RowType(Rho,FLEXRow _)) =
2369 raise Fail "Type.admitsEquality: flexible row"
2370
2371 | admitsEquality'(FunType _) = false
2372
2373 | admitsEquality'(ConsType(taus,t)) =
2374 (case TyName.equality t
2375 of TyName.SPECIALEQ => true
2376 | TyName.EQ => List.all admitsEquality taus
2377 | TyName.NOEQ => false
2378 )
2379
2380 | admitsEquality'(Overloaded(O)) =
2381 raise Fail "Type.admitsEquality: overloaded type"
2382
2383 | admitsEquality'(Link(tau)) =
2384 admitsEquality tau
2385
2386
2387
2388 (* Look for flexible records *)
2389
2390 fun isFlexible(ref tau') = isFlexible' tau'
2391
2392 and isFlexible'(TyVar(alpha')) = false
2393
2394 | isFlexible'(RowType(Rho,r)) =
2395 r <> CLOSEDRow orelse LabMap.exists isFlexible Rho
2396
2397 | isFlexible'(FunType(tau1,tau2)) =
2398 isFlexible tau1 orelse isFlexible tau2
2399
2400 | isFlexible'(ConsType(taus,t)) =
2401 List.exists isFlexible taus
2402
2403 | isFlexible'(Overloaded(O)) = false
2404
2405 | isFlexible'(Link(tau)) = isFlexible tau
2406
2407
2408
2409 (* Unification *)
2410
2411 exception Unify
2412
2413
2414 fun occurs(alpha, ref tau') = occurs'(alpha, tau')
2415
2416 and occurs'(alpha, TyVar(alpha')) =
2417 alpha = alpha'
2418
2419 | occurs'(alpha, RowType(Rho,r)) =
2420 LabMap.exists (fn tau => occurs(alpha, tau)) Rho
2421
2422 | occurs'(alpha, FunType(tau1,tau2)) =
2423 occurs(alpha, tau1) orelse occurs(alpha, tau2)
2424
2425 | occurs'(alpha, ConsType(taus,t)) =
2426 List.exists (fn tau => occurs(alpha, tau)) taus
2427
2428 | occurs'(alpha, Overloaded(O)) =
2429 false
2430
2431 | occurs'(alpha, Link(tau)) =
2432 occurs(alpha, tau)
2433
2434
2435 fun unify(ref(Link(tau1)), tau2) = unify(tau1, tau2)
2436 | unify(tau1, ref(Link(tau2))) = unify(tau1, tau2)
2437
2438 | unify(tau1 as ref tau1', tau2 as ref tau2') =
2439 if tau1 = tau2 then () else
2440 let
2441 val tau' = Link(ref(unify'(tau1',tau2')))
2442 in
2443 tau1 := tau' ; tau2 := tau'
2444 end
2445
2446 and unify'(TyVar(alpha), tau') = unifyTyVar(alpha, tau')
2447 | unify'(tau', TyVar(alpha)) = unifyTyVar(alpha, tau')
2448 | unify'(Overloaded(O), tau') = unifyOverloaded(O, tau')
2449 | unify'(tau', Overloaded(O)) = unifyOverloaded(O, tau')
2450
2451 | unify'(tau' as FunType(tau11,tau12), FunType(tau21,tau22)) =
2452 ( unify(tau11,tau21)
2453 ; unify(tau12,tau22)
2454 ; tau'
2455 )
2456
2457 | unify'(RowType(Rho1,r1), RowType(Rho2,r2)) =
2458 let
2459 fun unifyField r (lab, tau1, Rho) =
2460 case LabMap.find(Rho, lab)
2461 of SOME tau2 => ( unify(tau1,tau2)
2462 ; #1(LabMap.remove(Rho,lab))
2463 )
2464 | NONE =>
2465 case r
2466 of CLOSEDRow => raise Unify
2467 | FLEXRow eq => ( if eq then makeEquality tau1 else ()
2468 ; Rho
2469 )
2470
2471 val Rho1' = LabMap.foldli (unifyField r1) Rho1 Rho2
2472 val _ = LabMap.foldli (unifyField r2) Rho2 Rho1'
2473 val r = case (r1,r2)
2474 of (CLOSEDRow, _) => CLOSEDRow
2475 | (_, CLOSEDRow) => CLOSEDRow
2476 | (FLEXRow eq1, FLEXRow eq2) =>
2477 FLEXRow(eq1 orelse eq2)
2478 in
2479 RowType(LabMap.unionWith #2 (Rho2,Rho1'), r)
2480 end
2481
2482
2483 | unify'(tau' as ConsType(taus1,t1), ConsType(taus2,t2)) =
2484 if t1 = t2 then
2485 ( ListPair.app unify (taus1,taus2)
2486 ; tau'
2487 )
2488 else
2489 raise Unify
2490
2491 | unify' _ = raise Unify
2492
2493
2494 and unifyTyVar(alpha1, TyVar(alpha2)) =
2495 if alpha1 = alpha2 then
2496 TyVar(alpha2)
2497 else if not(TyVar.isExplicit alpha1) then
2498 bindTyVar(alpha1, TyVar(alpha2))
2499 else if not(TyVar.isExplicit alpha2) then
2500 bindTyVar(alpha2, TyVar(alpha1))
2501 else
2502 raise Unify
2503
2504 | unifyTyVar(alpha, tau') =
2505 if TyVar.isExplicit alpha orelse occurs'(alpha, tau') then
2506 raise Unify
2507 else
2508 bindTyVar(alpha, tau')
2509
2510 and bindTyVar(alpha, tau') =
2511 if TyVar.admitsEquality alpha then
2512 makeEquality' tau'
2513 else
2514 tau'
2515
2516
2517 and unifyOverloaded(O, TyVar(alpha2)) =
2518 unifyTyVar(alpha2, Overloaded(O))
2519
2520 | unifyOverloaded(O, tau' as ConsType([],t)) =
2521 if OverloadingClass.member(O, t) then
2522 tau'
2523 else
2524 raise Unify
2525
2526 | unifyOverloaded(O1, Overloaded(O2)) =
2527 (case OverloadingClass.intersection(O1,O2)
2528 of NONE => raise Unify
2529 | SOME O => Overloaded(O)
2530 )
2531
2532 | unifyOverloaded(O, _) =
2533 raise Unify
2534
2535
2536 and makeEquality(tau as ref tau') = tau := makeEquality' tau'
2537
2538 and makeEquality'(TyVar(alpha)) =
2539 if TyVar.admitsEquality alpha then
2540 TyVar(alpha)
2541 else if TyVar.isExplicit alpha then
2542 raise Unify
2543 else
2544 TyVar(TyVar.invent true)
2545
2546 | makeEquality'(RowType(Rho,r)) =
2547 ( LabMap.app makeEquality Rho
2548 ; RowType(Rho, case r of CLOSEDRow => CLOSEDRow
2549 | FLEXRow _ => FLEXRow true)
2550 )
2551
2552 | makeEquality'(FunType _) =
2553 raise Unify
2554
2555 | makeEquality'(tau' as ConsType(taus,t)) =
2556 (case TyName.equality t
2557 of TyName.SPECIALEQ => tau'
2558 | TyName.EQ => ( List.app makeEquality taus ; tau' )
2559 | TyName.NOEQ => raise Unify
2560 )
2561
2562 | makeEquality'(Overloaded(O)) =
2563 (case OverloadingClass.makeEquality O
2564 of NONE => raise Unify
2565 | SOME O' => Overloaded(O')
2566 )
2567 | makeEquality'(Link(tau)) =
2568 ( makeEquality tau ; Link(tau) )
2569
2570
2571
2572 fun unifyRestricted U (tau1,tau2) =
2573 let
2574 fun skolemise(alpha, mu) =
2575 let
2576 val equality = if TyVar.admitsEquality alpha then TyName.EQ
2577 else TyName.NOEQ
2578 val tau' = ConsType([], TyName.invent(0,equality))
2579 in
2580 TyVarMap.insert(mu, alpha, ref tau')
2581 end
2582
2583 val mu = TyVarSet.foldl skolemise TyVarMap.empty U
2584 in
2585 unify(substitute mu tau1, substitute mu tau2)
2586 end
2587
2588
2589
2590 (* Assign default type to overloaded type components [Appendix E] *)
2591
2592 fun defaultOverloaded(tau as ref(Overloaded(O))) =
2593 tau := ConsType([], OverloadingClass.default O)
2594
2595 | defaultOverloaded(ref tau') = defaultOverloaded' tau'
2596
2597 and defaultOverloaded'(TyVar(alpha')) = ()
2598
2599 | defaultOverloaded'(RowType(Rho,r)) =
2600 LabMap.app defaultOverloaded Rho
2601
2602 | defaultOverloaded'(FunType(tau1,tau2)) =
2603 ( defaultOverloaded tau1 ; defaultOverloaded tau2 )
2604
2605 | defaultOverloaded'(ConsType(taus,t)) =
2606 List.app defaultOverloaded taus
2607
2608 | defaultOverloaded'(Overloaded(O)) =
2609 raise Fail "Type.defaultOverloaded: bypassed overloaded type"
2610
2611 | defaultOverloaded'(Link(tau)) =
2612 defaultOverloaded tau
2613
2614
2615
2616 (* Operations on rows *)
2617
2618 val emptyRho = ( LabMap.empty, CLOSEDRow )
2619 fun singletonRho(lab,tau) = ( LabMap.singleton(lab,tau), CLOSEDRow )
2620 fun inventRho() = ( LabMap.empty, FLEXRow false )
2621 fun insertRho((Rho,r), lab, tau) = ( LabMap.insert(Rho, lab, tau), r )
2622 fun findLab((Rho,r), lab) = LabMap.find(Rho, lab)
2623
2624 end
2625(* stop of Type.sml *)
2626(* start of TYPESCHEME.sml *)
2627(*
2628 * Standard ML type schemes
2629 *
2630 * Definition, section 4.2, 4.5, and 4.8
2631 *
2632 * Note:
2633 * Instantiation copies a type (except free type variables).
2634 * Closure does not!
2635 *)
2636
2637signature TYPESCHEME =
2638 sig
2639
2640 (* Import types *)
2641
2642 type Type = Type.Type
2643 type TyVar = TyVar.TyVar
2644 type TyVarSet = TyVarSet.set
2645 type TyName = TyName.TyName
2646 type TyNameSet = TyNameSet.set
2647 type Substitution = Type.Substitution
2648 type Realisation = Type.Realisation
2649 type 'a TyNameMap = 'a TyNameMap.map
2650
2651
2652 (* Type [Section 4.2] *)
2653
2654 type TypeScheme = TyVar list * Type (* [sigma] *)
2655
2656
2657 (* Operations *)
2658
2659 val instance: TypeScheme -> Type
2660 val instance': TypeScheme -> TyVar list * Type
2661 val Clos: Type -> TypeScheme
2662 val ClosRestricted: TyVarSet -> Type -> TypeScheme
2663 val isClosed: TypeScheme -> bool
2664
2665 val tyvars: TypeScheme -> TyVarSet
2666 val tynames: TypeScheme -> TyNameSet
2667 val normalise: TypeScheme -> TypeScheme
2668
2669 val generalises: TypeScheme * TypeScheme -> bool
2670 val equals: TypeScheme * TypeScheme -> bool
2671
2672 val substitute: Substitution -> TypeScheme -> TypeScheme
2673 val realise: Realisation -> TypeScheme -> TypeScheme
2674
2675 end
2676(* stop of TYPESCHEME.sml *)
2677(* start of TypeScheme.sml *)
2678(*
2679 * Standard ML type schemes
2680 *
2681 * Definition, section 4.2, 4.5, and 4.8
2682 *
2683 * Note:
2684 * Instantiation copies a type (except free type variables).
2685 * Closure does not!
2686 *)
2687
2688structure TypeScheme :> TYPESCHEME =
2689 struct
2690
2691 (* Import types *)
2692
2693 type Type = Type.Type
2694 type TyVar = TyVar.TyVar
2695 type TyVarSet = TyVarSet.set
2696 type TyName = TyName.TyName
2697 type TyNameSet = TyNameSet.set
2698 type Substitution = Type.Substitution
2699 type Realisation = Type.Realisation
2700 type 'a TyNameMap = 'a TyNameMap.map
2701
2702
2703 (* Type [Section 4.2] *)
2704
2705 type TypeScheme = TyVar list * Type (* [sigma] *)
2706
2707
2708 (* Some helper (this should be in the library...) *)
2709
2710 fun List_foldri f y0 xs =
2711 let
2712 fun fold(n, []) = y0
2713 | fold(n, x::xs) = f(n, x, fold(n+1,xs))
2714 in
2715 fold(0,xs)
2716 end
2717
2718
2719
2720 (* Type variable and type name extraction [Section 4.2] *)
2721
2722 fun tyvars (alphas,tau) =
2723 let
2724 val U = Type.tyvars tau
2725 in
2726 List.foldl
2727 (fn(alpha,U) => TyVarSet.delete(U,alpha)
2728 handle LibBase.NotFound => U)
2729 U alphas
2730 end
2731
2732 fun tynames (alphas,tau) = Type.tynames tau
2733
2734
2735
2736 (* Instantiation *)
2737
2738 fun instance' (alphas,tau) =
2739 let
2740 val alphas' = List.map TyVar.instance alphas
2741 val mu = ListPair.foldl
2742 (fn(alpha, alpha', mu) =>
2743 TyVarMap.insert(mu, alpha, Type.fromTyVar alpha'))
2744 TyVarMap.empty (alphas, alphas')
2745 in
2746 ( alphas', Type.substitute mu tau )
2747 end
2748
2749 fun instance sigma = #2(instance' sigma)
2750
2751
2752
2753 (* Generalisation [Section 4.5] *)
2754
2755 fun generalisesType(sigma, tau) =
2756 let
2757 val U = Type.tyvars tau
2758 in
2759 ( Type.unifyRestricted U (instance sigma, tau) ; true )
2760 handle Type.Unify => false
2761 end
2762
2763 fun generalises(sigma1, sigma2) =
2764 generalisesType(sigma1, instance sigma2)
2765
2766
2767
2768 (* Closure [Section 4.8] *)
2769
2770 fun Clos tau =
2771 (* Does not copy! *)
2772 ( TyVarSet.listItems(Type.tyvars tau), tau )
2773
2774 fun ClosRestricted U tau =
2775 ( TyVarSet.listItems(TyVarSet.difference(Type.tyvars tau, U)), tau )
2776
2777 fun isClosed (alphas,tau) =
2778 TyVarSet.isSubset(Type.tyvars tau, TyVarSet.fromList alphas)
2779
2780
2781 (* Comparison [Section 4.5] *)
2782
2783 fun equals((alphas1,tau1), (alphas2,tau2)) =
2784 List.length alphas1 = List.length alphas2 andalso
2785 let
2786 fun insert(alpha1, alpha2, mu) =
2787 TyVarMap.insert(mu, alpha1, Type.fromTyVar alpha2)
2788
2789 val (alphas2',tau2') = instance' (alphas2,tau2)
2790 val mu = ListPair.foldl insert TyVarMap.empty (alphas1,alphas2')
2791 val tau1' = Type.substitute mu tau1
2792 val U = TyVarSet.fromList alphas2'
2793 in
2794 ( Type.unifyRestricted U (tau1',tau2') ; true )
2795 handle Type.Unify => false
2796 end
2797
2798
2799 (* Normalisation (for output) *)
2800
2801 fun normalise (alphas,tau) =
2802 let
2803 fun insert(n, alpha, (alphas',mu)) =
2804 let
2805 val alpha' = TyVar.normalise(alpha, n)
2806 val tau = Type.fromTyVar alpha'
2807 in
2808 ( alpha'::alphas', TyVarMap.insert(mu, alpha,tau) )
2809 end
2810
2811 val (alphas',mu) = List_foldri insert (nil,TyVarMap.empty) alphas
2812 in
2813 ( alphas', Type.substitute mu tau )
2814 end
2815
2816
2817 (* Substitution *)
2818
2819 fun substitute mu (alphas,tau) =
2820 let
2821 val mu' = List.foldl (fn(alpha,mu) =>
2822 #1(TyVarMap.remove(mu,alpha))
2823 handle LibBase.NotFound => mu) mu alphas
2824 in
2825 ( alphas, Type.substitute mu' tau )
2826 end
2827
2828
2829 (* Realisation [Section 5.2] *)
2830
2831 fun realise phi (alphas,tau) = (alphas, Type.realise phi tau)
2832
2833 end
2834(* stop of TypeScheme.sml *)
2835(* start of TYPEFCN.sml *)
2836(*
2837 * Standard ML type functions
2838 *
2839 * Definition, section 4.2, 4.4, and 4.8
2840 *
2841 * Note:
2842 * Application copies the type (except free type variables).
2843 *)
2844
2845signature TYPEFCN =
2846 sig
2847
2848 (* Import types *)
2849
2850 type Type = Type.Type
2851 type TyVar = TyVar.TyVar
2852 type TyVarSet = TyVarSet.set
2853 type TyName = TyName.TyName
2854 type TyNameSet = TyNameSet.set
2855 type Realisation = Type.TypeFcn TyNameMap.map
2856
2857
2858 (* Type [Section 4.2] *)
2859
2860 type TypeFcn = Type.TypeFcn (* [theta] *)
2861
2862
2863 (* Operations *)
2864
2865 val fromTyName: TyName -> TypeFcn
2866 val toTyName: TypeFcn -> TyName option
2867 val isClosed: TypeFcn -> bool
2868
2869 val arity: TypeFcn -> int
2870 val admitsEquality: TypeFcn -> bool
2871
2872 val tyvars: TypeFcn -> TyVarSet
2873 val tynames: TypeFcn -> TyNameSet
2874 val normalise: TypeFcn -> TypeFcn
2875 val rename: TypeFcn -> TypeFcn
2876
2877 val equals: TypeFcn * TypeFcn -> bool
2878
2879 exception Apply
2880 val apply: Type list * TypeFcn -> Type (* may raise Apply *)
2881
2882 val realise: Realisation -> TypeFcn -> TypeFcn
2883
2884 val makeEquality: TypeFcn -> unit
2885
2886 end
2887(* stop of TYPEFCN.sml *)
2888(* start of TypeFcn.sml *)
2889(*
2890 * Standard ML type functions
2891 *
2892 * Definition, section 4.2, 4.4, and 4.8
2893 *
2894 * Note:
2895 * Application copies the type (except free type variables).
2896 *)
2897
2898structure TypeFcn :> TYPEFCN =
2899 struct
2900
2901 (* Import types *)
2902
2903 type Type = Type.Type
2904 type TyVar = TyVar.TyVar
2905 type TyVarSet = TyVarSet.set
2906 type TyName = TyName.TyName
2907 type TyNameSet = TyNameSet.set
2908 type Realisation = Type.TypeFcn TyNameMap.map
2909
2910
2911 (* Type [Section 4.2] *)
2912
2913 type TypeFcn = Type.TypeFcn (* [theta] *)
2914
2915
2916 (* Operations *)
2917
2918 val tyvars = TypeScheme.tyvars (* same type ;-) *)
2919 val tynames = TypeScheme.tynames
2920 val equals = TypeScheme.equals
2921 val isClosed = TypeScheme.isClosed
2922 val realise = TypeScheme.realise
2923 val rename = TypeScheme.instance'
2924 val normalise = TypeScheme.normalise
2925
2926
2927 (* Arity [Section 4.4] *)
2928
2929 fun arity (alphas,tau) = List.length alphas
2930
2931
2932 (* Equality [Section 4.4] *)
2933
2934 fun admitsEquality (alphas,tau) =
2935 let
2936 fun insert(alpha, mu) =
2937 TyVarMap.insert(mu, alpha, Type.fromTyVar(TyVar.invent true))
2938
2939 val mu = List.foldl insert TyVarMap.empty alphas
2940 in
2941 Type.admitsEquality(Type.substitute mu tau)
2942 end
2943
2944
2945 (* Eta-conversion [Section 4.4] *)
2946
2947 fun fromTyName t =
2948 let
2949 val alphas = List.tabulate(TyName.arity t, TyVar.fromIndex false)
2950 in
2951 ( alphas, Type.fromConsType(List.map Type.fromTyVar alphas, t) )
2952 end
2953
2954 fun toTyName(alphas, ref(Type.ConsType(taus,t))) = t
2955 | toTyName _ = raise Fail "TypeFcn.toTyName: invalid type function"
2956
2957 fun toTyName(alphas, ref(Type.ConsType(taus,t))) =
2958 let
2959 fun isSame(alpha, ref(Type.TyVar alpha')) = alpha = alpha'
2960 | isSame(alpha, _ ) = false
2961 in
2962 if List.length alphas = List.length taus
2963 andalso ListPair.all isSame (alphas, taus) then
2964 SOME t
2965 else
2966 NONE
2967 end
2968
2969 | toTyName _ = NONE
2970
2971
2972 (* Application [Section 4.4] *)
2973
2974 exception Apply
2975
2976 fun apply(taus, (alphas,tau)) =
2977 if List.length taus <> List.length alphas then raise Apply else
2978 let
2979 fun insert(alpha, tau, mu) = TyVarMap.insert(mu, alpha, tau)
2980 val mu = ListPair.foldl insert TyVarMap.empty (alphas, taus)
2981 in
2982 Type.substitute mu tau
2983 end
2984
2985
2986 (* Make it an equality type *)
2987
2988 fun makeEquality (alphas,tau) = Type.makeEquality tau
2989
2990 end
2991(* stop of TypeFcn.sml *)
2992(* start of IDSTATUS.sml *)
2993(*
2994 * Standard ML identifier status
2995 *
2996 * Definition, sections 4.1 and 5.5
2997 *)
2998
2999
3000signature IDSTATUS =
3001 sig
3002
3003 (* Type [Section 4.1] *)
3004
3005 datatype IdStatus = c | e | v (* [is] *)
3006
3007
3008 (* Operations *)
3009
3010 val generalises: IdStatus * IdStatus -> bool
3011
3012 end
3013(* stop of IDSTATUS.sml *)
3014(* start of IdStatus.sml *)
3015(*
3016 * Standard ML identifier status
3017 *
3018 * Definition, sections 4.1 and 5.5
3019 *)
3020
3021
3022structure IdStatus :> IDSTATUS =
3023 struct
3024
3025 (* Type [Section 4.1] *)
3026
3027 datatype IdStatus = c | e | v (* [is] *)
3028
3029
3030 (* Generalisation [Section 5.5] *)
3031
3032 fun generalises(is1,is2) = is1 = is2 orelse is2 = v
3033
3034 end
3035(* stop of IdStatus.sml *)
3036(* start of GENERIC_ENV.sml *)
3037(*
3038 * Standard ML generic core environment
3039 *
3040 * Definition, sections 4.2, 4.3, 6.3 and 7.2
3041 *
3042 * Notes:
3043 * - A datatype Str is necessary to break the recursion
3044 * between Env and StrEnv.
3045 * - Also, all types are parameterised over the range of value and type
3046 * environments. This is because of the recursion between values and
3047 * the dynamic environment (via function closures) -- we cannot make them
3048 * into functor parameters as this would require recursive structures.
3049 *)
3050
3051signature GENERIC_ENV =
3052 sig
3053
3054 (* Import types *)
3055
3056 type VId = VId.Id
3057 type TyCon = TyCon.Id
3058 type StrId = StrId.Id
3059 type longVId = LongVId.longId
3060 type longTyCon = LongTyCon.longId
3061 type longStrId = LongStrId.longId
3062 type IdStatus = IdStatus.IdStatus
3063
3064 type 'a VIdMap = 'a VIdMap.map
3065 type 'a TyConMap = 'a TyConMap.map
3066 type 'a StrIdMap = 'a StrIdMap.map
3067
3068
3069 (* Export types [Section 4.2 and 6.3] *)
3070
3071 datatype ('a,'b) Str' = Str of (*Env*)
3072 ('a,'b) Str' StrIdMap * 'b TyConMap * 'a VIdMap
3073
3074 type 'a ValEnv' = 'a VIdMap
3075 type 'b TyEnv' = 'b TyConMap
3076 type ('a,'b) StrEnv' = ('a,'b) Str' StrIdMap
3077
3078 type ('a,'b) Env' = ('a,'b) StrEnv' * 'b TyEnv' * 'a ValEnv'
3079
3080
3081 (* Operations *)
3082
3083 val empty: ('a,'b) Env'
3084
3085 val fromSE: ('a,'b) StrEnv' -> ('a,'b) Env'
3086 val fromTE: 'b TyEnv' -> ('a,'b) Env'
3087 val fromVE: 'a ValEnv' -> ('a,'b) Env'
3088 val fromVEandTE: 'a ValEnv' * 'b TyEnv' -> ('a,'b) Env'
3089
3090 val plus: ('a,'b) Env' * ('a,'b) Env' -> ('a,'b) Env'
3091 val plusVE: ('a,'b) Env' * 'a ValEnv' -> ('a,'b) Env'
3092 val plusTE: ('a,'b) Env' * 'b TyEnv' -> ('a,'b) Env'
3093 val plusSE: ('a,'b) Env' * ('a,'b) StrEnv' -> ('a,'b) Env'
3094 val plusVEandTE: ('a,'b) Env' * ('a ValEnv' * 'b TyEnv') -> ('a,'b) Env'
3095
3096 val findVId: ('a,'b) Env' * VId -> 'a option
3097 val findTyCon: ('a,'b) Env' * TyCon -> 'b option
3098 val findStrId: ('a,'b) Env' * StrId -> ('a,'b) Str' option
3099 val findLongVId: ('a,'b) Env' * longVId -> 'a option
3100 val findLongTyCon: ('a,'b) Env' * longTyCon -> 'b option
3101 val findLongStrId: ('a,'b) Env' * longStrId -> ('a,'b) Str' option
3102
3103 val disjoint: ('a,'b) Env' * ('a,'b) Env' -> bool
3104
3105 end
3106(* stop of GENERIC_ENV.sml *)
3107(* start of GenericEnvFn.sml *)
3108(*
3109 * Standard ML generic core environment
3110 *
3111 * Definition, sections 4.2, 4.3, 6.3 and 7.2
3112 *
3113 * Notes:
3114 * - A datatype Str is necessary to break the recursion
3115 * between Env and StrEnv.
3116 * - Also, all types are parameterised over the range of value and type
3117 * environments. This is because of the recursion between values and
3118 * the dynamic environment (via function closures) -- we cannot make them
3119 * into functor parameters as this would require recursive structures.
3120 *)
3121
3122functor GenericEnvFn() :> GENERIC_ENV =
3123 struct
3124
3125 (* Import types *)
3126
3127 type VId = VId.Id
3128 type TyCon = TyCon.Id
3129 type StrId = StrId.Id
3130 type longVId = LongVId.longId
3131 type longTyCon = LongTyCon.longId
3132 type longStrId = LongStrId.longId
3133 type IdStatus = IdStatus.IdStatus
3134
3135 type 'a VIdMap = 'a VIdMap.map
3136 type 'a TyConMap = 'a TyConMap.map
3137 type 'a StrIdMap = 'a StrIdMap.map
3138
3139
3140 (* Export types [Section 4.2 and 6.3] *)
3141
3142 datatype ('a,'b) Str' = Str of (*Env*)
3143 ('a,'b) Str' StrIdMap * 'b TyConMap * 'a VIdMap
3144
3145 type 'a ValEnv' = 'a VIdMap (* [VE] *)
3146 type 'b TyEnv' = 'b TyConMap (* [TE] *)
3147 type ('a,'b) StrEnv' = ('a,'b) Str' StrIdMap (* [SE] *)
3148
3149 type ('a,'b) Env' = ('a,'b) StrEnv' * 'b TyEnv' * 'a ValEnv' (* [E] *)
3150
3151
3152 (* Injections [Section 4.3] *)
3153
3154 val empty = ( StrIdMap.empty, TyConMap.empty, VIdMap.empty )
3155
3156 fun fromSE SE = ( SE, TyConMap.empty, VIdMap.empty )
3157 fun fromTE TE = ( StrIdMap.empty, TE, VIdMap.empty )
3158 fun fromVE VE = ( StrIdMap.empty, TyConMap.empty, VE )
3159 fun fromVEandTE(VE,TE) = ( StrIdMap.empty, TE, VE )
3160
3161
3162 (* Modifications [Section 4.3] *)
3163
3164 infix plus plusVE plusTE plusSE plusVEandTE
3165
3166 fun (SE,TE,VE) plus (SE',TE',VE') =
3167 ( StrIdMap.unionWith #2 (SE,SE')
3168 , TyConMap.unionWith #2 (TE,TE')
3169 , VIdMap.unionWith #2 (VE,VE')
3170 )
3171
3172 fun (SE,TE,VE) plusVE VE' = ( SE, TE, VIdMap.unionWith #2 (VE,VE') )
3173 fun (SE,TE,VE) plusTE TE' = ( SE, TyConMap.unionWith #2 (TE,TE'), VE )
3174 fun (SE,TE,VE) plusSE SE' = ( StrIdMap.unionWith #2 (SE,SE'), TE, VE )
3175 fun (SE,TE,VE) plusVEandTE (VE',TE') =
3176 ( SE
3177 , TyConMap.unionWith #2 (TE,TE')
3178 , VIdMap.unionWith #2 (VE,VE')
3179 )
3180
3181
3182 (* Application (lookup) [Section 4.3] *)
3183
3184 fun findVId ((SE,TE,VE), vid) = VIdMap.find(VE, vid)
3185 fun findTyCon((SE,TE,VE), tycon) = TyConMap.find(TE, tycon)
3186 fun findStrId((SE,TE,VE), strid) = StrIdMap.find(SE, strid)
3187
3188 fun findLongX'(E, findX, [], x) = findX(E, x)
3189 | findLongX'(E, findX, strid::strids, x) =
3190 Option.mapPartial (fn E => findLongX'(E, findX, strids, x))
3191 (Option.map (fn Str E => E) (findStrId(E, strid)))
3192
3193 fun findLongX (explodeLongX, findX) (E, longX) =
3194 let
3195 val (strids,x) = explodeLongX longX
3196 in
3197 findLongX'(E, findX, strids, x)
3198 end
3199
3200 fun findLongVId x = findLongX (LongVId.explode, findVId) x
3201 fun findLongTyCon x = findLongX (LongTyCon.explode, findTyCon) x
3202 fun findLongStrId x = findLongX (LongStrId.explode, findStrId) x
3203
3204
3205 (* Disjointness *)
3206
3207 fun disjoint((SE1,TE1,VE1), (SE2,TE2,VE2)) =
3208 StrIdMap.disjoint(SE1,SE2) andalso
3209 TyConMap.disjoint(TE1,TE2) andalso
3210 VIdMap.disjoint(VE1,VE2)
3211
3212 end
3213(* stop of GenericEnvFn.sml *)
3214(* start of STATIC_ENV.sml *)
3215(*
3216 * Standard ML environments of the static semantics of the core
3217 *
3218 * Definition, sections 4.2, 4.3, 4.8, 4.9, and 5.5
3219 *
3220 * Note:
3221 * We call the domain type of value environments ValStr.
3222 *)
3223
3224signature STATIC_ENV =
3225 sig
3226
3227 (* Inheritance *)
3228
3229 include GENERIC_ENV
3230
3231
3232 (* Import types *)
3233
3234 type TypeScheme = TypeScheme.TypeScheme
3235 type TypeFcn = TypeFcn.TypeFcn
3236 type TyVar = TyVar.TyVar
3237 type TyVarSet = TyVarSet.set
3238 type TyName = TyName.TyName
3239 type TyNameSet = TyNameSet.set
3240 type Realisation = Type.Realisation
3241
3242
3243 (* Export types [Section 4.2] *)
3244
3245 type ValStr = TypeScheme * IdStatus
3246 type ValEnv = ValStr VIdMap (* [VE] *)
3247
3248 type TyStr = TypeFcn * ValEnv
3249 type TyEnv = TyStr TyConMap (* [TE] *)
3250
3251 type Str = (ValStr, TyStr) Str'
3252 type StrEnv = Str StrIdMap (* [SE] *)
3253
3254 type Env = StrEnv * TyEnv * ValEnv (* [E] *)
3255
3256
3257 (* Operations *)
3258
3259 val tyvarsVE: ValEnv -> TyVarSet
3260 val tyvars: Env -> TyVarSet
3261 val tynamesTE: TyEnv -> TyNameSet
3262 val tynamesSE: StrEnv -> TyNameSet
3263 val tynames: Env -> TyNameSet
3264
3265 val isWellFormed: Env -> bool
3266
3267 val Clos: ValEnv -> ValEnv
3268 val containsFlexibleType: ValEnv -> bool
3269 val defaultOverloaded: ValEnv -> unit
3270 val makeEquality: TyEnv -> unit
3271 val maximiseEquality: TyEnv * ValEnv -> TyEnv * ValEnv
3272 val Abs: TyEnv * Env -> Env
3273 val realise: Realisation -> Env -> Env
3274
3275 val enriches: Env * Env -> bool
3276
3277 end
3278(* stop of STATIC_ENV.sml *)
3279(* start of StaticEnv.sml *)
3280(*
3281 * Standard ML environments of the static semantics of the core
3282 *
3283 * Definition, sections 4.2, 4.3, 4.8, 4.9, and 5.5
3284 *
3285 * Note:
3286 * We call the domain type of value environments ValStr.
3287 *)
3288
3289structure StaticEnv :> STATIC_ENV =
3290 struct
3291
3292 (* Inheritance *)
3293
3294 structure GenericEnv = GenericEnvFn()
3295
3296 open GenericEnv
3297
3298
3299 (* Import types *)
3300
3301 type TypeScheme = TypeScheme.TypeScheme
3302 type TypeFcn = TypeFcn.TypeFcn
3303 type TyVar = TyVar.TyVar
3304 type TyVarSet = TyVarSet.set
3305 type TyName = TyName.TyName
3306 type TyNameSet = TyNameSet.set
3307 type Realisation = Type.Realisation
3308
3309
3310 (* Export types [Section 4.2] *)
3311
3312 type ValStr = TypeScheme * IdStatus
3313 type ValEnv = ValStr VIdMap (* [VE] *)
3314
3315 type TyStr = TypeFcn * ValEnv
3316 type TyEnv = TyStr TyConMap (* [TE] *)
3317
3318 type Str = (ValStr, TyStr) Str'
3319 type StrEnv = Str StrIdMap (* [SE] *)
3320
3321 type Env = StrEnv * TyEnv * ValEnv (* [E] *)
3322
3323
3324 (* Further modifications [Section 4.3] *)
3325
3326 infix TEplus
3327
3328 fun TE' TEplus (SE,TE,VE) = ( SE, TyConMap.unionWith #2 (TE',TE), VE )
3329
3330
3331 (* Type variable and type name set [Section 4.2] *)
3332
3333 fun tyvarsVE VE =
3334 VIdMap.foldl
3335 (fn((sigma,is), U) => TyVarSet.union(U, TypeScheme.tyvars sigma))
3336 TyVarSet.empty VE
3337
3338 fun tyvarsTE TE =
3339 TyConMap.foldl
3340 (fn((theta,VE), U) => TyVarSet.union(TyVarSet.union
3341 (U, TypeFcn.tyvars theta), tyvarsVE VE))
3342 TyVarSet.empty TE
3343
3344 fun tyvarsSE SE =
3345 StrIdMap.foldl
3346 (fn(Str E, U) => TyVarSet.union(U, tyvars E))
3347 TyVarSet.empty SE
3348
3349 and tyvars (SE,TE,VE) =
3350 TyVarSet.union(TyVarSet.union(tyvarsSE SE, tyvarsTE TE), tyvarsVE VE)
3351
3352
3353 fun tynamesVE VE =
3354 VIdMap.foldl
3355 (fn((sigma,is), T) => TyNameSet.union(T, TypeScheme.tynames sigma))
3356 TyNameSet.empty VE
3357
3358 fun tynamesTE TE =
3359 TyConMap.foldl
3360 (fn((theta,VE), T) => TyNameSet.union(TyNameSet.union
3361 (T, TypeFcn.tynames theta), tynamesVE VE))
3362 TyNameSet.empty TE
3363
3364 fun tynamesSE SE =
3365 StrIdMap.foldl
3366 (fn(Str E, T) => TyNameSet.union(T, tynames E))
3367 TyNameSet.empty SE
3368
3369 and tynames (SE,TE,VE) =
3370 TyNameSet.union(TyNameSet.union(tynamesSE SE, tynamesTE TE),
3371 tynamesVE VE)
3372
3373
3374 (* Well-formedness [Section 4.9] *)
3375
3376 fun isWellFormedTyStr (theta,VE) =
3377 VIdMap.isEmpty VE orelse isSome(TypeFcn.toTyName theta)
3378
3379 fun isWellFormedTE TE =
3380 TyConMap.all isWellFormedTyStr TE
3381
3382 fun isWellFormedSE SE =
3383 StrIdMap.all (fn Str E => isWellFormed E) SE
3384
3385 and isWellFormed (SE,TE,VE) =
3386 isWellFormedTE TE andalso isWellFormedSE SE
3387
3388
3389
3390 (* Closure [Section 4.8] *)
3391
3392 fun Clos VE =
3393 VIdMap.map (fn((_,tau), is) => (TypeScheme.Clos tau, is)) VE
3394
3395
3396 (* Check for unresolved flexible record types [Section 4.11, item 1] *)
3397
3398 fun containsFlexibleType VE =
3399 VIdMap.exists (fn((_,tau), is) => Type.isFlexible tau) VE
3400
3401
3402 (* Assign default types to overloaded types [Appendix E] *)
3403
3404 fun defaultOverloaded VE =
3405 VIdMap.app (fn((_,tau), is) => Type.defaultOverloaded tau) VE
3406
3407
3408 (* Realisation [Section 5.2] *)
3409
3410 fun realiseVE phi VE =
3411 VIdMap.map (fn(sigma,is) => ( TypeScheme.realise phi sigma, is )) VE
3412
3413 and realiseTE phi TE =
3414 TyConMap.map (fn(theta,VE) => ( TypeFcn.realise phi theta
3415 , realiseVE phi VE
3416 )) TE
3417 and realiseSE phi SE =
3418 StrIdMap.map (fn(Str E) => Str(realise phi E)) SE
3419
3420 and realise phi (SE,TE,VE) =
3421 ( realiseSE phi SE
3422 , realiseTE phi TE
3423 , realiseVE phi VE
3424 )
3425
3426
3427 (* Make all type names bound in a type environment equality types *)
3428
3429 (* Assumes abstract types, i.e. no constructors. *)
3430
3431 fun makeEquality TE =
3432 TyConMap.app (fn(theta,VE) => TypeFcn.makeEquality theta) TE
3433
3434
3435
3436 (* Maximise equality of a type environment [Section 4.9],
3437 * together with its appendant value envrionment
3438 *)
3439
3440 fun admitsEqualityValStr ((_,tau),_) = Type.admitsEquality tau
3441
3442 fun maximiseEquality(TE,VE) =
3443 let
3444 fun checkTyStr((theta,VE), (phi,changed)) =
3445 let
3446 val t = valOf(TypeFcn.toTyName theta)
3447 in
3448 if TyName.equality t = TyName.EQ
3449 andalso not(VIdMap.all admitsEqualityValStr VE) then
3450 ( TyNameMap.insert(phi,
3451 t,
3452 TypeFcn.fromTyName
3453 (TyName.removeEquality t)
3454 )
3455 , true
3456 )
3457 else
3458 ( phi, changed )
3459 end
3460
3461 fun checkTE(TE, phi) =
3462 let
3463 val (phi',change) = TyConMap.foldl checkTyStr (phi,false) TE
3464 val TE' = realiseTE phi' TE
3465 in
3466 if change then checkTE(TE', phi')
3467 else (TE', phi')
3468 end
3469
3470 val (TE',phi) = checkTE(TE, TyNameMap.empty)
3471 in
3472 ( TE', realiseVE phi VE )
3473 end
3474
3475
3476
3477 (* Abstraction of a type environment [Section 4.9] *)
3478
3479 fun AbsTE(TE) = TyConMap.map (fn(theta,_) => (theta,VIdMap.empty)) TE
3480
3481 fun Abs(TE,E) =
3482 let
3483 val ts = tynamesTE TE
3484 val phi = TyNameSet.foldl
3485 (fn(t,phi) => TyNameMap.insert(phi, t,
3486 TypeFcn.fromTyName(TyName.Abs t)))
3487 TyNameMap.empty ts
3488 in
3489 realise phi (AbsTE(TE) TEplus E)
3490 end
3491
3492
3493 (* Disjointness *)
3494
3495 fun disjoint((SE1,TE1,VE1), (SE2,TE2,VE2)) =
3496 StrIdMap.disjoint(SE1,SE2) andalso
3497 TyConMap.disjoint(TE1,TE2) andalso
3498 VIdMap.disjoint(VE1,VE2)
3499
3500
3501 (* Enrichment [Section 5.5] *)
3502
3503 fun equalsVE(VE1,VE2) =
3504 VIdMap.numItems VE1 = VIdMap.numItems VE2 andalso
3505 VIdMap.alli
3506 (fn(vid, (sigma1,is1)) =>
3507 case VIdMap.find(VE2, vid)
3508 of NONE => false
3509 | SOME(sigma2,is2) =>
3510 TypeScheme.equals(sigma1,sigma2) andalso is1 = is2
3511 )
3512 VE1
3513
3514
3515 fun enriches((SE1,TE1,VE1), (SE2,TE2,VE2)) =
3516 enrichesSE(SE1,SE2) andalso
3517 enrichesTE(TE1,TE2) andalso
3518 enrichesVE(VE1,VE2)
3519
3520 and enrichesSE(SE1,SE2) =
3521 StrIdMap.alli
3522 (fn(strid, Str E2) =>
3523 case StrIdMap.find(SE1, strid)
3524 of NONE => false
3525 | SOME(Str E1) => enriches(E1,E2)
3526 )
3527 SE2
3528
3529 and enrichesTE(TE1,TE2) =
3530 TyConMap.alli
3531 (fn(tycon, tystr2) =>
3532 case TyConMap.find(TE1, tycon)
3533 of NONE => false
3534 | SOME tystr1 => enrichesTyStr(tystr1,tystr2)
3535 )
3536 TE2
3537
3538 and enrichesVE(VE1,VE2) =
3539 VIdMap.alli
3540 (fn(vid, valstr2) =>
3541 case VIdMap.find(VE1, vid)
3542 of NONE => false
3543 | SOME valstr1 => enrichesValStr(valstr1,valstr2)
3544 )
3545 VE2
3546
3547 and enrichesTyStr((theta1,VE1), (theta2,VE2)) =
3548 TypeFcn.equals(theta1,theta2) andalso
3549 ( VIdMap.isEmpty VE2 orelse equalsVE(VE1,VE2) )
3550
3551 and enrichesValStr((sigma1,is1), (sigma2,is2)) =
3552 TypeScheme.generalises(sigma1,sigma2) andalso
3553 IdStatus.generalises(is1,is2)
3554
3555 end
3556(* stop of StaticEnv.sml *)
3557(* start of SIG.sml *)
3558(*
3559 * Standard ML signatures
3560 *
3561 * Definition, sections 5.1, 5.3, and 5.6
3562 *)
3563
3564
3565signature SIG =
3566 sig
3567
3568 (* Import types *)
3569
3570 type Env = StaticEnv.Env
3571 type TyVarSet = TyVarSet.set
3572 type TyNameSet = TyNameSet.set
3573 type Realisation = Type.Realisation
3574
3575
3576 (* Type [Section 5.1] *)
3577
3578 type Sig = TyNameSet * Env (* [Sigma] *)
3579
3580
3581 (* Operations *)
3582
3583 val tyvars: Sig -> TyVarSet
3584 val tynames: Sig -> TyNameSet
3585
3586 val rename: Sig -> Sig
3587
3588 exception Match
3589 val match: Env * Sig -> Env * Realisation (* Matching *)
3590
3591 end
3592(* stop of SIG.sml *)
3593(* start of Sig.sml *)
3594(*
3595 * Standard ML signatures
3596 *
3597 * Definition, sections 5.1, 5.3, and 5.6
3598 *)
3599
3600
3601structure Sig :> SIG =
3602 struct
3603
3604 (* Import types *)
3605
3606 type Env = StaticEnv.Env
3607 type TyVarSet = TyVarSet.set
3608 type TyNameSet = TyNameSet.set
3609 type Realisation = Type.Realisation
3610
3611
3612 (* Type [Section 5.1] *)
3613
3614 type Sig = TyNameSet * Env (* [Sigma] *)
3615
3616
3617 (* Type variable and type name extraction [Section 4.2] *)
3618
3619 fun tyvars (T,E) = StaticEnv.tyvars E
3620 fun tynames (T,E) = TyNameSet.difference(StaticEnv.tynames E, T)
3621
3622
3623 (* Alpha Renaming *)
3624
3625 fun rename (T,E) =
3626 let
3627 val phi' = TyNameSet.foldl
3628 (fn(t,phi')=> TyNameMap.insert(phi',t,TyName.rename t))
3629 TyNameMap.empty T
3630 val phi = TyNameMap.map TypeFcn.fromTyName phi'
3631 val T' = TyNameSet.map (fn t => valOf(TyNameMap.find(phi',t))) T
3632 val E' = StaticEnv.realise phi E
3633 in
3634 (T',E')
3635 end
3636
3637
3638 (* Matching [Section 5.6] *)
3639
3640 exception Match
3641
3642 fun matchTypeFcn(theta', theta, phi, T) =
3643 if TypeFcn.arity theta <> TypeFcn.arity theta' then
3644 raise Match
3645 else
3646 case TypeFcn.toTyName theta
3647 of NONE => phi
3648 | SOME t =>
3649 if isSome(TyNameMap.find(phi, t))
3650 orelse not(TyNameSet.member(T, t)) then
3651 phi
3652 else
3653 let
3654 val phi' = TyNameMap.insert(phi, t, TypeFcn.rename theta')
3655 in
3656 TyNameMap.map (TypeFcn.realise phi') phi'
3657 end
3658
3659 fun matchTE(TE', TE, phi, T) =
3660 let
3661 fun matchTyStr(tycon, (theta,VE), phi) =
3662 case TyConMap.find(TE', tycon)
3663 of NONE => raise Match
3664 | SOME(theta',VE') => matchTypeFcn(theta', theta, phi, T)
3665 in
3666 TyConMap.foldli matchTyStr phi TE
3667 end
3668
3669 fun matchSE(SE', SE, phi, T) =
3670 let
3671 fun matchStr(strid, StaticEnv.Str E, phi) =
3672 case StrIdMap.find(SE', strid)
3673 of NONE => raise Match
3674 | SOME(StaticEnv.Str E') => matchE(E', E, phi, T)
3675 in
3676 StrIdMap.foldli matchStr phi SE
3677 end
3678
3679 and matchE((SE',TE',VE'), (SE,TE,VE), phi, T) =
3680 let
3681 val phi1 = matchTE(TE', TE, phi, T)
3682 val phi2 = matchSE(SE', SE, phi1, T)
3683 in
3684 phi2
3685 end
3686
3687 fun match(E', (T,E)) =
3688 let
3689 val phi = matchE(E', E, TyNameMap.empty, T)
3690 val E'' = StaticEnv.realise phi E
3691 in
3692 if StaticEnv.enriches(E',E'') then
3693 (E'', phi)
3694 else
3695 raise Match
3696 end
3697
3698 end
3699(* stop of Sig.sml *)
3700(* start of FUNSIG.sml *)
3701(*
3702 * Standard ML functor signatures
3703 *
3704 * Definition, sections 5.1 and 5.4
3705 *)
3706
3707
3708signature FUNSIG =
3709 sig
3710
3711 (* Import types *)
3712
3713 type Env = StaticEnv.Env
3714 type Sig = Sig.Sig
3715 type TyVarSet = TyVarSet.set
3716 type TyNameSet = TyNameSet.set
3717
3718
3719 (* Type [Section 5.1] *)
3720
3721 type FunSig = TyNameSet * (Env * Sig) (* [Phi] *)
3722
3723
3724 (* Operations *)
3725
3726 val tyvars: FunSig -> TyVarSet
3727 val tynames: FunSig -> TyNameSet
3728
3729 end
3730(* stop of FUNSIG.sml *)
3731(* start of FunSig.sml *)
3732(*
3733 * Standard ML functor signatures
3734 *
3735 * Definition, sections 5.1 and 5.4
3736 *)
3737
3738
3739structure FunSig :> FUNSIG =
3740 struct
3741
3742 (* Import types *)
3743
3744 type Env = StaticEnv.Env
3745 type Sig = Sig.Sig
3746 type TyVarSet = TyVarSet.set
3747 type TyNameSet = TyNameSet.set
3748
3749
3750 (* Type [Section 5.1] *)
3751
3752 type FunSig = TyNameSet * (Env * Sig) (* [Phi] *)
3753
3754
3755 (* Type variable and type name extraction [Section 4.2] *)
3756
3757 fun tyvars (T,(E,Sigma)) =
3758 TyVarSet.union(StaticEnv.tyvars E, Sig.tyvars Sigma)
3759
3760 fun tynames (T,(E,Sigma)) =
3761 TyNameSet.difference(TyNameSet.union(StaticEnv.tynames E,
3762 Sig.tynames Sigma), T)
3763
3764 end
3765(* stop of FunSig.sml *)
3766(* start of CONTEXT.sml *)
3767(*
3768 * Standard ML contexts
3769 *
3770 * Definition, sections 4.2, 4.3, 4.7, and 4.9
3771 *)
3772
3773signature CONTEXT =
3774 sig
3775
3776 (* Import types *)
3777
3778 type VId = VId.Id
3779 type TyCon = TyCon.Id
3780 type StrId = StrId.Id
3781 type longVId = LongVId.longId
3782 type longTyCon = LongTyCon.longId
3783 type longStrId = LongStrId.longId
3784 type TyName = TyName.TyName
3785 type TyNameSet = TyNameSet.set
3786 type TyVar = TyVar.TyVar
3787 type TyVarSet = TyVarSet.set
3788 type IdStatus = IdStatus.IdStatus
3789 type TypeScheme = TypeScheme.TypeScheme
3790 type StrEnv = StaticEnv.StrEnv
3791 type Str = StaticEnv.Str
3792 type TyStr = StaticEnv.TyStr
3793 type TyEnv = StaticEnv.TyEnv
3794 type ValStr = StaticEnv.ValStr
3795 type ValEnv = StaticEnv.ValEnv
3796 type Env = StaticEnv.Env
3797
3798
3799 (* Type [Section 4.2] *)
3800
3801 type Context = TyNameSet * TyVarSet * Env (* [C] *)
3802
3803
3804 (* Operations *)
3805
3806 val Tof: Context -> TyNameSet
3807 val Uof: Context -> TyVarSet
3808 val Eof: Context -> Env
3809
3810 val plusVE: Context * ValEnv -> Context
3811 val plusU: Context * TyVarSet -> Context
3812 val oplusE: Context * Env -> Context
3813 val oplusTE: Context * TyEnv -> Context
3814 val oplusVEandTE: Context * (ValEnv * TyEnv) -> Context
3815
3816 val findVId: Context * VId -> ValStr option
3817 val findTyCon: Context * TyCon -> TyStr option
3818 val findStrId: Context * StrId -> Str option
3819 val findLongVId: Context * longVId -> ValStr option
3820 val findLongTyCon: Context * longTyCon -> TyStr option
3821 val findLongStrId: Context * longStrId -> Str option
3822
3823 val tyvars: Context -> TyVarSet
3824
3825 end
3826(* stop of CONTEXT.sml *)
3827(* start of Context.sml *)
3828(*
3829 * Standard ML contexts
3830 *
3831 * Definition, sections 4.2, 4.3, 4.7, and 4.9
3832 *)
3833
3834structure Context :> CONTEXT =
3835 struct
3836
3837 (* Import types *)
3838
3839 type VId = VId.Id
3840 type TyCon = TyCon.Id
3841 type StrId = StrId.Id
3842 type longVId = LongVId.longId
3843 type longTyCon = LongTyCon.longId
3844 type longStrId = LongStrId.longId
3845 type TyName = TyName.TyName
3846 type TyNameSet = TyNameSet.set
3847 type TyVar = TyVar.TyVar
3848 type TyVarSet = TyVarSet.set
3849 type IdStatus = IdStatus.IdStatus
3850 type TypeScheme = TypeScheme.TypeScheme
3851 type StrEnv = StaticEnv.StrEnv
3852 type Str = StaticEnv.Str
3853 type TyStr = StaticEnv.TyStr
3854 type TyEnv = StaticEnv.TyEnv
3855 type ValStr = StaticEnv.ValStr
3856 type ValEnv = StaticEnv.ValEnv
3857 type Env = StaticEnv.Env
3858
3859
3860 (* Type [Section 4.2] *)
3861
3862 type Context = TyNameSet * TyVarSet * Env (* [C] *)
3863
3864
3865 (* Projections [Section 4.3] *)
3866
3867 fun Tof (T,U,E) = T
3868 fun Uof (T,U,E) = U
3869 fun Eof (T,U,E) = E
3870
3871
3872 (* Modification [Section 4.3] *)
3873
3874 infix plusVE plusU oplusE oplusTE oplusVEandTE
3875
3876 fun (T,U,E) plusVE VE = ( T, U, StaticEnv.plusVE(E,VE) )
3877 fun (T,U,E) plusU U' = ( T, TyVarSet.union(U,U'), E )
3878
3879 fun (T,U,E) oplusE E' =
3880 ( TyNameSet.union(T, StaticEnv.tynames E)
3881 , U
3882 , StaticEnv.plus(E,E')
3883 )
3884
3885 fun (T,U,E) oplusTE TE =
3886 ( TyNameSet.union(T, StaticEnv.tynamesTE TE)
3887 , U
3888 , StaticEnv.plusTE(E,TE)
3889 )
3890
3891 fun (T,U,E) oplusVEandTE (VE,TE) =
3892 ( TyNameSet.union(T, StaticEnv.tynamesTE TE)
3893 , U
3894 , StaticEnv.plusVEandTE(E, (VE,TE))
3895 )
3896
3897
3898 (* Application (lookup) [Section 4.3] *)
3899
3900 fun findVId ((T,U,E), vid) = StaticEnv.findVId(E, vid)
3901 fun findTyCon((T,U,E), tycon) = StaticEnv.findTyCon(E, tycon)
3902 fun findStrId((T,U,E), strid) = StaticEnv.findStrId(E, strid)
3903
3904 fun findLongVId ((T,U,E), longvid) = StaticEnv.findLongVId(E,longvid)
3905 fun findLongTyCon((T,U,E), longtycon) = StaticEnv.findLongTyCon(E,longtycon)
3906 fun findLongStrId((T,U,E), longstrid) = StaticEnv.findLongStrId(E,longstrid)
3907
3908
3909 (* Calculation of tyvars [Section 4.2] *)
3910
3911 fun tyvars (T,U,E) = TyVarSet.union(U, StaticEnv.tyvars E)
3912
3913 end
3914(* stop of Context.sml *)
3915(* start of STATIC_BASIS.sml *)
3916(*
3917 * Standard ML static basis and environments of modules
3918 *
3919 * Definition, section 5.1
3920 *)
3921
3922signature STATIC_BASIS =
3923 sig
3924
3925 (* Import types *)
3926
3927 type StrId = StrId.Id
3928 type SigId = SigId.Id
3929 type FunId = FunId.Id
3930 type longStrId = LongStrId.longId
3931 type longTyCon = LongTyCon.longId
3932 type Env = StaticEnv.Env
3933 type StrEnv = StaticEnv.StrEnv
3934 type Str = StaticEnv.Str
3935 type TyStr = StaticEnv.TyStr
3936 type Context = Context.Context
3937 type Sig = Sig.Sig
3938 type FunSig = FunSig.FunSig
3939 type TyVarSet = TyVarSet.set
3940 type TyNameSet = TyNameSet.set
3941 type 'a SigIdMap = 'a SigIdMap.map
3942 type 'a FunIdMap = 'a FunIdMap.map
3943
3944
3945 (* Types [Section 5.1] *)
3946
3947 type SigEnv = Sig SigIdMap (* [G] *)
3948 type FunEnv = FunSig FunIdMap (* [F] *)
3949
3950 type Basis = TyNameSet * FunEnv * SigEnv * Env (* [B] *)
3951
3952
3953 (* Operations *)
3954
3955 val empty: Basis
3956 val fromTandE: TyNameSet * Env -> Basis
3957 val fromTandF: TyNameSet * FunEnv -> Basis
3958 val fromTandG: TyNameSet * SigEnv -> Basis
3959
3960 val Tof: Basis -> TyNameSet
3961 val Cof: Basis -> Context
3962
3963 val plus: Basis * Basis -> Basis
3964 val plusT: Basis * TyNameSet -> Basis
3965 val oplusSE: Basis * StrEnv -> Basis
3966 val oplusG: Basis * SigEnv -> Basis
3967 val oplusF: Basis * FunEnv -> Basis
3968 val oplusE: Basis * Env -> Basis
3969
3970 val findStrId: Basis * StrId -> Str option
3971 val findSigId: Basis * SigId -> Sig option
3972 val findFunId: Basis * FunId -> FunSig option
3973 val findLongStrId: Basis * longStrId -> Str option
3974 val findLongTyCon: Basis * longTyCon -> TyStr option
3975
3976 val tyvars: Basis -> TyVarSet
3977 val tynamesF: FunEnv -> TyNameSet
3978 val tynamesG: SigEnv -> TyNameSet
3979
3980 end
3981(* stop of STATIC_BASIS.sml *)
3982(* start of StaticBasis.sml *)
3983(*
3984 * Standard ML static basis and environments of modules
3985 *
3986 * Definition, section 5.1
3987 *)
3988
3989structure StaticBasis :> STATIC_BASIS =
3990 struct
3991
3992 (* Import types *)
3993
3994 type StrId = StrId.Id
3995 type SigId = SigId.Id
3996 type FunId = FunId.Id
3997 type longStrId = LongStrId.longId
3998 type longTyCon = LongTyCon.longId
3999 type Env = StaticEnv.Env
4000 type StrEnv = StaticEnv.StrEnv
4001 type Str = StaticEnv.Str
4002 type TyStr = StaticEnv.TyStr
4003 type Context = Context.Context
4004 type Sig = Sig.Sig
4005 type FunSig = FunSig.FunSig
4006 type TyVarSet = TyVarSet.set
4007 type TyNameSet = TyNameSet.set
4008 type 'a SigIdMap = 'a SigIdMap.map
4009 type 'a FunIdMap = 'a FunIdMap.map
4010
4011
4012 (* Types [Section 5.1] *)
4013
4014 type SigEnv = Sig SigIdMap (* [G] *)
4015 type FunEnv = FunSig FunIdMap (* [F] *)
4016
4017 type Basis = TyNameSet * FunEnv * SigEnv * Env (* [B] *)
4018
4019
4020
4021 (* Calculation of type variable and type name sets [Section 4.2] *)
4022
4023 fun tyvarsG G =
4024 SigIdMap.foldl
4025 (fn(Sigma, U) => TyVarSet.union(U, Sig.tyvars Sigma))
4026 TyVarSet.empty G
4027
4028 fun tyvarsF F =
4029 FunIdMap.foldl
4030 (fn(Phi, U) => TyVarSet.union(U, FunSig.tyvars Phi))
4031 TyVarSet.empty F
4032
4033 fun tyvars (T,F,G,E) = TyVarSet.union(TyVarSet.union(
4034 tyvarsF F, tyvarsG G), StaticEnv.tyvars E)
4035
4036
4037
4038 fun tynamesG G =
4039 SigIdMap.foldl
4040 (fn(Sigma, T) => TyNameSet.union(T, Sig.tynames Sigma))
4041 TyNameSet.empty G
4042
4043 fun tynamesF F =
4044 FunIdMap.foldl
4045 (fn(Phi, T) => TyNameSet.union(T, FunSig.tynames Phi))
4046 TyNameSet.empty F
4047
4048
4049
4050 (* Injection [Sections 4.3 and 5.1] *)
4051
4052 val empty =
4053 ( TyNameSet.empty, FunIdMap.empty, SigIdMap.empty, StaticEnv.empty )
4054
4055 fun fromTandE(T,E) = ( T, FunIdMap.empty, SigIdMap.empty, E )
4056 fun fromTandF(T,F) = ( T, F, SigIdMap.empty, StaticEnv.empty )
4057 fun fromTandG(T,G) = ( T, FunIdMap.empty, G, StaticEnv.empty )
4058
4059
4060 (* Projections [Sections 4.3 and 5.1] *)
4061
4062 fun Tof (T,F,G,E) = T
4063 fun Cof (T,F,G,E) = (T, TyVarSet.empty, E)
4064
4065
4066 (* Modifications [Sections 4.3 and 5.1] *)
4067
4068 infix plus plusT oplusG oplusF oplusE oplusSE
4069
4070 fun (T,F,G,E) plus (T',F',G',E') =
4071 ( TyNameSet.union(T,T')
4072 , FunIdMap.unionWith #2 (F,F')
4073 , SigIdMap.unionWith #2 (G,G')
4074 , StaticEnv.plus(E,E')
4075 )
4076
4077 fun (T,F,G,E) plusT T' = ( TyNameSet.union(T,T'), F, G, E )
4078
4079 fun (T,F,G,E) oplusG G' =
4080 ( TyNameSet.union(T, tynamesG G')
4081 , F
4082 , SigIdMap.unionWith #2 (G,G')
4083 , E
4084 )
4085
4086 fun (T,F,G,E) oplusF F' =
4087 ( TyNameSet.union(T, tynamesF F')
4088 , FunIdMap.unionWith #2 (F,F')
4089 , G
4090 , E
4091 )
4092
4093 fun (T,F,G,E) oplusE E' =
4094 ( TyNameSet.union(T, StaticEnv.tynames E')
4095 , F
4096 , G
4097 , StaticEnv.plus(E,E')
4098 )
4099
4100 fun (T,F,G,E) oplusSE SE =
4101 ( TyNameSet.union(T, StaticEnv.tynamesSE SE)
4102 , F
4103 , G
4104 , StaticEnv.plusSE(E,SE)
4105 )
4106
4107 (* Application (lookup) [Sections 5.1 and 4.3] *)
4108
4109 fun findStrId((T,F,G,E), strid) = StaticEnv.findStrId(E, strid)
4110 fun findSigId((T,F,G,E), sigid) = SigIdMap.find(G, sigid)
4111 fun findFunId((T,F,G,E), funid) = FunIdMap.find(F, funid)
4112 fun findLongStrId((T,F,G,E), longstrid) =
4113 StaticEnv.findLongStrId(E, longstrid)
4114 fun findLongTyCon((T,F,G,E), longtycon) =
4115 StaticEnv.findLongTyCon(E, longtycon)
4116
4117 end
4118(* stop of StaticBasis.sml *)
4119(* start of INITIAL_STATIC_ENV.sml *)
4120(*
4121 * Standard ML core view of the initial static basis
4122 *
4123 * Definition, appendices C and E
4124 *)
4125
4126signature INITIAL_STATIC_ENV =
4127 sig
4128
4129 (* Import types *)
4130
4131 type Type = Type.Type
4132 type TyNameSet = TyNameSet.set
4133 type OverloadingClass = OverloadingClass.OverloadingClass
4134 type Env = StaticEnv.Env
4135
4136
4137 (* Predefined monomorphic types [Figure 24] *)
4138
4139 val tauBool: Type
4140 val tauInt: Type
4141 val tauWord: Type
4142 val tauReal: Type
4143 val tauString: Type
4144 val tauChar: Type
4145 val tauExn: Type
4146
4147 (* Overloading classes [Appendix E.1] *)
4148
4149 val Int: OverloadingClass
4150 val Real: OverloadingClass
4151 val Word: OverloadingClass
4152 val String: OverloadingClass
4153 val Char: OverloadingClass
4154 val WordInt: OverloadingClass
4155 val RealInt: OverloadingClass
4156 val Num: OverloadingClass
4157 val NumTxt: OverloadingClass
4158
4159 (* Initial environment [Appendix C] *)
4160
4161 val T0: TyNameSet
4162 val E0: Env
4163
4164 end
4165(* stop of INITIAL_STATIC_ENV.sml *)
4166(* start of InitialStaticEnv.sml *)
4167(*
4168 * Standard ML core view of the initial static basis
4169 *
4170 * Definition, appendices C and E
4171 *)
4172
4173structure InitialStaticEnv :> INITIAL_STATIC_ENV =
4174 struct
4175
4176 (* Import *)
4177
4178 type Type = Type.Type
4179 type TyNameSet = TyNameSet.set
4180 type Overloadingclass = OverloadingClass.OverloadingClass
4181 type VIdSet = VIdSet.set
4182 type Env = StaticEnv.Env
4183 type ValEnv = StaticEnv.ValEnv
4184
4185
4186 open Type
4187 open IdStatus
4188
4189
4190 (* Helpers *)
4191
4192 fun pairType(tau1,tau2) =
4193 let
4194 val Rho = LabMap.insert(LabMap.insert(LabMap.empty,
4195 Lab.fromInt 1, tau1),
4196 Lab.fromInt 2, tau2)
4197 in
4198 fromRowType (Rho,CLOSEDRow)
4199 end
4200
4201
4202 (* VIds [Figure 25] *)
4203
4204 val vidEq = VId.fromString "="
4205 val vidAssign = VId.fromString ":="
4206
4207 val vidFalse = VId.fromString "false"
4208 val vidTrue = VId.fromString "true"
4209 val vidNil = VId.fromString "nil"
4210 val vidCons = VId.fromString "::"
4211 val vidRef = VId.fromString "ref"
4212
4213 val vidMatch = VId.fromString "Match"
4214 val vidBind = VId.fromString "Bind"
4215
4216
4217 (* TyCons [Figure 24] *)
4218
4219 val tyconUnit = TyCon.fromString "unit"
4220 val tyconBool = TyCon.fromString "bool"
4221 val tyconInt = TyCon.fromString "int"
4222 val tyconWord = TyCon.fromString "word"
4223 val tyconReal = TyCon.fromString "real"
4224 val tyconString = TyCon.fromString "string"
4225 val tyconChar = TyCon.fromString "char"
4226 val tyconList = TyCon.fromString "list"
4227 val tyconRef = TyCon.fromString "ref"
4228 val tyconExn = TyCon.fromString "exn"
4229
4230
4231 (* TyNames [Appendix C] *)
4232
4233 val tBool = TyName.tyname(tyconBool, 0, TyName.EQ, 2)
4234 val tInt = TyName.tyname(tyconInt, 0, TyName.EQ, 0)
4235 val tWord = TyName.tyname(tyconWord, 0, TyName.EQ, 0)
4236 val tReal = TyName.tyname(tyconReal, 0, TyName.NOEQ, 0)
4237 val tString = TyName.tyname(tyconString, 0, TyName.EQ, 0)
4238 val tChar = TyName.tyname(tyconChar, 0, TyName.EQ, 0)
4239 val tList = TyName.tyname(tyconList, 1, TyName.EQ, 2)
4240 val tRef = TyName.tyname(tyconRef, 1, TyName.SPECIALEQ, 1)
4241 val tExn = TyName.tyname(tyconExn, 0, TyName.NOEQ, 0)
4242
4243 val T0 = TyNameSet.fromList[tBool, tInt, tWord, tReal, tString, tChar,
4244 tList, tRef, tExn]
4245
4246
4247 (* Types *)
4248
4249 val alpha = TyVar.fromString "'a"
4250 val alphaEq = TyVar.fromString "''a"
4251 val tauAlpha = fromTyVar alpha
4252 val tauAlphaEq = fromTyVar alphaEq
4253
4254 val tauUnit = fromRowType emptyRho
4255 val tauBool = fromConsType([], tBool)
4256 val tauInt = fromConsType([], tInt)
4257 val tauWord = fromConsType([], tWord)
4258 val tauReal = fromConsType([], tReal)
4259 val tauString = fromConsType([], tString)
4260 val tauChar = fromConsType([], tChar)
4261 val tauExn = fromConsType([], tExn)
4262 val tauAlphaList = fromConsType([tauAlpha], tList)
4263 val tauAlphaRef = fromConsType([tauAlpha], tRef)
4264
4265
4266 (* TypeSchemes [Figure 25] *)
4267
4268 val sigmaEq = ([alphaEq], fromFunType(pairType(tauAlphaEq,tauAlphaEq),
4269 tauBool))
4270 val sigmaAssign = ([alpha], fromFunType(pairType(tauAlphaRef,tauAlpha),
4271 tauUnit))
4272 val sigmaFalse = ([], tauBool)
4273 val sigmaTrue = ([], tauBool)
4274 val sigmaNil = ([alpha], tauAlphaList)
4275 val sigmaCons = ([alpha], fromFunType(pairType(tauAlpha, tauAlphaList),
4276 tauAlphaList))
4277 val sigmaRef = ([alpha], fromFunType(tauAlpha, tauAlphaRef))
4278
4279 val sigmaMatch = ([], tauExn)
4280 val sigmaBind = ([], tauExn)
4281
4282
4283 (* Value entries [Figure 25] *)
4284
4285 val valstrEq = (sigmaEq, v)
4286 val valstrAssign = (sigmaAssign, v)
4287
4288 val valstrFalse = (sigmaFalse, c)
4289 val valstrTrue = (sigmaTrue, c)
4290 val valstrNil = (sigmaNil, c)
4291 val valstrCons = (sigmaCons, c)
4292 val valstrRef = (sigmaRef, c)
4293
4294 val valstrMatch = (sigmaMatch, e)
4295 val valstrBind = (sigmaBind, e)
4296
4297
4298 (* TypeFcns [Figure 24] *)
4299
4300 val thetaUnit = ([], tauUnit)
4301 val thetaBool = ([], tauBool)
4302 val thetaInt = ([], tauInt)
4303 val thetaWord = ([], tauWord)
4304 val thetaReal = ([], tauReal)
4305 val thetaString = ([], tauString)
4306 val thetaChar = ([], tauChar)
4307 val thetaExn = ([], tauExn)
4308 val thetaList = ([alpha], tauAlphaList)
4309 val thetaRef = ([alpha], tauAlphaRef)
4310
4311
4312 (* TyStrs [Figure 25] *)
4313
4314 val VEEmpty = VIdMap.empty
4315 val VEBool = VIdMap.fromList[(vidFalse, valstrFalse),
4316 (vidTrue, valstrTrue)] : ValEnv
4317 val VEList = VIdMap.fromList[(vidNil, valstrNil),
4318 (vidCons, valstrCons)]
4319 val VERef = VIdMap.fromList[(vidRef, valstrRef)]
4320
4321 val tystrUnit = (thetaUnit, VEEmpty)
4322 val tystrBool = (thetaBool, VEBool )
4323 val tystrInt = (thetaInt, VEEmpty)
4324 val tystrWord = (thetaWord, VEEmpty)
4325 val tystrReal = (thetaReal, VEEmpty)
4326 val tystrString = (thetaString, VEEmpty)
4327 val tystrChar = (thetaChar, VEEmpty)
4328 val tystrList = (thetaList, VEList )
4329 val tystrRef = (thetaRef, VERef )
4330 val tystrExn = (thetaExn, VEEmpty)
4331
4332
4333 (* Environments [Appendix C] *)
4334
4335 val SE0 = StrIdMap.empty
4336
4337 val TE0 = TyConMap.fromList[(tyconUnit, tystrUnit),
4338 (tyconBool, tystrBool),
4339 (tyconInt, tystrInt),
4340 (tyconWord, tystrWord),
4341 (tyconReal, tystrReal),
4342 (tyconString, tystrString),
4343 (tyconChar, tystrChar),
4344 (tyconList, tystrList),
4345 (tyconRef, tystrRef),
4346 (tyconExn, tystrExn)]
4347
4348 val VE0 = VIdMap.fromList [(vidEq, valstrEq),
4349 (vidAssign, valstrAssign),
4350 (vidRef, valstrRef),
4351 (vidNil, valstrNil),
4352 (vidCons, valstrCons),
4353 (vidFalse, valstrFalse),
4354 (vidTrue, valstrTrue),
4355 (vidMatch, valstrMatch),
4356 (vidBind, valstrBind)]
4357
4358 val E0 = (SE0,TE0,VE0)
4359
4360
4361 (* Overloading classes [Section E.1] *)
4362
4363 val Int = OverloadingClass.make(TyNameSet.singleton tInt, tInt)
4364 val Real = OverloadingClass.make(TyNameSet.singleton tReal, tReal)
4365 val Word = OverloadingClass.make(TyNameSet.singleton tWord, tWord)
4366 val String = OverloadingClass.make(TyNameSet.singleton tString, tString)
4367 val Char = OverloadingClass.make(TyNameSet.singleton tChar, tChar)
4368 val WordInt = OverloadingClass.union(Word, Int) (* default is 2nd *)
4369 val RealInt = OverloadingClass.union(Real, Int)
4370 val Num = OverloadingClass.union(Word, RealInt)
4371 val Txt = OverloadingClass.union(String, Char)
4372 val NumTxt = OverloadingClass.union(Txt, Num)
4373
4374 end
4375(* stop of InitialStaticEnv.sml *)
4376(* start of INITIAL_STATIC_BASIS.sml *)
4377(*
4378 * Standard ML initial static basis
4379 *
4380 * Definition, appendices C and E
4381 *)
4382
4383signature INITIAL_STATIC_BASIS =
4384 sig
4385
4386 (* Import *)
4387
4388 type Basis = StaticBasis.Basis
4389
4390
4391 (* Export *)
4392
4393 val B0: Basis
4394
4395 end
4396(* stop of INITIAL_STATIC_BASIS.sml *)
4397(* start of InitialStaticBasis.sml *)
4398(*
4399 * Standard ML initial static basis
4400 *
4401 * Definition, appendices C and E
4402 *)
4403
4404structure InitialStaticBasis :> INITIAL_STATIC_BASIS =
4405 struct
4406
4407 (* Import *)
4408
4409 type Basis = StaticBasis.Basis
4410
4411
4412 (* Enviornments *)
4413
4414 val T0 = InitialStaticEnv.T0
4415 val F0 = FunIdMap.empty
4416 val G0 = SigIdMap.empty
4417 val E0 = InitialStaticEnv.E0
4418
4419 val B0 = (T0,F0,G0,E0)
4420
4421 end
4422(* stop of InitialStaticBasis.sml *)
4423(* start of EXNAME.sml *)
4424(*
4425 * Standard ML exception names
4426 *
4427 * Definition, section 6.2
4428 *)
4429
4430signature EXNAME =
4431 sig
4432
4433 (* Import *)
4434
4435 type VId = VId.Id
4436
4437
4438 (* Type [Section 6.2] *)
4439
4440 eqtype ExName (* [en] *)
4441
4442
4443 (* Operations *)
4444
4445 val exname: VId -> ExName
4446 val toString: ExName -> string
4447
4448 val compare: ExName * ExName -> order
4449
4450 end
4451(* stop of EXNAME.sml *)
4452(* start of ExName.sml *)
4453(*
4454 * Standard ML exception names
4455 *
4456 * Definition, section 6.2
4457 *)
4458
4459
4460structure ExName :> EXNAME =
4461 struct
4462
4463 (* Import *)
4464
4465 type VId = VId.Id
4466 type stamp = Stamp.stamp
4467
4468
4469 (* Type [Section 6.2] *)
4470
4471 type ExName = (* [en] *)
4472 { vid: VId
4473 , stamp: stamp
4474 }
4475
4476
4477 (* Creation *)
4478
4479 fun exname vid = { vid = vid, stamp = Stamp.stamp() }
4480
4481
4482 (* Conversion *)
4483
4484 fun toString{vid, stamp} = VId.toString vid
4485
4486
4487 (* Ordering *)
4488
4489 fun compare(en1: ExName, en2: ExName) =
4490 Stamp.compare(#stamp en1, #stamp en2)
4491
4492 end
4493(* stop of ExName.sml *)
4494(* start of ADDR.sml *)
4495(*
4496 * Standard ML addresses
4497 *
4498 * Definition, section 6.2
4499 *)
4500
4501signature ADDR =
4502 sig
4503
4504 (* Type [Section 6.2] *)
4505
4506 eqtype Addr (* [a] *)
4507
4508
4509 (* Operations *)
4510
4511 val addr: unit -> Addr
4512 val compare: Addr * Addr -> order
4513
4514 end
4515(* stop of ADDR.sml *)
4516(* start of Addr.sml *)
4517(*
4518 * Standard ML addresses
4519 *
4520 * Definition, section 6.2
4521 *)
4522
4523
4524structure Addr :> ADDR =
4525 struct
4526
4527 (* Type [Section 6.2] *)
4528
4529 type Addr = Stamp.stamp (* [a] *)
4530
4531
4532 (* Operations *)
4533
4534 val addr = Stamp.stamp
4535 val compare = Stamp.compare
4536
4537 end
4538(* stop of Addr.sml *)
4539(* start of AssembliesCoreDynamic.sml *)
4540(*
4541 * Standard ML additional sets and maps for the dynamic semantics of the core
4542 *
4543 * Definition, section 6.3
4544 *)
4545
4546structure ExNameSet = FinSetFn(type ord_key = ExName.ExName
4547 val compare = ExName.compare)
4548
4549structure AddrMap = FinMapFn(type ord_key = Addr.Addr
4550 val compare = Addr.compare)
4551(* stop of AssembliesCoreDynamic.sml *)
4552(* start of SVAL.sml *)
4553(*
4554 * Standard ML special values
4555 *
4556 * Definition, section 6.2
4557 *)
4558
4559
4560signature SVAL =
4561 sig
4562
4563 (* Type [Section 6.2] *)
4564
4565 datatype SVal = (* [sv] *)
4566 INT of int
4567 | WORD of word
4568 | STRING of string
4569 | CHAR of char
4570 | REAL of real
4571
4572 (* Operations *)
4573
4574 val toString: SVal -> string
4575 val equal: SVal * SVal -> bool
4576
4577 end
4578(* stop of SVAL.sml *)
4579(* start of SVal.sml *)
4580(*
4581 * Standard ML special values
4582 *
4583 * Definition, section 6.2
4584 *)
4585
4586
4587structure SVal :> SVAL =
4588 struct
4589
4590 (* Type [Section 6.2] *)
4591
4592 datatype SVal = (* [sv] *)
4593 INT of int
4594 | WORD of word
4595 | STRING of string
4596 | CHAR of char
4597 | REAL of real
4598
4599
4600 (* Conversions *)
4601
4602 fun toString(INT i) = Int.toString i
4603 | toString(WORD w) = "0wx" ^ Word.toString w
4604 | toString(STRING s) = "\"" ^ String.toString s ^ "\""
4605 | toString(CHAR c) = "\"#" ^ Char.toString c ^ "\""
4606 | toString(REAL r) = Real.toString r
4607
4608 (* Equality *)
4609
4610 fun equal(INT n1, INT n2 ) = n1 = n2
4611 | equal(WORD w1, WORD w2 ) = w1 = w2
4612 | equal(STRING s1, STRING s2) = s1 = s2
4613 | equal(CHAR c1, CHAR c2 ) = c1 = c2
4614 | equal _ = raise Fail "type error: equality type expected"
4615
4616 end
4617(* stop of SVal.sml *)
4618(* start of VAL.sml *)
4619(*
4620 * Standard ML values
4621 *
4622 * Definition, sections 6.2, 6.3, and 6.4
4623 *
4624 * Note:
4625 * - All value types are parameterised over the representation of function
4626 * closures to break up the recursion between values and environments.
4627 * - The basic values are just strings.
4628 *)
4629
4630
4631signature VAL =
4632 sig
4633
4634 (* Import *)
4635
4636 type Addr = Addr.Addr
4637 type ExName = ExName.ExName
4638 type SVal = SVal.SVal
4639 type VId = VId.Id
4640 type 'a LabMap = 'a LabMap.map
4641
4642
4643 (* Types [Sections 6.2 and 6.3] *)
4644
4645 type BasVal = string (* [b] *)
4646
4647 datatype 'a Val = (* [v] *)
4648 :=
4649 | SVal of SVal
4650 | BasVal of BasVal
4651 | VId of VId
4652 | VIdVal of VId * 'a Val
4653 | ExVal of 'a ExVal
4654 | Record of (*Record*) 'a Val LabMap
4655 | Addr of Addr
4656 | FcnClosure of 'a
4657
4658 and 'a ExVal = (* [e] *)
4659 ExName of ExName
4660 | ExNameVal of ExName * 'a Val
4661
4662 type 'a Record = 'a Val LabMap (* [r] *)
4663
4664
4665 (* Operations *)
4666
4667 val equal: 'a Val * 'a Val -> bool
4668
4669 val toBoolVal: bool -> 'a Val
4670 val unpair: 'a Val -> ('a Val * 'a Val) option
4671
4672 end
4673(* stop of VAL.sml *)
4674(* start of Val.sml *)
4675(*
4676 * Standard ML values
4677 *
4678 * Definition, sections 6.2, 6.3, and 6.4
4679 *
4680 * Note:
4681 * - All value types are parameterised over the representation of function
4682 * closures to break up the recursion between values and environments.
4683 * - The basic values are just strings.
4684 *)
4685
4686
4687structure Val :> VAL =
4688 struct
4689
4690 (* Import *)
4691
4692 type Addr = Addr.Addr
4693 type ExName = ExName.ExName
4694 type SVal = SVal.SVal
4695 type VId = VId.Id
4696 type 'a LabMap = 'a LabMap.map
4697
4698
4699 (* Types [Sections 6.2 and 6.3] *)
4700
4701 type BasVal = string (* [b] *)
4702
4703
4704 datatype 'a Val = (* [v] *)
4705 op:=
4706 | SVal of SVal
4707 | BasVal of BasVal
4708 | VId of VId
4709 | VIdVal of VId * 'a Val
4710 | ExVal of 'a ExVal
4711 | Record of 'a Record
4712 | Addr of Addr
4713 | FcnClosure of 'a
4714
4715 and 'a ExVal = (* [e] *)
4716 ExName of ExName
4717 | ExNameVal of ExName * 'a Val
4718
4719 withtype 'a Record = 'a Val LabMap (* [r] *)
4720
4721
4722 (* Operations *)
4723
4724 fun toBoolVal b = VId(VId.fromString(if b then "true" else "false"))
4725
4726
4727 fun unpair(Record r) =
4728 (case (LabMap.find(r, Lab.fromInt 1), LabMap.find(r, Lab.fromInt 2))
4729 of (SOME v1, SOME v2) => SOME(v1, v2)
4730 | _ => NONE
4731 )
4732 | unpair _ = NONE
4733
4734
4735
4736 (* Implementation of polymorphic equality *)
4737
4738 fun equal(SVal sv1, SVal sv2 ) = SVal.equal(sv1, sv2)
4739 | equal(VId vid1, VId vid2 ) = vid1 = vid2
4740 | equal(ExVal(ExName en1), ExVal(ExName en2)) = en1 = en2
4741 | equal(Addr a1, Addr a2 ) = a1 = a2
4742
4743 | equal(VIdVal(vid1, v1), VIdVal(vid2, v2)) =
4744 vid1 = vid2 andalso equal(v1, v2)
4745
4746 | equal(ExVal(ExNameVal(en1,v1)), ExVal(ExNameVal(en2,v2))) =
4747 en1 = en2 andalso equal(v1, v2)
4748
4749 | equal(Record r1, Record r2) =
4750 LabMap.numItems r1 = LabMap.numItems r2 andalso
4751 LabMap.alli (fn(lab, v1) =>
4752 case LabMap.find(r2, lab)
4753 of SOME v2 => equal(v1, v2)
4754 | NONE => false
4755 ) r1
4756
4757 | equal _ = false
4758
4759 end
4760(* stop of Val.sml *)
4761(* start of STATE.sml *)
4762(*
4763 * Standard ML state
4764 *
4765 * Definition, section 6.3
4766 *
4767 * Notes:
4768 * - Memory gets represented by references. This avoids expanding out all
4769 * occurances of the state convention in the inference rules.
4770 * - Since exception names are generated by stamps we do not really need the
4771 * exception name set. We maintain it anyway.
4772 *)
4773
4774signature STATE =
4775 sig
4776
4777 (* Import *)
4778
4779 type Addr = Addr.Addr
4780 type ExName = ExName.ExName
4781 type ExNameSet = ExNameSet.set
4782 type 'a Val = 'a Val.Val
4783 type 'a AddrMap = 'a AddrMap.map
4784
4785
4786 (* Types [Section 6.3] *)
4787
4788 type 'a Mem = 'a Val AddrMap (* [mem] *)
4789
4790 type 'a State = 'a Mem * ExNameSet (* [s] *)
4791
4792
4793 (* Operations *)
4794
4795 val insertAddr: 'a State * Addr * 'a Val -> 'a State
4796 val insertExName: 'a State * ExName -> 'a State
4797
4798 val findAddr: 'a State * Addr -> 'a Val option
4799
4800 end
4801(* stop of STATE.sml *)
4802(* start of State.sml *)
4803(*
4804 * Standard ML state
4805 *
4806 * Definition, section 6.3
4807 *
4808 * Notes:
4809 * - Memory gets represented by references. This avoids expanding out all
4810 * occurances of the state convention in the inference rules.
4811 * - Since exception names are generated by stamps we do not really need the
4812 * exception name set. We maintain it anyway.
4813 *)
4814
4815structure State :> STATE =
4816 struct
4817
4818 (* Import *)
4819
4820 type Addr = Addr.Addr
4821 type ExName = ExName.ExName
4822 type ExNameSet = ExNameSet.set
4823 type 'a Val = 'a Val.Val
4824 type 'a AddrMap = 'a AddrMap.map
4825
4826
4827 (* Types [Section 6.3] *)
4828
4829 type 'a Mem = 'a Val AddrMap (* [mem] *)
4830
4831 type 'a State = 'a Mem * ExNameSet (* [s] *)
4832
4833
4834 (* Operations *)
4835
4836 fun insertAddr ((mem,ens), a, v) = ( AddrMap.insert(mem, a, v), ens )
4837 fun insertExName((mem,ens), en) = ( mem, ExNameSet.add(ens, en) )
4838
4839 fun findAddr((mem,ens), a) = AddrMap.find(mem, a)
4840
4841 end
4842(* stop of State.sml *)
4843(* start of GRAMMAR_CORE.sml *)
4844(*
4845 * Standard ML abstract core grammar
4846 *
4847 * Definition, section 2.8
4848 *
4849 * Note:
4850 * This is the syntax used in the inference rules for the core [Definition,
4851 * sections 4.10 and 6.7]. It omits almost anything having to do with infixed
4852 * identifiers:
4853 * - fixity directives
4854 * - infixed application
4855 * - infixed value construction
4856 * However, op prefixes are kept, since they are required for rebuilding the
4857 * syntax tree during fixity resolution.
4858 * Optional semicolons are also omitted.
4859 *)
4860
4861signature GRAMMAR_CORE =
4862 sig
4863
4864 (* Import *)
4865
4866 type Info
4867
4868 type SCon = SCon.SCon
4869 type Lab = Lab.Lab
4870 type VId = VId.Id
4871 type TyCon = TyCon.Id
4872 type TyVar = TyVar.TyVar
4873 type StrId = StrId.Id
4874 type longVId = LongVId.longId
4875 type longTyCon = LongTyCon.longId
4876 type longStrId = LongStrId.longId
4877
4878
4879 (* Optional keyword `op' *)
4880
4881 datatype Op = SANSOp | WITHOp
4882
4883
4884 (* Expressions [Figures 2 and 4] *)
4885
4886 datatype AtExp =
4887 SCONAtExp of Info * SCon
4888 | LONGVIDAtExp of Info * Op * longVId
4889 | RECORDAtExp of Info * ExpRow option
4890 | LETAtExp of Info * Dec * Exp
4891 | PARAtExp of Info * Exp
4892
4893 and ExpRow =
4894 ExpRow of Info * Lab * Exp * ExpRow option
4895
4896 and Exp =
4897 ATEXPExp of Info * AtExp
4898 | APPExp of Info * Exp * AtExp
4899 | TYPEDExp of Info * Exp * Ty
4900 | HANDLEExp of Info * Exp * Match
4901 | RAISEExp of Info * Exp
4902 | FNExp of Info * Match
4903
4904 (* Matches [Figures 2 and 4] *)
4905
4906 and Match =
4907 Match of Info * Mrule * Match option
4908
4909 and Mrule =
4910 Mrule of Info * Pat * Exp
4911
4912 (* Declarations [Figures 2 and 4] *)
4913
4914 and Dec =
4915 VALDec of Info * TyVarseq * ValBind
4916 | TYPEDec of Info * TypBind
4917 | DATATYPEDec of Info * DatBind
4918 | REPLICATIONDec of Info * TyCon * longTyCon
4919 | ABSTYPEDec of Info * DatBind * Dec
4920 | EXCEPTIONDec of Info * ExBind
4921 | LOCALDec of Info * Dec * Dec
4922 | OPENDec of Info * longStrId list
4923 | EMPTYDec of Info
4924 | SEQDec of Info * Dec * Dec
4925
4926 (* Bindings [Figures 2 and 4] *)
4927
4928 and ValBind =
4929 PLAINValBind of Info * Pat * Exp * ValBind option
4930 | RECValBind of Info * ValBind
4931
4932 and TypBind =
4933 TypBind of Info * TyVarseq * TyCon * Ty * TypBind option
4934
4935 and DatBind =
4936 DatBind of Info * TyVarseq * TyCon * ConBind * DatBind option
4937
4938 and ConBind =
4939 ConBind of Info * Op * VId * Ty option * ConBind option
4940
4941 and ExBind =
4942 NEWExBind of Info * Op * VId * Ty option * ExBind option
4943 | EQUALExBind of Info * Op * VId * Op * longVId * ExBind option
4944
4945 (* Patterns [Figures 2 and 3] *)
4946
4947 and AtPat =
4948 WILDCARDAtPat of Info
4949 | SCONAtPat of Info * SCon
4950 | LONGVIDAtPat of Info * Op * longVId
4951 | RECORDAtPat of Info * PatRow option
4952 | PARAtPat of Info * Pat
4953
4954 and PatRow =
4955 WILDCARDPatRow of Info
4956 | ROWPatRow of Info * Lab * Pat * PatRow option
4957
4958 and Pat =
4959 ATPATPat of Info * AtPat
4960 | CONPat of Info * Op * longVId * AtPat
4961 | TYPEDPat of Info * Pat * Ty
4962 | ASPat of Info * Op * VId * Ty option * Pat
4963
4964 (* Type expressions [Figures 2 and 3] *)
4965
4966 and Ty =
4967 TYVARTy of Info * TyVar
4968 | RECORDTy of Info * TyRow option
4969 | TYCONTy of Info * Tyseq * longTyCon
4970 | ARROWTy of Info * Ty * Ty
4971 | PARTy of Info * Ty
4972
4973 and TyRow =
4974 TyRow of Info * Lab * Ty * TyRow option
4975
4976 (* Sequences [Section 2.8] *)
4977
4978 and Tyseq =
4979 Tyseq of Info * Ty list
4980
4981 and TyVarseq =
4982 TyVarseq of Info * TyVar list
4983
4984
4985 (* Operations *)
4986
4987 val infoAtExp: AtExp -> Info
4988 val infoExpRow: ExpRow -> Info
4989 val infoExp: Exp -> Info
4990 val infoMatch: Match -> Info
4991 val infoMrule: Mrule -> Info
4992 val infoDec: Dec -> Info
4993 val infoValBind: ValBind -> Info
4994 val infoTypBind: TypBind -> Info
4995 val infoDatBind: DatBind -> Info
4996 val infoConBind: ConBind -> Info
4997 val infoExBind: ExBind -> Info
4998 val infoAtPat: AtPat -> Info
4999 val infoPatRow: PatRow -> Info
5000 val infoPat: Pat -> Info
5001 val infoTy: Ty -> Info
5002 val infoTyRow: TyRow -> Info
5003 val infoTyseq: Tyseq -> Info
5004 val infoTyVarseq: TyVarseq -> Info
5005
5006 end
5007(* stop of GRAMMAR_CORE.sml *)
5008(* start of GrammarCoreFn.sml *)
5009(*
5010 * Standard ML abstract core grammar
5011 *
5012 * Definition, section 2.8
5013 *
5014 * Note:
5015 * This is the syntax used in the inference rules for the core [Definition,
5016 * sections 4.10 and 6.7]. It omits almost anything having to do with infixed
5017 * identifiers:
5018 * - fixity directives
5019 * - infixed application
5020 * - infixed value construction
5021 * However, op prefixes are kept, since they are required for rebuilding the
5022 * syntax tree during fixity resolution.
5023 * Optional semicolons are also omitted.
5024 *)
5025
5026functor GrammarCoreFn(type Info) : GRAMMAR_CORE =
5027 struct
5028
5029 (* Import *)
5030
5031 type Info = Info
5032
5033 type SCon = SCon.SCon
5034 type Lab = Lab.Lab
5035 type VId = VId.Id
5036 type TyCon = TyCon.Id
5037 type TyVar = TyVar.TyVar
5038 type StrId = StrId.Id
5039 type longVId = LongVId.longId
5040 type longTyCon = LongTyCon.longId
5041 type longStrId = LongStrId.longId
5042
5043
5044 (* Optional keyword `op' *)
5045
5046 datatype Op = SANSOp | WITHOp
5047
5048
5049 (* Expressions [Figures 2 and 4] *)
5050
5051 datatype AtExp =
5052 SCONAtExp of Info * SCon
5053 | LONGVIDAtExp of Info * Op * longVId
5054 | RECORDAtExp of Info * ExpRow option
5055 | LETAtExp of Info * Dec * Exp
5056 | PARAtExp of Info * Exp
5057
5058 and ExpRow =
5059 ExpRow of Info * Lab * Exp * ExpRow option
5060
5061 and Exp =
5062 ATEXPExp of Info * AtExp
5063 | APPExp of Info * Exp * AtExp
5064 | TYPEDExp of Info * Exp * Ty
5065 | HANDLEExp of Info * Exp * Match
5066 | RAISEExp of Info * Exp
5067 | FNExp of Info * Match
5068
5069 (* Matches [Figures 2 and 4] *)
5070
5071 and Match =
5072 Match of Info * Mrule * Match option
5073
5074 and Mrule =
5075 Mrule of Info * Pat * Exp
5076
5077 (* Declarations [Figures 2 and 4] *)
5078
5079 and Dec =
5080 VALDec of Info * TyVarseq * ValBind
5081 | TYPEDec of Info * TypBind
5082 | DATATYPEDec of Info * DatBind
5083 | REPLICATIONDec of Info * TyCon * longTyCon
5084 | ABSTYPEDec of Info * DatBind * Dec
5085 | EXCEPTIONDec of Info * ExBind
5086 | LOCALDec of Info * Dec * Dec
5087 | OPENDec of Info * longStrId list
5088 | EMPTYDec of Info
5089 | SEQDec of Info * Dec * Dec
5090
5091 (* Bindings [Figures 2 and 4] *)
5092
5093 and ValBind =
5094 PLAINValBind of Info * Pat * Exp * ValBind option
5095 | RECValBind of Info * ValBind
5096
5097 and TypBind =
5098 TypBind of Info * TyVarseq * TyCon * Ty * TypBind option
5099
5100 and DatBind =
5101 DatBind of Info * TyVarseq * TyCon * ConBind * DatBind option
5102
5103 and ConBind =
5104 ConBind of Info * Op * VId * Ty option * ConBind option
5105
5106 and ExBind =
5107 NEWExBind of Info * Op * VId * Ty option * ExBind option
5108 | EQUALExBind of Info * Op * VId * Op * longVId * ExBind option
5109
5110 (* Patterns [Figures 2 and 3] *)
5111
5112 and AtPat =
5113 WILDCARDAtPat of Info
5114 | SCONAtPat of Info * SCon
5115 | LONGVIDAtPat of Info * Op * longVId
5116 | RECORDAtPat of Info * PatRow option
5117 | PARAtPat of Info * Pat
5118
5119 and PatRow =
5120 WILDCARDPatRow of Info
5121 | ROWPatRow of Info * Lab * Pat * PatRow option
5122
5123 and Pat =
5124 ATPATPat of Info * AtPat
5125 | CONPat of Info * Op * longVId * AtPat
5126 | TYPEDPat of Info * Pat * Ty
5127 | ASPat of Info * Op * VId * Ty option * Pat
5128
5129 (* Type expressions [Figures 2 and 3] *)
5130
5131 and Ty =
5132 TYVARTy of Info * TyVar
5133 | RECORDTy of Info * TyRow option
5134 | TYCONTy of Info * Tyseq * longTyCon
5135 | ARROWTy of Info * Ty * Ty
5136 | PARTy of Info * Ty
5137
5138 and TyRow =
5139 TyRow of Info * Lab * Ty * TyRow option
5140
5141 (* Sequences [Section 2.8] *)
5142
5143 and Tyseq =
5144 Tyseq of Info * Ty list
5145
5146 and TyVarseq =
5147 TyVarseq of Info * TyVar list
5148
5149
5150
5151 (* Extracting info fields *)
5152
5153 fun infoAtExp(SCONAtExp(I,_)) = I
5154 | infoAtExp(LONGVIDAtExp(I,_,_)) = I
5155 | infoAtExp(RECORDAtExp(I,_)) = I
5156 | infoAtExp(LETAtExp(I,_,_)) = I
5157 | infoAtExp(PARAtExp(I,_)) = I
5158
5159 fun infoExpRow(ExpRow(I,_,_,_)) = I
5160
5161 fun infoExp(ATEXPExp(I,_)) = I
5162 | infoExp(APPExp(I,_,_)) = I
5163 | infoExp(TYPEDExp(I,_,_)) = I
5164 | infoExp(HANDLEExp(I,_,_)) = I
5165 | infoExp(RAISEExp(I,_)) = I
5166 | infoExp(FNExp(I,_)) = I
5167
5168 fun infoMatch(Match(I,_,_)) = I
5169
5170 fun infoMrule(Mrule(I,_,_)) = I
5171
5172 fun infoDec(VALDec(I,_,_)) = I
5173 | infoDec(TYPEDec(I,_)) = I
5174 | infoDec(DATATYPEDec(I,_)) = I
5175 | infoDec(REPLICATIONDec(I,_,_)) = I
5176 | infoDec(ABSTYPEDec(I,_,_)) = I
5177 | infoDec(EXCEPTIONDec(I,_)) = I
5178 | infoDec(LOCALDec(I,_,_)) = I
5179 | infoDec(OPENDec(I,_)) = I
5180 | infoDec(EMPTYDec(I)) = I
5181 | infoDec(SEQDec(I,_,_)) = I
5182
5183 fun infoValBind(PLAINValBind(I,_,_,_)) = I
5184 | infoValBind(RECValBind(I,_)) = I
5185
5186 fun infoTypBind(TypBind(I,_,_,_,_)) = I
5187
5188 fun infoDatBind(DatBind(I,_,_,_,_)) = I
5189
5190 fun infoConBind(ConBind(I,_,_,_,_)) = I
5191
5192 fun infoExBind(NEWExBind(I,_,_,_,_)) = I
5193 | infoExBind(EQUALExBind(I,_,_,_,_,_)) = I
5194
5195 fun infoAtPat(WILDCARDAtPat(I)) = I
5196 | infoAtPat(SCONAtPat(I,_)) = I
5197 | infoAtPat(LONGVIDAtPat(I,_,_)) = I
5198 | infoAtPat(RECORDAtPat(I,_)) = I
5199 | infoAtPat(PARAtPat(I,_)) = I
5200
5201 fun infoPatRow(WILDCARDPatRow(I)) = I
5202 | infoPatRow(ROWPatRow(I,_,_,_)) = I
5203
5204 fun infoPat(ATPATPat(I,_)) = I
5205 | infoPat(CONPat(I,_,_,_)) = I
5206 | infoPat(TYPEDPat(I,_,_)) = I
5207 | infoPat(ASPat(I,_,_,_,_)) = I
5208
5209 fun infoTy(TYVARTy(I,_)) = I
5210 | infoTy(RECORDTy(I,_)) = I
5211 | infoTy(TYCONTy(I,_,_)) = I
5212 | infoTy(ARROWTy(I,_,_)) = I
5213 | infoTy(PARTy(I,_)) = I
5214
5215 fun infoTyRow(TyRow(I,_,_,_)) = I
5216
5217 fun infoTyseq(Tyseq(I,_)) = I
5218 fun infoTyVarseq(TyVarseq(I,_)) = I
5219
5220 end
5221(* stop of GrammarCoreFn.sml *)
5222(* start of SOURCE.sml *)
5223(*
5224 * Helpers for handling source strings
5225 *)
5226
5227signature SOURCE =
5228 sig
5229
5230 type source = string
5231 type region = int * int
5232
5233 val over: region * region -> region
5234 val between: region * region -> region
5235
5236 val compare: region * region -> order
5237
5238 end
5239(* stop of SOURCE.sml *)
5240(* start of Source.sml *)
5241(*
5242 * Helpers for handling source strings
5243 *)
5244
5245structure Source :> SOURCE =
5246 struct
5247
5248 type source = string
5249 type region = int * int
5250
5251 fun over(r1: region, r2: region) = (#1 r1, #2 r2)
5252 fun between(r1: region, r2: region) = (#2 r1, #1 r2)
5253
5254 fun compare((m1,n1), (m2,n2)) =
5255 case Int.compare(m1, m2)
5256 of EQUAL => Int.compare(n1, n2)
5257 | order => order
5258
5259 end
5260(* stop of Source.sml *)
5261(* start of GRAMMAR_MODULE.sml *)
5262(*
5263 * Standard ML abstract module grammar
5264 *
5265 * Definition, section 3.4
5266 *
5267 * Notes:
5268 * This is the syntax used in the inference rules for modules [Definition,
5269 * sections 5.7 and 7.3]. Optional semicolons are omitted.
5270 * The structure sharing derived form [Definition, Appendix A] has been added,
5271 * because it cannot be derived purely syntactically.
5272 *)
5273
5274
5275signature GRAMMAR_MODULE =
5276 sig
5277
5278 (* Import *)
5279
5280 structure Core: GRAMMAR_CORE
5281
5282 type Info
5283
5284 type VId = Core.VId
5285 type TyCon = Core.TyCon
5286 type TyVar = Core.TyVar
5287 type StrId = Core.StrId
5288 type longVId = Core.longVId
5289 type longTyCon = Core.longTyCon
5290 type longStrId = Core.longStrId
5291 type Dec = Core.Dec
5292 type Ty = Core.Ty
5293 type TyVarseq = Core.TyVarseq
5294
5295 type SigId = SigId.Id
5296 type FunId = FunId.Id
5297
5298
5299 (* Structures [Figures 5 and 6] *)
5300
5301 datatype StrExp =
5302 STRUCTStrExp of Info * StrDec
5303 | LONGSTRIDStrExp of Info * longStrId
5304 | TRANSStrExp of Info * StrExp * SigExp
5305 | OPAQStrExp of Info * StrExp * SigExp
5306 | APPStrExp of Info * FunId * StrExp
5307 | LETStrExp of Info * StrDec * StrExp
5308
5309 and StrDec =
5310 DECStrDec of Info * Dec
5311 | STRUCTUREStrDec of Info * StrBind
5312 | LOCALStrDec of Info * StrDec * StrDec
5313 | EMPTYStrDec of Info
5314 | SEQStrDec of Info * StrDec * StrDec
5315
5316 and StrBind =
5317 StrBind of Info * StrId * StrExp * StrBind option
5318
5319 (* Signatures [Figures 5 and 6] *)
5320
5321 and SigExp =
5322 SIGSigExp of Info * Spec
5323 | SIGIDSigExp of Info * SigId
5324 | WHERETYPESigExp of Info * SigExp * TyVarseq * longTyCon * Ty
5325
5326 and SigDec =
5327 SigDec of Info * SigBind
5328
5329 and SigBind =
5330 SigBind of Info * SigId * SigExp * SigBind option
5331
5332 (* Specifications [Figures 5 and 7] *)
5333
5334 and Spec =
5335 VALSpec of Info * ValDesc
5336 | TYPESpec of Info * TypDesc
5337 | EQTYPESpec of Info * TypDesc
5338 | DATATYPESpec of Info * DatDesc
5339 | REPLICATIONSpec of Info * TyCon * longTyCon
5340 | EXCEPTIONSpec of Info * ExDesc
5341 | STRUCTURESpec of Info * StrDesc
5342 | INCLUDESpec of Info * SigExp
5343 | EMPTYSpec of Info
5344 | SEQSpec of Info * Spec * Spec
5345 | SHARINGTYPESpec of Info * Spec * longTyCon list
5346 | SHARINGSpec of Info * Spec * longStrId list
5347
5348 and ValDesc =
5349 ValDesc of Info * VId * Ty * ValDesc option
5350
5351 and TypDesc =
5352 TypDesc of Info * TyVarseq * TyCon * TypDesc option
5353
5354 and DatDesc =
5355 DatDesc of Info * TyVarseq * TyCon * ConDesc * DatDesc option
5356
5357 and ConDesc =
5358 ConDesc of Info * VId * Ty option * ConDesc option
5359
5360 and ExDesc =
5361 ExDesc of Info * VId * Ty option * ExDesc option
5362
5363 and StrDesc =
5364 StrDesc of Info * StrId * SigExp * StrDesc option
5365
5366 (* Functors [Figures 5 and 8] *)
5367
5368 and FunDec =
5369 FunDec of Info * FunBind
5370
5371 and FunBind =
5372 FunBind of Info * FunId * StrId * SigExp * StrExp
5373 * FunBind option
5374
5375 (* Top-level declarations [Figures 5 and 8] *)
5376
5377 and TopDec =
5378 STRDECTopDec of Info * StrDec * TopDec option
5379 | SIGDECTopDec of Info * SigDec * TopDec option
5380 | FUNDECTopDec of Info * FunDec * TopDec option
5381
5382
5383 (* Operations *)
5384
5385 val infoStrExp: StrExp -> Info
5386 val infoStrDec: StrDec -> Info
5387 val infoStrBind: StrBind -> Info
5388 val infoSigExp: SigExp -> Info
5389 val infoSigBind: SigBind -> Info
5390 val infoSpec: Spec -> Info
5391 val infoValDesc: ValDesc -> Info
5392 val infoTypDesc: TypDesc -> Info
5393 val infoDatDesc: DatDesc -> Info
5394 val infoConDesc: ConDesc -> Info
5395 val infoExDesc: ExDesc -> Info
5396 val infoStrDesc: StrDesc -> Info
5397 val infoFunDec: FunDec -> Info
5398 val infoFunBind: FunBind -> Info
5399 val infoTopDec: TopDec -> Info
5400
5401 end
5402(* stop of GRAMMAR_MODULE.sml *)
5403(* start of GrammarModuleFn.sml *)
5404(*
5405 * Standard ML abstract module grammar
5406 *
5407 * Definition, section 3.4
5408 *
5409 * Notes:
5410 * This is the syntax used in the inference rules for modules [Definition,
5411 * sections 5.7 and 7.3]. Optional semicolons are omitted.
5412 * The structure sharing derived form [Definition, Appendix A] has been added,
5413 * because it cannot be derived purely syntactically.
5414 *)
5415
5416
5417functor GrammarModuleFn(type Info
5418 structure Core: GRAMMAR_CORE
5419 ) : GRAMMAR_MODULE =
5420 struct
5421
5422 (* Import *)
5423
5424 structure Core = Core
5425 type Info = Info
5426
5427 open Core
5428
5429 type SigId = SigId.Id
5430 type FunId = FunId.Id
5431
5432
5433 (* Structures [Figures 5 and 6] *)
5434
5435 datatype StrExp =
5436 STRUCTStrExp of Info * StrDec
5437 | LONGSTRIDStrExp of Info * longStrId
5438 | TRANSStrExp of Info * StrExp * SigExp
5439 | OPAQStrExp of Info * StrExp * SigExp
5440 | APPStrExp of Info * FunId * StrExp
5441 | LETStrExp of Info * StrDec * StrExp
5442
5443 and StrDec =
5444 DECStrDec of Info * Dec
5445 | STRUCTUREStrDec of Info * StrBind
5446 | LOCALStrDec of Info * StrDec * StrDec
5447 | EMPTYStrDec of Info
5448 | SEQStrDec of Info * StrDec * StrDec
5449
5450 and StrBind =
5451 StrBind of Info * StrId * StrExp * StrBind option
5452
5453 (* Signatures [Figures 5 and 6] *)
5454
5455 and SigExp =
5456 SIGSigExp of Info * Spec
5457 | SIGIDSigExp of Info * SigId
5458 | WHERETYPESigExp of Info * SigExp * TyVarseq * longTyCon * Ty
5459
5460 and SigDec =
5461 SigDec of Info * SigBind
5462
5463 and SigBind =
5464 SigBind of Info * SigId * SigExp * SigBind option
5465
5466 (* Specifications [Figures 5 and 7] *)
5467
5468 and Spec =
5469 VALSpec of Info * ValDesc
5470 | TYPESpec of Info * TypDesc
5471 | EQTYPESpec of Info * TypDesc
5472 | DATATYPESpec of Info * DatDesc
5473 | REPLICATIONSpec of Info * TyCon * longTyCon
5474 | EXCEPTIONSpec of Info * ExDesc
5475 | STRUCTURESpec of Info * StrDesc
5476 | INCLUDESpec of Info * SigExp
5477 | EMPTYSpec of Info
5478 | SEQSpec of Info * Spec * Spec
5479 | SHARINGTYPESpec of Info * Spec * longTyCon list
5480 | SHARINGSpec of Info * Spec * longStrId list
5481
5482 and ValDesc =
5483 ValDesc of Info * VId * Ty * ValDesc option
5484
5485 and TypDesc =
5486 TypDesc of Info * TyVarseq * TyCon * TypDesc option
5487
5488 and DatDesc =
5489 DatDesc of Info * TyVarseq * TyCon * ConDesc * DatDesc option
5490
5491 and ConDesc =
5492 ConDesc of Info * VId * Ty option * ConDesc option
5493
5494 and ExDesc =
5495 ExDesc of Info * VId * Ty option * ExDesc option
5496
5497 and StrDesc =
5498 StrDesc of Info * StrId * SigExp * StrDesc option
5499
5500 (* Functors [Figures 5 and 8] *)
5501
5502 and FunDec =
5503 FunDec of Info * FunBind
5504
5505 and FunBind =
5506 FunBind of Info * FunId * StrId * SigExp * StrExp
5507 * FunBind option
5508
5509 (* Top-level declarations [Figures 5 and 8] *)
5510
5511 and TopDec =
5512 STRDECTopDec of Info * StrDec * TopDec option
5513 | SIGDECTopDec of Info * SigDec * TopDec option
5514 | FUNDECTopDec of Info * FunDec * TopDec option
5515
5516
5517 (* Extracting info fields *)
5518
5519 fun infoStrExp(STRUCTStrExp(I,_)) = I
5520 | infoStrExp(LONGSTRIDStrExp(I,_)) = I
5521 | infoStrExp(TRANSStrExp(I,_,_)) = I
5522 | infoStrExp(OPAQStrExp(I,_,_)) = I
5523 | infoStrExp(APPStrExp(I,_,_)) = I
5524 | infoStrExp(LETStrExp(I,_,_)) = I
5525
5526 fun infoStrDec(DECStrDec(I,_)) = I
5527 | infoStrDec(STRUCTUREStrDec(I,_)) = I
5528 | infoStrDec(LOCALStrDec(I,_,_)) = I
5529 | infoStrDec(EMPTYStrDec(I)) = I
5530 | infoStrDec(SEQStrDec(I,_,_)) = I
5531
5532 fun infoStrBind(StrBind(I,_,_,_)) = I
5533
5534 fun infoSigExp(SIGSigExp(I,_)) = I
5535 | infoSigExp(SIGIDSigExp(I,_)) = I
5536 | infoSigExp(WHERETYPESigExp(I,_,_,_,_)) = I
5537
5538 fun infoSigDec(SigDec(I,_)) = I
5539
5540 fun infoSigBind(SigBind(I,_,_,_)) = I
5541
5542 fun infoSpec(VALSpec(I,_)) = I
5543 | infoSpec(TYPESpec(I,_)) = I
5544 | infoSpec(EQTYPESpec(I,_)) = I
5545 | infoSpec(DATATYPESpec(I,_)) = I
5546 | infoSpec(REPLICATIONSpec(I,_,_)) = I
5547 | infoSpec(EXCEPTIONSpec(I,_)) = I
5548 | infoSpec(STRUCTURESpec(I,_)) = I
5549 | infoSpec(INCLUDESpec(I,_)) = I
5550 | infoSpec(EMPTYSpec(I)) = I
5551 | infoSpec(SEQSpec(I,_,_)) = I
5552 | infoSpec(SHARINGTYPESpec(I,_,_)) = I
5553 | infoSpec(SHARINGSpec(I,_,_)) = I
5554
5555 fun infoValDesc(ValDesc(I,_,_,_)) = I
5556 fun infoTypDesc(TypDesc(I,_,_,_)) = I
5557 fun infoDatDesc(DatDesc(I,_,_,_,_)) = I
5558 fun infoConDesc(ConDesc(I,_,_,_)) = I
5559 fun infoExDesc(ExDesc(I,_,_,_)) = I
5560 fun infoStrDesc(StrDesc(I,_,_,_)) = I
5561
5562 fun infoFunDec(FunDec(I,_)) = I
5563
5564 fun infoFunBind(FunBind(I,_,_,_,_,_)) = I
5565
5566 fun infoTopDec(STRDECTopDec(I,_,_)) = I
5567 | infoTopDec(SIGDECTopDec(I,_,_)) = I
5568 | infoTopDec(FUNDECTopDec(I,_,_)) = I
5569
5570 end
5571(* stop of GrammarModuleFn.sml *)
5572(* start of GRAMMAR_PROGRAM.sml *)
5573(*
5574 * Standard ML abstract program grammar
5575 *
5576 * Definition, section 8
5577 *)
5578
5579
5580signature GRAMMAR_PROGRAM =
5581 sig
5582
5583 (* Import *)
5584
5585 structure Module: GRAMMAR_MODULE
5586
5587 type Info = Module.Info
5588
5589 type TopDec = Module.TopDec
5590
5591
5592 (* Programs *)
5593
5594 datatype Program = Program of Info * TopDec * Program option
5595
5596
5597 (* Extracting the info field *)
5598
5599 val infoProgram: Program -> Info
5600
5601 end
5602(* stop of GRAMMAR_PROGRAM.sml *)
5603(* start of GrammarProgramFn.sml *)
5604(*
5605 * Standard ML abstract program grammar
5606 *
5607 * Definition, section 8
5608 *)
5609
5610
5611functor GrammarProgramFn(type Info
5612 structure Module: GRAMMAR_MODULE
5613 ) : GRAMMAR_PROGRAM =
5614 struct
5615
5616 (* Import *)
5617
5618 structure Module = Module
5619 type Info = Info
5620
5621 open Module
5622
5623
5624 (* Programs *)
5625
5626 datatype Program = Program of Info * TopDec * Program option
5627
5628
5629 (* Extracting the info field *)
5630
5631 fun infoProgram(Program(I,_,_)) = I
5632
5633 end
5634(* stop of GrammarProgramFn.sml *)
5635(* start of Grammars.sml *)
5636structure GrammarCore = GrammarCoreFn(type Info = Source.region)
5637
5638structure GrammarModule = GrammarModuleFn(type Info = Source.region
5639 structure Core = GrammarCore)
5640
5641structure GrammarProgram = GrammarProgramFn(type Info = Source.region
5642 structure Module = GrammarModule)
5643(* stop of Grammars.sml *)
5644(* start of DYNAMIC_ENV.sml *)
5645(*
5646 * Standard ML environments of the dynamic semantics of the core
5647 *
5648 * Definition, sections 6.3 and 6.6
5649 *
5650 * Notes:
5651 * - We call the domain type of value environments ValStr.
5652 * - The type definitions here are heavily recursive and it is really stupid
5653 * that SML allows no withtype in signatures...
5654 *)
5655
5656signature DYNAMIC_ENV =
5657 sig
5658
5659 (* Inheritance *)
5660
5661 include GENERIC_ENV
5662
5663
5664 (* Import types *)
5665
5666 type 'a Val = 'a Val.Val
5667 type Match = GrammarCore.Match
5668
5669
5670 (* Export types [Section 6.6] *)
5671
5672 datatype FcnClosure =
5673 FcnClosure of Match
5674 * ( (*Env*)
5675 ( FcnClosure Val * IdStatus
5676 , (FcnClosure Val * IdStatus) VIdMap
5677 ) Str' StrIdMap
5678 * (FcnClosure Val * IdStatus) VIdMap TyConMap
5679 * (FcnClosure Val * IdStatus) VIdMap
5680 )
5681 * (*ValEnv*) (FcnClosure Val * IdStatus) VIdMap
5682
5683 type ValStr = FcnClosure Val * IdStatus
5684 type ValEnv = ValStr VIdMap (* [VE] *)
5685
5686 type TyStr = ValEnv
5687 type TyEnv = TyStr TyConMap (* [TE] *)
5688
5689 type Str = (ValStr, TyStr) Str'
5690 type StrEnv = Str StrIdMap (* [SE] *)
5691
5692 type Env = StrEnv * TyEnv * ValEnv (* [E] *)
5693
5694
5695 (* Operations *)
5696
5697 val Rec: ValEnv -> ValEnv
5698
5699 end
5700(* stop of DYNAMIC_ENV.sml *)
5701(* start of DynamicEnv.sml *)
5702(*
5703 * Standard ML environments of the dynamic semantics of the core
5704 *
5705 * Definition, sections 6.3 and 6.6
5706 *
5707 * Notes:
5708 * - We call the domain type of value environments ValStr.
5709 * - The type definitions here are heavily recursive. It would be easier if
5710 * SML would define withtype sequentially (as SML/NJ implements it).
5711 * However, it is still better than inside the signature...
5712 *)
5713
5714structure DynamicEnv :> DYNAMIC_ENV =
5715 struct
5716
5717 (* Inheritance *)
5718
5719 structure GenericEnv = GenericEnvFn()
5720
5721 open GenericEnv
5722
5723
5724 (* Import types *)
5725
5726 type 'a Val = 'a Val.Val
5727 type Match = GrammarCore.Match
5728
5729
5730 (* Export types [Section 6.6] *)
5731
5732 datatype FcnClosure =
5733 FcnClosure of Match * ((*Env*) StrEnv * TyEnv * ValEnv) * ValEnv
5734
5735 withtype ValEnv = (FcnClosure Val * IdStatus) VIdMap (* [VE] *)
5736 and TyEnv = (FcnClosure Val * IdStatus) VIdMap TyConMap (* [TE] *)
5737 and StrEnv = (FcnClosure Val * IdStatus,
5738 (FcnClosure Val * IdStatus) VIdMap) Str' StrIdMap
5739 (* [SE] *)
5740 type ValStr = FcnClosure Val * IdStatus
5741 type TyStr = ValEnv
5742 type Str = (ValStr, TyStr) Str'
5743
5744 type Env = StrEnv * TyEnv * ValEnv (* [E] *)
5745
5746
5747 (* Unrolling [Section 6.6] *)
5748
5749 fun Rec VE =
5750 VIdMap.map
5751 (fn (Val.FcnClosure(FcnClosure(match',E',VE')), IdStatus.v) =>
5752 (Val.FcnClosure(FcnClosure(match',E',VE)), IdStatus.v)
5753 | valstr => valstr
5754 ) VE
5755
5756 end
5757(* stop of DynamicEnv.sml *)
5758(* start of INITIAL_DYNAMIC_ENV.sml *)
5759(*
5760 * Standard ML core view of the initial dynamic basis
5761 *
5762 * Definition, appendix D and section 6.5
5763 *
5764 * Note:
5765 * The Definition does not specify what the initial state has to contain.
5766 * This is a bug as it must at least contain the exception names Match
5767 * and Bind. We put the state associated with the initial environment in
5768 * here, too.
5769 *)
5770
5771signature INITIAL_DYNAMIC_ENV =
5772 sig
5773
5774 (* Import types *)
5775
5776 type Env = DynamicEnv.Env
5777 type ExName = ExName.ExName
5778 type State = DynamicEnv.FcnClosure State.State
5779
5780
5781 (* Basic exception names [Section 6.5] *)
5782
5783 val enMatch: ExName
5784 val enBind: ExName
5785
5786 (* Initial environment [Appendix D] *)
5787
5788 val E0: Env
5789
5790 (* Associated state *)
5791
5792 val s: State
5793
5794 end
5795(* stop of INITIAL_DYNAMIC_ENV.sml *)
5796(* start of InitialDynamicEnv.sml *)
5797(*
5798 * Standard ML core view of the initial dynamic basis
5799 *
5800 * Definition, appendix D and section 6.5
5801 *
5802 * Note:
5803 * The Definition does not specify what the initial state has to contain.
5804 * This is a bug as it must at least contain the exception names Match
5805 * and Bind. We put the state associated with the initial environment in
5806 * here, too.
5807 *)
5808
5809structure InitialDynamicEnv :> INITIAL_DYNAMIC_ENV =
5810 struct
5811
5812 (* Import *)
5813
5814 type Env = DynamicEnv.Env
5815 type ValEnv = DynamicEnv.ValEnv
5816 type ExName = ExName.ExName
5817 type State = DynamicEnv.FcnClosure State.State
5818
5819
5820 open Val
5821 open IdStatus
5822
5823
5824 (* VIds [Appendix D] *)
5825
5826 val vidEq = VId.fromString "="
5827 val vidAssign = VId.fromString ":="
5828
5829 val vidFalse = VId.fromString "false"
5830 val vidTrue = VId.fromString "true"
5831 val vidNil = VId.fromString "nil"
5832 val vidCons = VId.fromString "::"
5833 val vidRef = VId.fromString "ref"
5834
5835 val vidMatch = VId.fromString "Match"
5836 val vidBind = VId.fromString "Bind"
5837
5838
5839 (* Basic exception names [Section 6.5] *)
5840
5841 val enMatch = ExName.exname vidMatch
5842 val enBind = ExName.exname vidBind
5843
5844
5845 (* Value entries [Appendix D] *)
5846
5847 val valstrEq = (BasVal "=", v)
5848 val valstrAssign = (op:=, v)
5849
5850 val valstrFalse = (VId vidFalse, c)
5851 val valstrTrue = (VId vidTrue, c)
5852 val valstrNil = (VId vidNil, c)
5853 val valstrCons = (VId vidCons, c)
5854 val valstrRef = (VId vidRef, c)
5855
5856 val valstrMatch = (ExVal(ExName enMatch), e)
5857 val valstrBind = (ExVal(ExName enBind), e)
5858
5859
5860 (* TyCons [Figure 26] *)
5861
5862 val tyconUnit = TyCon.fromString "unit"
5863 val tyconBool = TyCon.fromString "bool"
5864 val tyconInt = TyCon.fromString "int"
5865 val tyconWord = TyCon.fromString "word"
5866 val tyconReal = TyCon.fromString "real"
5867 val tyconString = TyCon.fromString "string"
5868 val tyconChar = TyCon.fromString "char"
5869 val tyconList = TyCon.fromString "list"
5870 val tyconRef = TyCon.fromString "ref"
5871 val tyconExn = TyCon.fromString "exn"
5872
5873
5874 (* Type ValEnvs [Figure 26] *)
5875
5876 val VEUnit = VIdMap.empty
5877 val VEBool = VIdMap.fromList[(vidFalse, valstrFalse),
5878 (vidTrue, valstrTrue)] : ValEnv
5879 val VEInt = VIdMap.empty
5880 val VEWord = VIdMap.empty
5881 val VEReal = VIdMap.empty
5882 val VEString = VIdMap.empty
5883 val VEChar = VIdMap.empty
5884 val VEList = VIdMap.fromList[(vidNil, valstrNil),
5885 (vidCons, valstrCons)] : ValEnv
5886 val VERef = VIdMap.fromList[(vidRef, valstrRef)] : ValEnv
5887 val VEExn = VIdMap.empty
5888
5889
5890 (* Environments [Appendix D] *)
5891
5892 val SE0 = StrIdMap.empty
5893
5894 val TE0 = TyConMap.fromList[(tyconUnit, VEUnit),
5895 (tyconBool, VEBool),
5896 (tyconInt, VEInt),
5897 (tyconWord, VEWord),
5898 (tyconReal, VEReal),
5899 (tyconString, VEString),
5900 (tyconChar, VEChar),
5901 (tyconList, VEList),
5902 (tyconRef, VERef),
5903 (tyconExn, VEExn)]
5904
5905 val VE0 = VIdMap.fromList [(vidEq, valstrEq),
5906 (vidAssign, valstrAssign),
5907 (vidRef, valstrRef),
5908 (vidNil, valstrNil),
5909 (vidCons, valstrCons),
5910 (vidFalse, valstrFalse),
5911 (vidTrue, valstrTrue),
5912 (vidMatch, valstrMatch),
5913 (vidBind, valstrBind)] : ValEnv
5914
5915 val E0 = (SE0,TE0,VE0)
5916
5917
5918 (* Associated state *)
5919
5920 val mem = AddrMap.empty
5921 val ens = ExNameSet.fromList[enMatch, enBind]
5922
5923 val s = (mem, ens)
5924
5925 end
5926(* stop of InitialDynamicEnv.sml *)
5927(* start of INTERFACE.sml *)
5928(*
5929 * Standard ML interfaces
5930 *
5931 * Definition, section 7.2
5932 *)
5933
5934signature INTERFACE =
5935 sig
5936
5937 (* Inheritance *)
5938
5939 include GENERIC_ENV
5940
5941
5942 (* Import *)
5943
5944 type Env = DynamicEnv.Env
5945
5946
5947 (* Export types [Section 7.2] *)
5948
5949 type ValInt = IdStatus VIdMap (* [VI] *)
5950 type TyInt = ValInt TyConMap (* [TI] *)
5951
5952 type Str = (IdStatus, ValInt) Str'
5953 type StrInt = Str StrIdMap (* [SI] *)
5954
5955 type Int = StrInt * TyInt * ValInt (* [I] *)
5956
5957
5958 (* Operations *)
5959
5960 val fromSI: StrInt -> Int
5961 val fromTI: TyInt -> Int
5962 val fromVI: ValInt -> Int
5963 val fromVIandTI: ValInt * TyInt -> Int
5964
5965 val Inter: Env -> Int
5966 val cutdown: Env * Int -> Env
5967
5968 end
5969(* stop of INTERFACE.sml *)
5970(* start of Interface.sml *)
5971(*
5972 * Standard ML interfaces
5973 *
5974 * Definition, section 7.2
5975 *)
5976
5977
5978structure Interface :> INTERFACE =
5979 struct
5980
5981 (* Inheritance *)
5982
5983 structure GenericEnv = GenericEnvFn()
5984
5985 open GenericEnv
5986
5987
5988 (* Import *)
5989
5990 type Env = DynamicEnv.Env
5991
5992
5993 (* Export types [Section 7.2] *)
5994
5995 type ValInt = IdStatus VIdMap (* [VI] *)
5996 type TyInt = ValInt TyConMap (* [TI] *)
5997
5998 type Str = (IdStatus, ValInt) Str'
5999 type StrInt = Str StrIdMap (* [SI] *)
6000
6001 type Int = StrInt * TyInt * ValInt (* [I] *)
6002
6003
6004 (* Injections [Section 4.3] *)
6005
6006 val fromSI = fromSE
6007 val fromTI = fromTE
6008 val fromVI = fromVE
6009 val fromVIandTI = fromVEandTE
6010
6011
6012 (* Extracting interfaces from environments [Section 7.2] *)
6013
6014 fun InterVE VE = VIdMap.map (fn(v,is) => is) VE
6015 fun InterTE TE = TyConMap.map (fn VE => InterVE VE) TE
6016 fun InterSE SE = StrIdMap.map (fn DynamicEnv.Str E => Str(Inter E)) SE
6017
6018 and Inter (SE,TE,VE) = (InterSE SE, InterTE TE, InterVE VE)
6019
6020
6021 (* Cutting down environments [Section 7.2] *)
6022
6023 fun cutdownVE(VE, VI) =
6024 VIdMap.foldli
6025 (fn(vid, is, VE') =>
6026 case VIdMap.find(VE, vid)
6027 of SOME(v,is') => VIdMap.insert(VE', vid, (v,is))
6028 | NONE => VE'
6029 ) VIdMap.empty VI
6030
6031 fun cutdownTE(TE, TI) =
6032 TyConMap.foldli
6033 (fn(tycon, VI', TE') =>
6034 case TyConMap.find(TE, tycon)
6035 of SOME VE' => TyConMap.insert(TE', tycon, cutdownVE(VE',VI'))
6036 | NONE => TE'
6037 ) TyConMap.empty TI
6038
6039 fun cutdownSE(SE, SI) =
6040 StrIdMap.foldli
6041 (fn(strid, Str I, SE') =>
6042 case StrIdMap.find(SE, strid)
6043 of SOME(DynamicEnv.Str E) =>
6044 StrIdMap.insert(SE', strid, DynamicEnv.Str(cutdown(E,I)))
6045 | NONE => SE'
6046 ) StrIdMap.empty SI
6047
6048 and cutdown((SE,TE,VE), (SI,TI,VI)) =
6049 ( cutdownSE(SE, SI), cutdownTE(TE, TI), cutdownVE(VE, VI) )
6050
6051 end
6052(* stop of Interface.sml *)
6053(* start of DYNAMIC_BASIS.sml *)
6054(*
6055 * Standard ML dynamic basis and environments of modules
6056 *
6057 * Definition, section 7.2
6058 *)
6059
6060signature DYNAMIC_BASIS =
6061 sig
6062
6063 (* Import types *)
6064
6065 type StrId = StrId.Id
6066 type SigId = SigId.Id
6067 type FunId = FunId.Id
6068 type longStrId = LongStrId.longId
6069 type longTyCon = LongTyCon.longId
6070 type Env = DynamicEnv.Env
6071 type ValEnv = DynamicEnv.ValEnv
6072 type StrEnv = DynamicEnv.StrEnv
6073 type Str = DynamicEnv.Str
6074 type Int = Interface.Int
6075 type StrExp = GrammarModule.StrExp
6076
6077 type 'a SigIdMap = 'a SigIdMap.map
6078 type 'a FunIdMap = 'a FunIdMap.map
6079
6080
6081 (* Types [Section 7.2] *)
6082
6083 datatype FunctorClosure =
6084 FunctorClosure of (StrId * Int) * StrExp *
6085 (*Basis*) (FunctorClosure FunIdMap * Int SigIdMap * Env)
6086
6087 type SigEnv = Int SigIdMap (* [G] *)
6088 type FunEnv = FunctorClosure FunIdMap (* [F] *)
6089
6090 type Basis = FunEnv * SigEnv * Env (* [B] *)
6091
6092
6093 (* Operations *)
6094
6095 val empty: Basis
6096 val fromE: Env -> Basis
6097 val fromF: FunEnv -> Basis
6098 val fromG: SigEnv -> Basis
6099
6100 val Eof: Basis -> Env
6101
6102 val plus: Basis * Basis -> Basis
6103 val plusSE: Basis * StrEnv -> Basis
6104 val plusG: Basis * SigEnv -> Basis
6105 val plusF: Basis * FunEnv -> Basis
6106 val plusE: Basis * Env -> Basis
6107
6108 val findStrId: Basis * StrId -> Str option
6109 val findSigId: Basis * SigId -> Int option
6110 val findFunId: Basis * FunId -> FunctorClosure option
6111 val findLongStrId: Basis * longStrId -> Str option
6112 val findLongTyCon: Basis * longTyCon -> ValEnv option
6113
6114 end
6115(* stop of DYNAMIC_BASIS.sml *)
6116(* start of DynamicBasis.sml *)
6117(*
6118 * Standard ML dynamic basis and environments of modules
6119 *
6120 * Definition, section 7.2
6121 *)
6122
6123
6124structure DynamicBasis :> DYNAMIC_BASIS =
6125 struct
6126
6127 (* Import types *)
6128
6129 type StrId = StrId.Id
6130 type SigId = SigId.Id
6131 type FunId = FunId.Id
6132 type longStrId = LongStrId.longId
6133 type longTyCon = LongTyCon.longId
6134 type Env = DynamicEnv.Env
6135 type ValEnv = DynamicEnv.ValEnv
6136 type StrEnv = DynamicEnv.StrEnv
6137 type Str = DynamicEnv.Str
6138 type Int = Interface.Int
6139 type StrExp = GrammarModule.StrExp
6140
6141 type 'a SigIdMap = 'a SigIdMap.map
6142 type 'a FunIdMap = 'a FunIdMap.map
6143
6144
6145 (* Types [Section 7.2] *)
6146
6147 datatype FunctorClosure =
6148 FunctorClosure of (StrId * Int) * StrExp *
6149 (*Basis*) (FunEnv * SigEnv * Env)
6150
6151 withtype SigEnv = Int SigIdMap (* [G] *)
6152 and FunEnv = FunctorClosure FunIdMap (* [F] *)
6153
6154 type Basis = FunEnv * SigEnv * Env (* [B] *)
6155
6156
6157
6158 (* Injections [Sections 4.3 and 7.2] *)
6159
6160 val empty = ( FunIdMap.empty, SigIdMap.empty, DynamicEnv.empty )
6161
6162 fun fromE E = ( FunIdMap.empty, SigIdMap.empty, E )
6163 fun fromF F = ( F, SigIdMap.empty, DynamicEnv.empty )
6164 fun fromG G = ( FunIdMap.empty, G, DynamicEnv.empty )
6165
6166
6167 (* Injections [Sections 4.3 and 7.2] *)
6168
6169 fun Eof (F,G,E) = E
6170
6171
6172 (* Modifications [Sections 4.3 and 7.2] *)
6173
6174 infix plus plusG plusF plusE plusSE IBplusI
6175
6176 fun (F,G,E) plus (F',G',E') =
6177 ( FunIdMap.unionWith #2 (F,F')
6178 , SigIdMap.unionWith #2 (G,G')
6179 , DynamicEnv.plus(E,E')
6180 )
6181
6182 fun (F,G,E) plusG G' = ( F, SigIdMap.unionWith #2 (G,G'), E )
6183 fun (F,G,E) plusF F' = ( FunIdMap.unionWith #2 (F,F'), G, E )
6184 fun (F,G,E) plusE E' = ( F, G, DynamicEnv.plus(E,E') )
6185 fun (F,G,E) plusSE SE = ( F, G, DynamicEnv.plusSE(E,SE) )
6186
6187
6188 (* Application (lookup) [Sections 7.2 and 4.3] *)
6189
6190 fun findStrId((F,G,E), strid) = DynamicEnv.findStrId(E, strid)
6191 fun findSigId((F,G,E), sigid) = SigIdMap.find(G, sigid)
6192 fun findFunId((F,G,E), funid) = FunIdMap.find(F, funid)
6193 fun findLongStrId((F,G,E), longstrid) =
6194 DynamicEnv.findLongStrId(E, longstrid)
6195 fun findLongTyCon((F,G,E), longtycon) =
6196 DynamicEnv.findLongTyCon(E, longtycon)
6197
6198 end
6199(* stop of DynamicBasis.sml *)
6200(* start of INITIAL_DYNAMIC_BASIS.sml *)
6201(*
6202 * Standard ML initial dynamic basis
6203 *
6204 * Definition, appendix D
6205 *
6206 * Note:
6207 * The Definition does not specify what the initial state has to contain.
6208 * This is a bug as it must at least contain the exception names Match
6209 * and Bind. We put the state associated with the initial basis in
6210 * here, too.
6211 *)
6212
6213signature INITIAL_DYNAMIC_BASIS =
6214 sig
6215
6216 (* Import *)
6217
6218 type Basis = DynamicBasis.Basis
6219 type State = InitialDynamicEnv.State
6220
6221
6222 (* Export *)
6223
6224 val B0: Basis
6225 val s: State
6226
6227 end
6228(* stop of INITIAL_DYNAMIC_BASIS.sml *)
6229(* start of InitialDynamicBasis.sml *)
6230(*
6231 * Standard ML initial dynamic basis
6232 *
6233 * Definition, appendix D
6234 *
6235 * Note:
6236 * The Definition does not specify what the initial state has to contain.
6237 * This is a bug as it must at least contain the exception names Match
6238 * and Bind. We put the state associated with the initial basis in
6239 * here, too.
6240 *)
6241
6242structure InitialDynamicBasis :> INITIAL_DYNAMIC_BASIS =
6243 struct
6244
6245 (* Import *)
6246
6247 type Basis = DynamicBasis.Basis
6248 type State = InitialDynamicEnv.State
6249
6250
6251 (* Enviornments *)
6252
6253 val F0 = FunIdMap.empty
6254 val G0 = SigIdMap.empty
6255 val E0 = InitialDynamicEnv.E0
6256
6257 val B0 = (F0,G0,E0)
6258
6259
6260 (* Associated state *)
6261
6262 val s = InitialDynamicEnv.s
6263
6264 end
6265(* stop of InitialDynamicBasis.sml *)
6266(* start of ERROR.sml *)
6267(*
6268 * Error handling.
6269 *)
6270
6271
6272signature ERROR =
6273 sig
6274
6275 (* Import *)
6276
6277 type position = Source.region
6278
6279
6280 (* Export *)
6281
6282 exception Error of position * string
6283
6284 val error: position * string -> 'a
6285 val warning: position * string -> unit
6286
6287 end
6288(* stop of ERROR.sml *)
6289(* start of Error.sml *)
6290(*
6291 * Error handling.
6292 *)
6293
6294
6295structure Error :> ERROR =
6296 struct
6297
6298 (* Import *)
6299
6300 type position = Source.region
6301
6302
6303 (* Helper *)
6304
6305 fun print((pos1,pos2), message) =
6306 let
6307 val a = Int.toString pos1
6308 val b = Int.toString pos2
6309 in
6310 TextIO.output(TextIO.stdErr, a ^ "-" ^ b ^ ": " ^ message ^ "\n")
6311 ; TextIO.flushOut TextIO.stdErr
6312 end
6313
6314
6315 (* Export *)
6316
6317 exception Error of position * string
6318
6319 fun error(pos, message) =
6320 ( print(pos, message)
6321 ; raise Error(pos, message)
6322 )
6323
6324 fun warning(pos, message) =
6325 print(pos, "warning: " ^ message)
6326
6327 end
6328(* stop of Error.sml *)
6329(* start of INFIX.sml *)
6330(*
6331 * Standard ML infix resolution
6332 *
6333 * Definition, section 2.6
6334 *)
6335
6336
6337signature INFIX =
6338 sig
6339
6340 (* Import *)
6341
6342 type Info = GrammarCore.Info
6343
6344 type Op = GrammarCore.Op
6345 type VId = GrammarCore.VId
6346 type longVId = GrammarCore.longVId
6347 type Exp = GrammarCore.Exp
6348 type Pat = GrammarCore.Pat
6349 type AtExp = GrammarCore.AtExp
6350 type AtPat = GrammarCore.AtPat
6351
6352
6353 (* Modifying fixity status *)
6354
6355 datatype Assoc = LEFT | RIGHT
6356
6357 type InfStatus = Assoc * int
6358 type InfEnv = InfStatus VIdMap.map (* [J] *)
6359
6360 val empty: InfEnv
6361 val assign: InfEnv * VId list * InfStatus -> InfEnv
6362 val cancel: InfEnv * VId list -> InfEnv
6363
6364
6365 (* Resolving phrases containing infixed identifiers *)
6366
6367 val parseExp: InfEnv * AtExp list -> Exp
6368 val parsePat: InfEnv * AtPat list -> Pat
6369 val parseFmrule: InfEnv * AtPat list -> Op * VId * AtPat list
6370
6371 end
6372(* stop of INFIX.sml *)
6373(* start of Infix.sml *)
6374(*
6375 * Standard ML infix resolution
6376 *
6377 * Definition, section 2.6
6378 *)
6379
6380
6381structure Infix :> INFIX =
6382 struct
6383
6384 (* Import *)
6385
6386 open GrammarCore
6387
6388
6389 (* Type definitions *)
6390
6391 datatype Assoc = LEFT | RIGHT
6392
6393 type InfStatus = Assoc * int
6394
6395 type InfEnv = InfStatus VIdMap.map (* [J] *)
6396
6397
6398
6399 (* Modifying infix environments *)
6400
6401 val empty = VIdMap.empty
6402
6403 fun assign(J, vids, infstatus) =
6404 let
6405 fun insert(vid, J) = VIdMap.insert(J, vid, infstatus)
6406 in
6407 List.foldl insert J vids
6408 end
6409
6410 fun cancel(J, vids) =
6411 let
6412 fun remove(vid, J) = #1(VIdMap.remove(J, vid))
6413 in
6414 List.foldl remove J vids
6415 end
6416
6417
6418
6419 (* Helpers for error messages *)
6420
6421 val error = Error.error
6422 fun errorVId(I, s, vid) = error(I, s ^ VId.toString vid)
6423 fun errorLongVId(I, s, longvid) = error(I, s ^ LongVId.toString longvid)
6424
6425
6426
6427 (* Categorisation of atomic expressions and patterns *)
6428
6429 datatype 'a FixityCategory = NONFIX of 'a
6430 | INFIX of InfStatus * VId * Info
6431
6432 fun isInfix J (longvid) =
6433 LongVId.isUnqualified longvid andalso
6434 VIdMap.find(J, LongVId.toId longvid) <> NONE
6435
6436 fun categoriseLongVId J (atomic, I, longvid) =
6437 if LongVId.isUnqualified longvid then
6438 let
6439 val vid = LongVId.toId longvid
6440 in
6441 case VIdMap.find(J, vid)
6442 of NONE => NONFIX(atomic)
6443 | SOME infstatus => INFIX(infstatus, vid, I)
6444 end
6445 else
6446 NONFIX(atomic)
6447
6448 fun categoriseAtExp J (atexp as LONGVIDAtExp(I, SANSOp, longvid)) =
6449 categoriseLongVId J (atexp, I, longvid)
6450 | categoriseAtExp J (atexp) = NONFIX(atexp)
6451
6452 fun categoriseAtPat J (atpat as LONGVIDAtPat(I, SANSOp, longvid)) =
6453 categoriseLongVId J (atpat, I, longvid)
6454 | categoriseAtPat J (atpat) = NONFIX(atpat)
6455
6456
6457
6458 (* Resolving infixing [Section 2.6] *)
6459
6460 fun parse(app, infapp, es) =
6461 let
6462 fun loop(NONFIX(e)::[], []) = e
6463
6464 | loop(NONFIX(e2)::NONFIX(e1)::s', i) =
6465 (* reduce nonfix application *)
6466 loop(NONFIX(app(e1, e2))::s', i)
6467
6468 | loop(s, NONFIX(e)::i') =
6469 (* shift *)
6470 loop(NONFIX(e)::s, i')
6471
6472 | loop(s as NONFIX(e)::[], INFIX(x)::i') =
6473 (* shift *)
6474 loop(INFIX(x)::s, i')
6475
6476 | loop(NONFIX(e2)::INFIX(_,vid,_)::NONFIX(e1)::s', []) =
6477 (* reduce infix application *)
6478 loop(NONFIX(infapp(e1, vid, e2))::s', [])
6479
6480 | loop(s as NONFIX(e2)::INFIX((a1,p1),vid1,I1)::NONFIX(e1)::s',
6481 i as INFIX(x2 as ((a2,p2),vid2,I2))::i') =
6482 if p1 > p2 then
6483 (* reduce infix application *)
6484 loop(NONFIX(infapp(e1, vid1, e2))::s', i)
6485 else if p1 < p2 then
6486 (* shift *)
6487 loop(INFIX(x2)::s, i')
6488 else if a1 <> a2 then
6489 error(Source.over(I1,I2), "conflicting infix associativity")
6490 else if a1 = LEFT then
6491 (* reduce infix application *)
6492 loop(NONFIX(infapp(e1, vid1, e2))::s', i)
6493 else (* a1 = RIGHT *)
6494 (* shift *)
6495 loop(INFIX(x2)::s, i')
6496
6497 | loop(INFIX(_, vid, I)::s, []) =
6498 errorVId(I, "misplaced infix identifier ", vid)
6499
6500 | loop(INFIX(x)::s, INFIX(_, vid, I)::i) =
6501 errorVId(I, "misplaced infix identifier ", vid)
6502
6503 | loop([], INFIX(_, vid, I)::i) =
6504 errorVId(I, "misplaced infix identifier ", vid)
6505
6506 | loop _ = raise Fail "Infix.parse: inconsistency"
6507 in
6508 loop([], es)
6509 end
6510
6511
6512 (* Resolving infixed expressions [Section 2.6] *)
6513
6514 fun atexpExp(PARAtExp(_, exp)) = exp
6515 | atexpExp atexp = ATEXPExp(infoAtExp atexp, atexp)
6516
6517 fun appExp(atexp1, atexp2) =
6518 let
6519 val I1 = infoAtExp atexp1
6520 val I2 = infoAtExp atexp2
6521 val I = Source.over(I1, I2)
6522 in
6523 PARAtExp(I, APPExp(I, atexpExp atexp1, atexp2))
6524 end
6525
6526 fun pairExp(atexp1, atexp2) =
6527 let
6528 val I1 = infoAtExp atexp1
6529 val I2 = infoAtExp atexp2
6530 val lab1 = Lab.fromInt 1
6531 val lab2 = Lab.fromInt 2
6532 val exprow2 = ExpRow(I2, lab2, atexpExp atexp2, NONE)
6533 val exprow1 = ExpRow(I1, lab1, atexpExp atexp1, SOME exprow2)
6534 in
6535 RECORDAtExp(Source.over(I1,I2), SOME exprow1)
6536 end
6537
6538 fun infappExp(atexp1, vid, atexp2) =
6539 let
6540 val Ivid = Source.between(infoAtExp atexp1, infoAtExp atexp2)
6541 val longvid = LongVId.fromId vid
6542 val atexp1' = LONGVIDAtExp(Ivid, SANSOp, longvid)
6543 val atexp2' = pairExp(atexp1, atexp2)
6544 in
6545 appExp(atexp1', atexp2')
6546 end
6547
6548
6549 fun parseExp(J, atexps) =
6550 let
6551 val atexp = parse(appExp, infappExp,
6552 List.map (categoriseAtExp J) atexps)
6553 in
6554 atexpExp atexp
6555 end
6556
6557
6558 (* Resolving infixed patterns [Section 2.6] *)
6559
6560 fun atpatPat(PARAtPat(_, pat)) = pat
6561 | atpatPat atpat = ATPATPat(infoAtPat atpat, atpat)
6562
6563 fun conPat(LONGVIDAtPat(I1, op_opt, longvid), atpat) =
6564 let
6565 val I2 = infoAtPat atpat
6566 val I = Source.over(I1, I2)
6567 in
6568 PARAtPat(I, CONPat(I, op_opt, longvid, atpat))
6569 end
6570
6571 | conPat(_, atpat) =
6572 error(infoAtPat atpat, "misplaced atomic pattern")
6573
6574 fun pairPat(atpat1, atpat2) =
6575 let
6576 val I1 = infoAtPat atpat1
6577 val I2 = infoAtPat atpat2
6578 val lab1 = Lab.fromInt 1
6579 val lab2 = Lab.fromInt 2
6580 val patrow2 = ROWPatRow(I2, lab2, atpatPat atpat2, NONE)
6581 val patrow1 = ROWPatRow(I1, lab1, atpatPat atpat1, SOME patrow2)
6582 in
6583 RECORDAtPat(Source.over(I1,I2), SOME patrow1)
6584 end
6585
6586 fun infconPat(atpat1, vid, atpat2) =
6587 let
6588 val Ivid = Source.between(infoAtPat atpat1, infoAtPat atpat2)
6589 val longvid = LongVId.fromId vid
6590 val atpat1' = LONGVIDAtPat(Ivid, SANSOp, longvid)
6591 val atpat2' = pairPat(atpat1, atpat2)
6592 in
6593 conPat(atpat1', atpat2')
6594 end
6595
6596
6597 fun parsePat(J, atpats) =
6598 let
6599 val atpat = parse(conPat, infconPat,
6600 List.map (categoriseAtPat J) atpats)
6601 in
6602 atpatPat atpat
6603 end
6604
6605
6606 (* Resolving fun match rules [Figure 21, note] *)
6607
6608 fun parseFmrule(J, atpats) =
6609 (*
6610 * Allowed is the following:
6611 * (1) <op> vid atpat+
6612 * (2) (atpat infix_vid atpat) atpat*
6613 * (3) atpat infix_vid atpat
6614 *)
6615 let
6616 fun checkNonfixity [] = true
6617 | checkNonfixity(NONFIX _::t) = checkNonfixity t
6618 | checkNonfixity(INFIX(_, vid, I)::t) =
6619 errorVId(I, "misplaced infix identifier ", vid)
6620
6621 fun maybeNonfixClause(ps) =
6622 case List.hd atpats
6623 of LONGVIDAtPat(I, op_opt, longvid) =>
6624 if not(LongVId.isUnqualified longvid) then
6625 errorLongVId(I, "misplaced long identifier ",
6626 longvid)
6627 else if List.length atpats < 2 then
6628 error(I, "missing function arguments")
6629 else
6630 ( checkNonfixity ps (* including 1st *)
6631 ; ( op_opt, LongVId.toId longvid, List.tl atpats )
6632 )
6633 | WILDCARDAtPat(I) =>
6634 error(I, "misplaced wildcard pattern")
6635 | SCONAtPat(I, _) =>
6636 error(I, "misplaced constant pattern")
6637 | RECORDAtPat(I, _) =>
6638 error(I, "misplaced record or tuple pattern")
6639 | PARAtPat(I, _) =>
6640 error(I, "misplaced parenthesised pattern")
6641
6642 fun maybeParenthesisedInfixClause(ps) =
6643 case List.hd ps
6644 of NONFIX(PARAtPat(_, CONPat(I, SANSOp, longvid, atpat))) =>
6645 if not(LongVId.isUnqualified longvid) then
6646 errorLongVId(I, "misplaced long identifier ",
6647 longvid)
6648 else if not(isInfix J longvid) then
6649 error(I, "misplaced non-infix pattern")
6650 else
6651 (* Now, longvid has infix status but is sans `op',
6652 so it can only result from resolving an
6653 appropriate infix construction. *)
6654 ( checkNonfixity(List.tl ps)
6655 ; ( SANSOp, LongVId.toId longvid,
6656 atpat::List.tl atpats )
6657 )
6658
6659 | NONFIX(PARAtPat(_, pat)) =>
6660 error(infoPat pat, "misplaced non-infix pattern")
6661
6662 | _ => maybeNonfixClause(ps)
6663
6664 fun maybePlainInfixClause(ps) =
6665 case ps
6666 of [NONFIX atpat1, INFIX(_, vid, I), NONFIX atpat2] =>
6667 ( SANSOp, vid, pairPat(atpat1, atpat2)::[] )
6668
6669 | _ => maybeParenthesisedInfixClause(ps)
6670 in
6671 maybePlainInfixClause(List.map (categoriseAtPat J) atpats)
6672 end
6673
6674 end
6675(* stop of Infix.sml *)
6676(* start of INITIAL_INFIX_ENV.sml *)
6677(*
6678 * Standard ML initial infix environment
6679 *
6680 * Definition, Appendix C
6681 *)
6682
6683signature INITIAL_INFIX_ENV =
6684 sig
6685
6686 (* Import type *)
6687
6688 type InfEnv = Infix.InfEnv
6689
6690 (* Export *)
6691
6692 val J0: InfEnv
6693
6694 end
6695(* stop of INITIAL_INFIX_ENV.sml *)
6696(* start of InitialInfixEnv.sml *)
6697(*
6698 * Standard ML initial infix environment
6699 *
6700 * Definition, Appendix C
6701 *)
6702
6703structure InitialInfixEnv :> INITIAL_INFIX_ENV =
6704 struct
6705
6706 (* Import type *)
6707
6708 type InfEnv = Infix.InfEnv
6709
6710 (* Value identifiers *)
6711
6712 val vidCons = VId.fromString "::"
6713 val vidEqual = VId.fromString "="
6714 val vidAssign = VId.fromString ":="
6715
6716 (* Export *)
6717
6718 val J0 = VIdMap.fromList[(vidCons, (Infix.RIGHT, 5)),
6719 (vidEqual, (Infix.LEFT, 4)),
6720 (vidAssign, (Infix.LEFT, 3))]
6721 end
6722(* stop of InitialInfixEnv.sml *)
6723(* start of BASIS.sml *)
6724(*
6725 * Standard ML combined basis
6726 *
6727 * Definition, section 8
6728 *)
6729
6730signature BASIS =
6731 sig
6732
6733 (* Import types *)
6734
6735 type StaticBasis = StaticBasis.Basis (* [B_STAT] *)
6736 type DynamicBasis = DynamicBasis.Basis (* [B_DYN] *)
6737
6738 (* Type [Section 8] *)
6739
6740 type Basis = StaticBasis * DynamicBasis (* [B] *)
6741
6742
6743 (* Operations *)
6744
6745 val B_STATof: Basis -> StaticBasis
6746 val B_DYNof: Basis -> DynamicBasis
6747
6748 val oplus: Basis * Basis -> Basis
6749
6750 end
6751(* stop of BASIS.sml *)
6752(* start of Basis.sml *)
6753(*
6754 * Standard ML combined basis
6755 *
6756 * Definition, section 8
6757 *)
6758
6759structure Basis :> BASIS =
6760 struct
6761
6762 (* Import types *)
6763
6764 type StaticBasis = StaticBasis.Basis (* [B_STAT] *)
6765 type DynamicBasis = DynamicBasis.Basis (* [B_DYN] *)
6766
6767 (* Type [Section 8] *)
6768
6769 type Basis = StaticBasis * DynamicBasis (* [B] *)
6770
6771
6772 (* Projections *)
6773
6774 fun B_STATof (B_STAT,B_DYN) = B_STAT
6775 fun B_DYNof (B_STAT,B_DYN) = B_DYN
6776
6777
6778 (* Modification [Section 4.3] *)
6779
6780 infix oplus
6781
6782 fun (B_STAT,B_DYN) oplus (B_STAT',B_DYN') =
6783 ( StaticBasis.plus(B_STAT, B_STAT')
6784 , DynamicBasis.plus(B_DYN, B_DYN')
6785 )
6786
6787 end
6788(* stop of Basis.sml *)
6789(* start of PACK.sml *)
6790(*
6791 * Standard ML exception packets
6792 *
6793 * Definition, section 6.2
6794 *)
6795
6796
6797signature PACK =
6798 sig
6799
6800 (* Import *)
6801
6802 type 'a ExVal = 'a Val.ExVal
6803 type FcnClosure = DynamicEnv.FcnClosure
6804
6805
6806 (* Definitions [Section 6.2] *)
6807
6808 type Pack = FcnClosure ExVal (* [p] *)
6809
6810 exception Pack of Pack
6811
6812 end
6813(* stop of PACK.sml *)
6814(* start of Pack.sml *)
6815(*
6816 * Standard ML exception packets
6817 *
6818 * Definition, section 6.2
6819 *)
6820
6821
6822structure Pack :> PACK =
6823 struct
6824
6825 (* Import *)
6826
6827 type 'a ExVal = 'a Val.ExVal
6828 type FcnClosure = DynamicEnv.FcnClosure
6829
6830
6831 (* Definitions [Section 6.2] *)
6832
6833 type Pack = FcnClosure ExVal (* [p] *)
6834
6835 exception Pack of Pack
6836
6837 end
6838(* stop of Pack.sml *)
6839(* start of BASVAL.sml *)
6840(*
6841 * Standard ML basic values
6842 *
6843 * Definition, section 6.4
6844 *)
6845
6846
6847signature BASVAL =
6848 sig
6849
6850 (* Import *)
6851
6852 type BasVal = Val.BasVal
6853 type 'a Val = 'a Val.Val
6854
6855 exception Pack of Pack.Pack (* = Pack.Pack *)
6856
6857
6858 (* Operations *)
6859
6860 exception TypeError
6861
6862 val APPLY: BasVal * 'a Val -> 'a Val (* / Pack *)
6863
6864 val toString: BasVal -> string
6865
6866 end
6867(* stop of BASVAL.sml *)
6868(* start of BasVal.sml *)
6869(*
6870 * Standard ML basic values
6871 *
6872 * Definition, section 6.4
6873 *)
6874
6875
6876structure BasVal :> BASVAL =
6877 struct
6878
6879 (* Import *)
6880
6881 type BasVal = Val.BasVal
6882 type 'a Val = 'a Val.Val
6883
6884 exception Pack = Pack.Pack
6885
6886
6887 (* Conversions *)
6888
6889 fun toString b = b
6890
6891
6892 (* Application of basic values *)
6893
6894 exception TypeError
6895
6896 fun APPLY("=", v) =
6897 (case Val.unpair v
6898 of SOME vv => Val.toBoolVal(Val.equal vv)
6899 | NONE => raise TypeError
6900 )
6901 | APPLY _ = raise Fail "BasVal.APPLY: unknown basic value"
6902
6903 end
6904(* stop of BasVal.sml *)
6905(* start of EVAL_CORE.sml *)
6906(*
6907 * Standard ML core evaluation
6908 *
6909 * Definition, section 6.7
6910 *
6911 * Notes:
6912 * - State is passed as reference and modified via side effects. This way
6913 * expanding out of the state and exception convention in the inference
6914 * rules can be avoided (would really be a pain). Note that the state
6915 * therefore never is returned.
6916 * - Doing so, we can model the exception convention using exceptions.
6917 *)
6918
6919
6920signature EVAL_CORE =
6921 sig
6922
6923 (* Import types *)
6924
6925 type Dec = GrammarCore.Dec
6926 type Env = DynamicEnv.Env
6927 type State = DynamicEnv.FcnClosure State.State
6928
6929 (* Export *)
6930
6931 val evalDec: State ref * Env * Dec -> Env
6932
6933 end
6934(* stop of EVAL_CORE.sml *)
6935(* start of EvalCore.sml *)
6936(*
6937 * Standard ML core evaluation
6938 *
6939 * Definition, sections 6.7 and 6.2
6940 *
6941 * Notes:
6942 * - State is passed as reference and modified via side effects. This way
6943 * expanding out the state and exception convention in the inference rules
6944 * can be avoided (would really be a pain). Note that the state therefore
6945 * never is returned.
6946 * - Doing so, we can model the exception convention using exceptions.
6947 * Rules of the form A |- phrase => A'/p therefore turn into
6948 * A |- phrase => A'.
6949 * - We only pass the state where necessary.
6950 * - Special constants have already been evaluated inside the Lexer.
6951 *)
6952
6953structure EvalCore :> EVAL_CORE =
6954 struct
6955
6956 (* Import *)
6957
6958 type Dec = GrammarCore.Dec
6959 type Env = DynamicEnv.Env
6960 type State = DynamicEnv.FcnClosure State.State
6961
6962 exception Pack = Pack.Pack
6963
6964 open GrammarCore
6965
6966
6967 (* Some helpers for error messages *)
6968
6969 val error = Error.error
6970
6971 fun errorLab(I, s, lab) = error(I, s ^ Lab.toString lab)
6972 fun errorLongVId(I, s, longvid) = error(I, s ^ LongVId.toString longvid)
6973 fun errorLongTyCon(I, s, longtycon) =
6974 error(I, s ^ LongTyCon.toString longtycon)
6975 fun errorLongStrId(I, s, longstrid) =
6976 error(I, s ^ LongStrId.toString longstrid)
6977
6978
6979 (* Helpers for environment modification *)
6980
6981 val plus = DynamicEnv.plus
6982 val plusVE = DynamicEnv.plusVE
6983 val plusTE = DynamicEnv.plusTE
6984 val plusVEandTE = DynamicEnv.plusVEandTE
6985
6986 infix plus plusVE plusTE plusVEandTE
6987
6988
6989
6990 (* Evaluating special constants [Section 6.2] *)
6991
6992 fun valSCon(SCon.INT n) = Val.SVal(SVal.INT n)
6993 | valSCon(SCon.WORD w) = Val.SVal(SVal.WORD w)
6994 | valSCon(SCon.CHAR c) = Val.SVal(SVal.CHAR c)
6995 | valSCon(SCon.REAL x) = Val.SVal(SVal.REAL x)
6996 | valSCon(SCon.STRING s) = Val.SVal(SVal.STRING s)
6997
6998
6999 (* Inference rules [Section 6.7] *)
7000
7001 exception FAIL
7002
7003
7004 (* Atomic Expressions *)
7005
7006 fun evalAtExp(s,E, SCONAtExp(I, scon)) =
7007 (* [Rule 90] *)
7008 valSCon scon
7009
7010 | evalAtExp(s,E, LONGVIDAtExp(I, _, longvid)) =
7011 (* [Rule 91] *)
7012 let
7013 val (v,is) = case DynamicEnv.findLongVId(E, longvid)
7014 of SOME valstr => valstr
7015 | NONE =>
7016 errorLongVId(I, "runtime error: \
7017 \unknown identifier ", longvid)
7018 in
7019 v
7020 end
7021
7022 | evalAtExp(s,E, RECORDAtExp(I, exprow_opt)) =
7023 (* [Rule 92] *)
7024 let
7025 val r = case exprow_opt
7026 of NONE => LabMap.empty
7027 | SOME exprow => evalExpRow(s,E, exprow)
7028 in
7029 Val.Record r
7030 end
7031
7032 | evalAtExp(s,E, LETAtExp(I, dec, exp)) =
7033 (* [Rule 93] *)
7034 let
7035 val E' = evalDec(s,E, dec)
7036 val v = evalExp(s,E plus E', exp)
7037 in
7038 v
7039 end
7040
7041 | evalAtExp(s,E, PARAtExp(I, exp)) =
7042 (* [Rule 94] *)
7043 let
7044 val v = evalExp(s,E, exp)
7045 in
7046 v
7047 end
7048
7049
7050 (* Expression Rows *)
7051
7052 and evalExpRow(s,E, ExpRow(I, lab, exp, exprow_opt)) =
7053 (* [Rule 95] *)
7054 let
7055 val v = evalExp(s,E, exp)
7056 val r = case exprow_opt
7057 of NONE => LabMap.empty
7058 | SOME exprow => evalExpRow(s,E, exprow)
7059 in
7060 LabMap.insert(r, lab, v)
7061 end
7062
7063
7064 (* Expressions *)
7065
7066 and evalExp(s,E, ATEXPExp(I, atexp)) =
7067 (* [Rule 96] *)
7068 let
7069 val v = evalAtExp(s,E, atexp)
7070 in
7071 v
7072 end
7073
7074 | evalExp(s,E, APPExp(I, exp, atexp)) =
7075 (* [Rules 97 to 103] *)
7076 let
7077 val v1 = evalExp(s,E, exp)
7078 val v = evalAtExp(s,E, atexp)
7079 in
7080 case v1
7081 of Val.VId vid =>
7082 if vid = VId.fromString "ref" then
7083 (* [Rule 99] *)
7084 let
7085 val a = Addr.addr()
7086 in
7087 s := State.insertAddr(!s, a, v)
7088 ; Val.Addr a
7089 end
7090 else
7091 (* [Rule 97] *)
7092 Val.VIdVal (vid,v)
7093
7094 | Val.ExVal(Val.ExName en) =>
7095 (* [Rule 98] *)
7096 Val.ExVal(Val.ExNameVal(en,v))
7097
7098 | Val.:= =>
7099 (* [Rule 100] *)
7100 (case Val.unpair v
7101 of SOME(Val.Addr a, v) =>
7102 ( s := State.insertAddr(!s, a, v)
7103 ; Val.Record LabMap.empty
7104 )
7105 | _ => error(I, "runtime type error: address expected")
7106 )
7107
7108 | Val.BasVal b =>
7109 (* [Rule 101] *)
7110 BasVal.APPLY(b, v)
7111
7112 | Val.FcnClosure(DynamicEnv.FcnClosure(match,E',VE)) =>
7113 (* [Rule 102] *)
7114 (let
7115 val v' = evalMatch(s,E' plusVE DynamicEnv.Rec VE, v, match)
7116 in
7117 v'
7118 end
7119 handle FAIL =>
7120 (* [Rule 103] *)
7121 raise Pack(Val.ExName InitialDynamicEnv.enMatch)
7122 )
7123 | _ =>
7124 error(I, "runtime type error: applicative value expected")
7125 end
7126
7127 | evalExp(s,E, TYPEDExp(I, exp, _)) =
7128 (* Omitted [Section 6.1] *)
7129 evalExp(s,E, exp)
7130
7131 | evalExp(s,E, HANDLEExp(I, exp, match)) =
7132 (* [Rule 104 to 106] *)
7133 (let
7134 val v = evalExp(s,E, exp)
7135 in
7136 (* [Rule 104] *)
7137 v
7138 end
7139 handle Pack.Pack e =>
7140 let
7141 val v = evalMatch(s,E,Val.ExVal e, match)
7142 in
7143 (* [Rule 105] *)
7144 v
7145 end
7146 handle FAIL =>
7147 (* [Rule 106] *)
7148 raise Pack.Pack e
7149 )
7150
7151 | evalExp(s,E, RAISEExp(I, exp)) =
7152 (* [Rule 107] *)
7153 let
7154 val e = case evalExp(s,E, exp)
7155 of Val.ExVal e => e
7156 | _ => error(I, "runtime type error: \
7157 \exception value expected")
7158 in
7159 raise Pack.Pack e
7160 end
7161
7162 | evalExp(s,E, FNExp(I, match)) =
7163 (* [Rule 108] *)
7164 Val.FcnClosure(DynamicEnv.FcnClosure(match,E,VIdMap.empty))
7165
7166
7167 (* Matches *)
7168
7169 and evalMatch(s,E,v, Match(I, mrule, match_opt)) =
7170 (* [Rules 109 to 111] *)
7171 let
7172 val v' = evalMrule(s,E,v, mrule)
7173 in
7174 (* [Rule 109] *)
7175 v'
7176 end
7177 handle FAIL =>
7178 case match_opt
7179 of NONE =>
7180 (* [Rule 110] *)
7181 raise FAIL
7182
7183 | SOME match =>
7184 (* [Rule 111] *)
7185 let
7186 val v' = evalMatch(s,E,v, match)
7187 in
7188 v'
7189 end
7190
7191
7192 (* Match rules *)
7193
7194 and evalMrule(s,E,v, Mrule(I, pat, exp)) =
7195 (* [Rules 112 and 113] *)
7196 let
7197 val VE = evalPat(s,E,v, pat)
7198 (* [Rule 112] *)
7199 val v' = evalExp(s,E plusVE VE, exp)
7200 in
7201 v'
7202 end
7203 (* FAIL on evalPat propagates through [Rule 113] *)
7204
7205
7206 (* Declarations *)
7207
7208 and evalDec(s,E, VALDec(I, tyvarseq, valbind)) =
7209 (* [Rule 114] *)
7210 let
7211 val VE = evalValBind(s,E, valbind)
7212 in
7213 DynamicEnv.fromVE VE
7214 end
7215
7216 | evalDec(s,E, TYPEDec(I, typbind)) =
7217 (* [Rule 115] *)
7218 let
7219 val TE = evalTypBind(typbind)
7220 in
7221 DynamicEnv.fromTE TE
7222 end
7223
7224 | evalDec(s,E, DATATYPEDec(I, datbind)) =
7225 (* [Rule 116] *)
7226 let
7227 val (VE,TE) = evalDatBind(datbind)
7228 in
7229 DynamicEnv.fromVEandTE(VE,TE)
7230 end
7231
7232 | evalDec(s,E, REPLICATIONDec(I, tycon, longtycon)) =
7233 (* [Rule 117] *)
7234 let
7235 val VE = case DynamicEnv.findLongTyCon(E, longtycon)
7236 of SOME VE => VE
7237 | NONE =>
7238 errorLongTyCon(I, "runtime error: unknown type ",
7239 longtycon)
7240 in
7241 DynamicEnv.fromVEandTE(VE, TyConMap.singleton(tycon, VE))
7242 end
7243
7244 | evalDec(s,E, ABSTYPEDec(I, datbind, dec)) =
7245 (* [Rule 118] *)
7246 let
7247 val (VE,TE) = evalDatBind(datbind)
7248 val E' = evalDec(s,E plusVEandTE (VE,TE), dec)
7249 in
7250 E'
7251 end
7252
7253 | evalDec(s,E, EXCEPTIONDec(I, exbind)) =
7254 (* [Rule 119] *)
7255 let
7256 val VE = evalExBind(s,E, exbind)
7257 in
7258 DynamicEnv.fromVE VE
7259 end
7260
7261 | evalDec(s,E, LOCALDec(I, dec1, dec2)) =
7262 (* [Rule 120] *)
7263 let
7264 val E1 = evalDec(s,E, dec1)
7265 val E2 = evalDec(s,E plus E1, dec2)
7266 in
7267 E2
7268 end
7269
7270 | evalDec(s,E, OPENDec(I, longstrids)) =
7271 (* [Rule 121] *)
7272 let
7273 val Es =
7274 List.map
7275 (fn longstrid =>
7276 case DynamicEnv.findLongStrId(E, longstrid)
7277 of SOME(DynamicEnv.Str E) => E
7278 | NONE =>
7279 errorLongStrId(I, "runtime error: unknown \
7280 \structure ", longstrid) )
7281 longstrids
7282 in
7283 List.foldl DynamicEnv.plus DynamicEnv.empty Es
7284 end
7285
7286 | evalDec(s,E, EMPTYDec(I)) =
7287 (* [Rule 122] *)
7288 DynamicEnv.empty
7289
7290 | evalDec(s,E, SEQDec(I, dec1, dec2)) =
7291 (* [Rule 123] *)
7292 let
7293 val E1 = evalDec(s,E, dec1)
7294 val E2 = evalDec(s,E plus E1, dec2)
7295 in
7296 E1 plus E2
7297 end
7298
7299
7300 (* Value Bindings *)
7301
7302 and evalValBind(s,E, PLAINValBind(I, pat, exp, valbind_opt)) =
7303 (* [Rule 124 and 125] *)
7304 (let
7305 val v = evalExp(s,E, exp)
7306 val VE = evalPat(s,E,v, pat)
7307 (* [Rule 124] *)
7308 val VE' = case valbind_opt
7309 of NONE => VIdMap.empty
7310 | SOME valbind => evalValBind(s,E, valbind)
7311 in
7312 VIdMap.unionWith #2 (VE, VE')
7313 end
7314 handle FAIL =>
7315 (* [Rule 125] *)
7316 raise Pack.Pack(Val.ExName InitialDynamicEnv.enBind)
7317 )
7318
7319 | evalValBind(s,E, RECValBind(I, valbind)) =
7320 (* [Rule 126] *)
7321 let
7322 val VE = evalValBind(s,E, valbind)
7323 in
7324 DynamicEnv.Rec VE
7325 end
7326
7327
7328 (* Type Bindings *)
7329
7330 and evalTypBind(TypBind(I, tyvarseq, tycon, ty, typbind_opt)) =
7331 (* [Rule 127] *)
7332 let
7333 val TE = case typbind_opt
7334 of NONE => TyConMap.empty
7335 | SOME typbind => evalTypBind(typbind)
7336 in
7337 TyConMap.insert(TE, tycon, VIdMap.empty)
7338 end
7339
7340
7341 (* Datatype Bindings *)
7342
7343 and evalDatBind(DatBind(I, tyvarseq, tycon, conbind, datbind_opt)) =
7344 (* [Rule 128] *)
7345 let
7346 val VE = evalConBind(conbind)
7347 val (VE',TE') = case datbind_opt
7348 of NONE => ( VIdMap.empty, TyConMap.empty )
7349 | SOME datbind' => evalDatBind(datbind')
7350 in
7351 ( VIdMap.unionWith #2 (VE, VE')
7352 , TyConMap.insert(TE', tycon, VE)
7353 )
7354 end
7355
7356
7357 (* Constructor Bindings *)
7358
7359 and evalConBind(ConBind(I, _, vid, _, conbind_opt)) =
7360 (* [Rule 129] *)
7361 let
7362 val VE = case conbind_opt
7363 of NONE => VIdMap.empty
7364 | SOME conbind => evalConBind(conbind)
7365 in
7366 VIdMap.insert(VE, vid, (Val.VId vid,IdStatus.c))
7367 end
7368
7369
7370 (* Exception Bindings *)
7371
7372 and evalExBind(s,E, NEWExBind(I, _, vid, _, exbind_opt)) =
7373 (* [Rule 130] *)
7374 let
7375 val en = ExName.exname vid
7376 val VE = case exbind_opt
7377 of NONE => VIdMap.empty
7378 | SOME exbind => evalExBind(s,E, exbind)
7379 in
7380 s := State.insertExName(!s, en)
7381 ; VIdMap.insert(VE, vid, (Val.ExVal(Val.ExName en),IdStatus.e))
7382 end
7383
7384 | evalExBind(s,E, EQUALExBind(I, _, vid, _, longvid, exbind_opt)) =
7385 (* [Rule 131] *)
7386 let
7387 val en = case DynamicEnv.findLongVId(E, longvid)
7388 of SOME(en,IdStatus.e) => en
7389 | SOME _ =>
7390 errorLongVId(I, "runtime error: non-exception \
7391 \identifier ", longvid)
7392 | NONE =>
7393 errorLongVId(I, "runtime error: unknown identifier ",
7394 longvid)
7395 val VE = case exbind_opt
7396 of NONE => VIdMap.empty
7397 | SOME exbind => evalExBind(s,E, exbind)
7398 in
7399 VIdMap.insert(VE, vid, (en,IdStatus.e))
7400 end
7401
7402
7403 (* Atomic Patterns *)
7404
7405 and evalAtPat(s,E,v, WILDCARDAtPat(I)) =
7406 (* [Rule 132] *)
7407 VIdMap.empty
7408
7409 | evalAtPat(s,E,v, SCONAtPat(I, scon)) =
7410 (* [Rule 133 and 134] *)
7411 (case v
7412 of Val.SVal sv =>
7413 if Val.equal(v, valSCon(scon)) then
7414 (* [Rule 133] *)
7415 VIdMap.empty
7416 else
7417 (* [Rule 134] *)
7418 raise FAIL
7419
7420 | _ => error(I, "runtime type error: special constant expected")
7421 )
7422
7423 | evalAtPat(s,E,v, LONGVIDAtPat(I, _, longvid)) =
7424 (* [Rule 135 to 137] *)
7425 let
7426 val (strids,vid) = LongVId.explode longvid
7427 in
7428 if List.null strids andalso
7429 ( case DynamicEnv.findVId(E, vid)
7430 of NONE => true
7431 | SOME(_,is) => is = IdStatus.v ) then
7432 (* [Rule 135] *)
7433 VIdMap.singleton(vid, (v,IdStatus.v))
7434 else
7435 let
7436 val (v',is) = case DynamicEnv.findLongVId(E, longvid)
7437 of SOME valstr => valstr
7438 | NONE =>
7439 errorLongVId(I,"runtime error: \
7440 \unknown constructor ",
7441 longvid)
7442 in
7443 if Val.equal(v, v') then
7444 (* [Rule 136] *)
7445 VIdMap.empty
7446 else
7447 (* [Rule 137] *)
7448 raise FAIL
7449 end
7450 end
7451
7452 | evalAtPat(s,E,v, RECORDAtPat(I, patrow_opt)) =
7453 (* [Rule 138] *)
7454 let
7455 val r = case v
7456 of Val.Record r => r
7457 | _ =>
7458 error(I, "runtime type error: record expected")
7459
7460 val VE = case patrow_opt
7461 of NONE =>
7462 if LabMap.isEmpty r then
7463 VIdMap.empty
7464 else
7465 error(I, "runtime type error: \
7466 \empty record expected")
7467
7468 | SOME patrow =>
7469 evalPatRow(s,E,r, patrow)
7470 in
7471 VE
7472 end
7473
7474 | evalAtPat(s,E,v, PARAtPat(I, pat)) =
7475 (* [Rule 139] *)
7476 let
7477 val VE = evalPat(s,E,v, pat)
7478 in
7479 VE
7480 end
7481
7482
7483 (* Pattern Rows *)
7484
7485 and evalPatRow(s,E,r, WILDCARDPatRow(I)) =
7486 (* [Rule 140] *)
7487 VIdMap.empty
7488
7489 | evalPatRow(s,E,r, ROWPatRow(I, lab, pat, patrow_opt)) =
7490 (* [Rule 141 and 142] *)
7491 let
7492 val v = case LabMap.find(r, lab)
7493 of SOME v => v
7494 | _ => errorLab(I, "runtime type error: \
7495 \unmatched label ", lab)
7496 val VE = evalPat(s,E,v, pat)
7497 (* [Rule 142] *)
7498 val VE' = case patrow_opt
7499 of NONE => VIdMap.empty
7500 | SOME patrow => evalPatRow(s,E,r, patrow)
7501 in
7502 VIdMap.unionWithi #2 (VE, VE')
7503 end
7504 (* FAIL on evalPat propagates through [Rule 142] *)
7505
7506
7507 (* Patterns *)
7508
7509 and evalPat(s,E,v, ATPATPat(I, atpat)) =
7510 (* [Rule 143] *)
7511 let
7512 val VE = evalAtPat(s,E,v, atpat)
7513 in
7514 VE
7515 end
7516
7517 | evalPat(s,E,v, CONPat(I, _, longvid, atpat)) =
7518 (* [Rules 144 to 148] *)
7519 (case (DynamicEnv.findLongVId(E, longvid), v)
7520 of ( SOME(Val.VId vid, IdStatus.c),
7521 Val.VIdVal(vid',v') ) =>
7522 if vid = VId.fromString "ref" then
7523 error(I, "runtime type error: address expected")
7524 else if vid = vid' then
7525 (* [Rule 144] *)
7526 let
7527 val VE = evalAtPat(s,E,v', atpat)
7528 in
7529 VE
7530 end
7531 else
7532 (* [Rule 145] *)
7533 raise FAIL
7534
7535 | ( SOME(Val.ExVal(Val.ExName en),IdStatus.e),
7536 Val.ExVal(Val.ExNameVal(en',v')) ) =>
7537 if en = en' then
7538 (* [Rule 146] *)
7539 let
7540 val VE = evalAtPat(s,E,v', atpat)
7541 in
7542 VE
7543 end
7544 else
7545 (* [Rule 147] *)
7546 raise FAIL
7547
7548 | ( SOME(Val.VId vid, IdStatus.c),
7549 Val.Addr a ) =>
7550 if vid = VId.fromString "ref" then
7551 (* [Rule 148] *)
7552 let
7553 val v = case State.findAddr(!s, a)
7554 of SOME v => v
7555 | NONE =>
7556 raise Fail "EvalCore.evalPat: \
7557 \invalid address"
7558 val VE = evalAtPat(s,E,v, atpat)
7559 in
7560 VE
7561 end
7562 else
7563 error(I, "runtime type error: reference expected")
7564
7565 | _ =>
7566 error(I, "runtime type error: constructor expected")
7567 )
7568
7569 | evalPat(s,E,v, TYPEDPat(I, pat, _)) =
7570 (* Omitted [Section 6.1] *)
7571 evalPat(s,E,v, pat)
7572
7573 | evalPat(s,E,v, ASPat(I, _, vid, _, pat)) =
7574 (* [Rule 149] *)
7575 let
7576 val VE = evalPat(s,E,v, pat)
7577 in
7578 VIdMap.insert(VE, vid, (v,IdStatus.v))
7579 end
7580
7581 end
7582(* stop of EvalCore.sml *)
7583(* start of INTBASIS.sml *)
7584(*
7585 * Standard ML interface basis
7586 *
7587 * Definition, section 7.2
7588 *)
7589
7590signature INTBASIS =
7591 sig
7592
7593 (* Import types *)
7594
7595 type SigId = SigId.Id
7596 type longTyCon = LongTyCon.longId
7597 type Basis = DynamicBasis.Basis
7598 type SigEnv = DynamicBasis.SigEnv
7599 type Env = DynamicEnv.Env
7600 type Int = Interface.Int
7601 type ValInt = Interface.ValInt
7602
7603 type 'a SigIdMap = 'a SigIdMap.map
7604
7605
7606 (* Types [Section 7.2] *)
7607
7608 type IntBasis = SigEnv * Int (* [IB] *)
7609
7610
7611 (* Operations *)
7612
7613 val Inter: Basis -> IntBasis
7614
7615 val plusI: IntBasis * Int -> IntBasis
7616
7617 val findSigId: IntBasis * SigId -> Int option
7618 val findLongTyCon: IntBasis * longTyCon -> ValInt option
7619
7620 end
7621(* stop of INTBASIS.sml *)
7622(* start of IntBasis.sml *)
7623(*
7624 * Standard ML interface basis
7625 *
7626 * Definition, section 7.2
7627 *)
7628
7629
7630structure IntBasis :> INTBASIS =
7631 struct
7632
7633 (* Import types *)
7634
7635 type SigId = SigId.Id
7636 type longTyCon = LongTyCon.longId
7637 type Basis = DynamicBasis.Basis
7638 type SigEnv = DynamicBasis.SigEnv
7639 type Env = DynamicEnv.Env
7640 type Int = Interface.Int
7641 type ValInt = Interface.ValInt
7642
7643 type 'a SigIdMap = 'a SigIdMap.map
7644
7645
7646 (* Types [Section 7.2] *)
7647
7648 type IntBasis = SigEnv * Int (* [IB] *)
7649
7650
7651 (* Injections [Section 7.2] *)
7652
7653 fun Inter (F,G,E) = (G, Interface.Inter E)
7654
7655
7656 (* Modifications [Sections 4.3 and 7.2] *)
7657
7658 infix plusI
7659
7660 fun (G,I) plusI I' = ( G, Interface.plus(I,I') )
7661
7662
7663 (* Application (lookup) [Sections 7.2 and 4.3] *)
7664
7665 fun findSigId((G,I), sigid) = SigIdMap.find(G, sigid)
7666
7667 fun findLongTyCon((G,I), longtycon) = Interface.findLongTyCon(I, longtycon)
7668
7669 end
7670(* stop of IntBasis.sml *)
7671(* start of EVAL_MODULE.sml *)
7672(*
7673 * Standard ML modules evaluation
7674 *
7675 * Definition, section 7.3
7676 *
7677 * Notes:
7678 * - State is passed as reference and modified via side effects. This way
7679 * expanding out the state and exception convention in the inference rules
7680 * can be avoided (would really be a pain). Note that the state therefore
7681 * never is returned.
7682 * - Doing so, we can model the exception convention using exceptions.
7683 *)
7684
7685signature EVAL_MODULE =
7686 sig
7687
7688 (* Import types *)
7689
7690 type TopDec = GrammarModule.TopDec
7691 type Basis = DynamicBasis.Basis
7692 type State = EvalCore.State
7693
7694
7695 (* Export *)
7696
7697 val evalTopDec: State ref * Basis * TopDec -> Basis
7698
7699 end
7700(* stop of EVAL_MODULE.sml *)
7701(* start of EvalModule.sml *)
7702(*
7703 * Standard ML modules evaluation
7704 *
7705 * Definition, section 7.3
7706 *
7707 * Notes:
7708 * - State is passed as reference and modified via side effects. This way
7709 * expanding out the state and exception convention in the inference rules
7710 * can be avoided (would really be a pain). Note that the state therefore
7711 * never is returned.
7712 * - Doing so, we can model the exception convention using exceptions.
7713 * Rules of the form A |- phrase => A'/p therefore turn into
7714 * A |- phrase => A'.
7715 * - We only pass the state where necessary, ie. strexp, strdec, strbind, and
7716 * topdec (compare note in [Section 7.3]).
7717 * - There is a typo in the Definition in rule 182: both occurances of IB
7718 * should be replaced by B.
7719 * - The rules for toplevel declarations are all wrong: in the conclusions,
7720 * the result right of the arrow must be B' <+ B''> instead of B'<'> in
7721 * all three rules.
7722 *)
7723
7724structure EvalModule :> EVAL_MODULE =
7725 struct
7726
7727 (* Import *)
7728
7729 type TopDec = GrammarModule.TopDec
7730 type Basis = DynamicBasis.Basis
7731 type State = EvalCore.State
7732
7733
7734 open GrammarModule
7735
7736
7737 (* Helpers for error messages *)
7738
7739 val error = Error.error
7740
7741 fun errorSigId(I, s, sigid) = error(I, s ^ SigId.toString sigid)
7742 fun errorFunId(I, s, funid) = error(I, s ^ FunId.toString funid)
7743
7744 fun errorLongTyCon(I, s, longtycon) =
7745 error(I, s ^ LongTyCon.toString longtycon)
7746 fun errorLongStrId(I, s, longstrid) =
7747 error(I, s ^ LongStrId.toString longstrid)
7748
7749
7750 (* Helpers for basis modification *)
7751
7752 val plus = DynamicBasis.plus
7753 val plusSE = DynamicBasis.plusSE
7754 val plusG = DynamicBasis.plusG
7755 val plusF = DynamicBasis.plusF
7756 val plusE = DynamicBasis.plusE
7757
7758 infix plus plusG plusF plusE plusSE
7759
7760
7761
7762 (* Inference rules [Section 7.3] *)
7763
7764
7765 (* Structure Expressions *)
7766
7767 fun evalStrExp(s,B, STRUCTStrExp(I, strdec)) =
7768 (* [Rule 150] *)
7769 let
7770 val E = evalStrDec(s,B, strdec)
7771 in
7772 E
7773 end
7774
7775 | evalStrExp(s,B, LONGSTRIDStrExp(I, longstrid)) =
7776 (* [Rule 151] *)
7777 let
7778 val E = case DynamicBasis.findLongStrId(B, longstrid)
7779 of SOME(DynamicEnv.Str E) => E
7780 | NONE =>
7781 errorLongStrId(I, "runtime error: unknown structure ",
7782 longstrid)
7783 in
7784 E
7785 end
7786
7787 | evalStrExp(s,B, TRANSStrExp(I, strexp, sigexp)) =
7788 (* [Rule 152] *)
7789 let
7790 val E = evalStrExp(s,B, strexp)
7791 val I = evalSigExp(IntBasis.Inter B, sigexp)
7792 in
7793 Interface.cutdown(E, I)
7794 end
7795
7796 | evalStrExp(s,B, OPAQStrExp(I, strexp, sigexp)) =
7797 (* [Rule 153] *)
7798 let
7799 val E = evalStrExp(s,B, strexp)
7800 val I = evalSigExp(IntBasis.Inter B, sigexp)
7801 in
7802 Interface.cutdown(E, I)
7803 end
7804
7805 | evalStrExp(s,B, APPStrExp(I, funid, strexp)) =
7806 (* [Rule 154] *)
7807 let
7808 val DynamicBasis.FunctorClosure((strid, I), strexp', B') =
7809 case DynamicBasis.findFunId(B, funid)
7810 of SOME funcclos => funcclos
7811 | NONE => errorFunId(I, "runtime error: \
7812 \unknown functor ", funid)
7813 val E = evalStrExp(s,B, strexp)
7814 val E' = evalStrExp(
7815 s,
7816 B' plusSE
7817 StrIdMap.singleton(strid,
7818 DynamicEnv.Str(Interface.cutdown(E, I))),
7819 strexp')
7820 in
7821 E'
7822 end
7823
7824 | evalStrExp(s,B, LETStrExp(I, strdec, strexp)) =
7825 (* [Rule 155] *)
7826 let
7827 val E = evalStrDec(s,B, strdec)
7828 val E' = evalStrExp(s,B plusE E, strexp)
7829 in
7830 E'
7831 end
7832
7833
7834 (* Structure-level Declarations *)
7835
7836 and evalStrDec(s,B, DECStrDec(I, dec)) =
7837 (* [Rule 156] *)
7838 let
7839 val E' = EvalCore.evalDec(s,DynamicBasis.Eof B, dec)
7840 in
7841 E'
7842 end
7843
7844 | evalStrDec(s,B, STRUCTUREStrDec(I, strbind)) =
7845 (* [Rule 157] *)
7846 let
7847 val SE = evalStrBind(s,B, strbind)
7848 in
7849 DynamicEnv.fromSE SE
7850 end
7851
7852 | evalStrDec(s,B, LOCALStrDec(I, strdec1, strdec2)) =
7853 (* [Rule 158] *)
7854 let
7855 val E1 = evalStrDec(s,B, strdec1)
7856 val E2 = evalStrDec(s,B plusE E1, strdec2)
7857 in
7858 E2
7859 end
7860
7861 | evalStrDec(s,B, EMPTYStrDec(I)) =
7862 (* [Rule 159] *)
7863 DynamicEnv.empty
7864
7865 | evalStrDec(s,B, SEQStrDec(I, strdec1, strdec2)) =
7866 (* [Rule 160] *)
7867 let
7868 val E1 = evalStrDec(s,B, strdec1)
7869 val E2 = evalStrDec(s,B plusE E1, strdec2)
7870 in
7871 DynamicEnv.plus(E1, E2)
7872 end
7873
7874
7875 (* Structure Bindings *)
7876
7877 and evalStrBind(s,B, StrBind(I, strid, strexp, strbind_opt)) =
7878 (* [Rule 161] *)
7879 let
7880 val E = evalStrExp(s,B, strexp)
7881 val SE = case strbind_opt
7882 of NONE => StrIdMap.empty
7883 | SOME strbind => evalStrBind(s,B, strbind)
7884 in
7885 StrIdMap.insert(SE, strid, DynamicEnv.Str E)
7886 end
7887
7888
7889 (* Signature Expressions *)
7890
7891 and evalSigExp(IB, SIGSigExp(I, spec)) =
7892 (* [Rule 162] *)
7893 let
7894 val I = evalSpec(IB, spec)
7895 in
7896 I
7897 end
7898
7899 | evalSigExp(IB, SIGIDSigExp(I, sigid)) =
7900 (* [Rule 163] *)
7901 let
7902 val I = case IntBasis.findSigId(IB, sigid)
7903 of SOME I => I
7904 | NONE => errorSigId(I, "runtime error: unknown \
7905 \signature ",sigid)
7906 in
7907 I
7908 end
7909
7910 | evalSigExp(IB, WHERETYPESigExp(I, sigexp, _, _, _)) =
7911 (* Omitted [Section 7.1] *)
7912 evalSigExp(IB, sigexp)
7913
7914
7915 (* Signature Declarations *)
7916
7917 and evalSigDec(IB, SigDec(I, sigbind)) =
7918 (* [Rule 164] *)
7919 let
7920 val G = evalSigBind(IB, sigbind)
7921 in
7922 G
7923 end
7924
7925
7926 (* Signature Bindings *)
7927
7928 and evalSigBind(IB, SigBind(I, sigid, sigexp, sigbind_opt)) =
7929 (* [Rule 165] *)
7930 let
7931 val I = evalSigExp(IB, sigexp)
7932 val G = case sigbind_opt
7933 of NONE => SigIdMap.empty
7934 | SOME sigbind => evalSigBind(IB, sigbind)
7935 in
7936 SigIdMap.insert(G, sigid, I)
7937 end
7938
7939
7940 (* Specifications *)
7941
7942 and evalSpec(IB, VALSpec(I, valdesc)) =
7943 (* [Rule 166] *)
7944 let
7945 val VI = evalValDesc(valdesc)
7946 in
7947 Interface.fromVI VI
7948 end
7949
7950 | evalSpec(IB, TYPESpec(I, typdesc)) =
7951 (* [Rule 167] *)
7952 let
7953 val TI = evalTypDesc(typdesc)
7954 in
7955 Interface.fromTI TI
7956 end
7957
7958 | evalSpec(IB, EQTYPESpec(I, typdesc)) =
7959 (* [Rule 168] *)
7960 let
7961 val TI = evalTypDesc(typdesc)
7962 in
7963 Interface.fromTI TI
7964 end
7965
7966 | evalSpec(IB, DATATYPESpec(I, datdesc)) =
7967 (* [Rule 169] *)
7968 let
7969 val (VI,TI) = evalDatDesc(datdesc)
7970 in
7971 Interface.fromVIandTI(VI,TI)
7972 end
7973
7974 | evalSpec(IB, REPLICATIONSpec(I, tycon, longtycon)) =
7975 (* [Rule 170] *)
7976 let
7977 val VI = case IntBasis.findLongTyCon(IB, longtycon)
7978 of SOME VI => VI
7979 | NONE => errorLongTyCon(I, "runtime error: \
7980 \unknown type ", longtycon)
7981 val TI = TyConMap.singleton(tycon, VI)
7982 in
7983 Interface.fromVIandTI(VI,TI)
7984 end
7985
7986 | evalSpec(IB, EXCEPTIONSpec(I, exdesc)) =
7987 (* [Rule 171] *)
7988 let
7989 val VI = evalExDesc(exdesc)
7990 in
7991 Interface.fromVI VI
7992 end
7993
7994 | evalSpec(IB, STRUCTURESpec(I, strdesc)) =
7995 (* [Rule 172] *)
7996 let
7997 val SI = evalStrDesc(IB, strdesc)
7998 in
7999 Interface.fromSI SI
8000 end
8001
8002 | evalSpec(IB, INCLUDESpec(I, sigexp)) =
8003 (* [Rule 173] *)
8004 let
8005 val I = evalSigExp(IB, sigexp)
8006 in
8007 I
8008 end
8009
8010 | evalSpec(IB, EMPTYSpec(I)) =
8011 (* [Rule 174] *)
8012 Interface.empty
8013
8014 | evalSpec(IB, SEQSpec(I, spec1, spec2)) =
8015 (* [Rule 77] *)
8016 let
8017 val I1 = evalSpec(IB, spec1)
8018 val I2 = evalSpec(IntBasis.plusI(IB, I1), spec2)
8019 in
8020 Interface.plus(I1,I2)
8021 end
8022
8023 | evalSpec(IB, SHARINGTYPESpec(I, spec, longtycons)) =
8024 (* Omitted [Section 7.1] *)
8025 evalSpec(IB, spec)
8026
8027 | evalSpec(IB, SHARINGSpec(I, spec, longstrids)) =
8028 (* Omitted [Section 7.1] *)
8029 evalSpec(IB, spec)
8030
8031
8032 (* Value Descriptions *)
8033
8034 and evalValDesc(ValDesc(I, vid, _, valdesc_opt)) =
8035 (* [Rule 176] *)
8036 let
8037 val VI = case valdesc_opt
8038 of NONE => VIdMap.empty
8039 | SOME valdesc => evalValDesc(valdesc)
8040 in
8041 VIdMap.insert(VI, vid, IdStatus.v)
8042 end
8043
8044
8045 (* Type Descriptions *)
8046
8047 and evalTypDesc(TypDesc(I, tyvarseq, tycon, typdesc_opt)) =
8048 (* [Rule 177] *)
8049 let
8050 val TI = case typdesc_opt
8051 of NONE => TyConMap.empty
8052 | SOME typdesc => evalTypDesc(typdesc)
8053 in
8054 TyConMap.insert(TI, tycon, VIdMap.empty)
8055 end
8056
8057
8058 (* Datatype Descriptions *)
8059
8060 and evalDatDesc(DatDesc(I, tyvarseq, tycon, condesc, datdesc_opt)) =
8061 (* [Rule 178] *)
8062 let
8063 val VI = evalConDesc(condesc)
8064 val (VI',TI') = case datdesc_opt
8065 of NONE => ( VIdMap.empty, TyConMap.empty )
8066 | SOME datdesc' => evalDatDesc(datdesc')
8067 in
8068 ( VIdMap.unionWith #2 (VI, VI')
8069 , TyConMap.insert(TI', tycon, VI)
8070 )
8071 end
8072
8073
8074 (* Constructor Descriptions *)
8075
8076 and evalConDesc(ConDesc(I, vid, _, condesc_opt)) =
8077 (* [Rule 179] *)
8078 let
8079 val VI = case condesc_opt
8080 of NONE => VIdMap.empty
8081 | SOME condesc => evalConDesc(condesc)
8082 in
8083 VIdMap.insert(VI, vid, IdStatus.c)
8084 end
8085
8086
8087 (* Exception Description *)
8088
8089 and evalExDesc(ExDesc(I, vid, _, exdesc_opt)) =
8090 (* [Rule 180] *)
8091 let
8092 val VI = case exdesc_opt
8093 of NONE => VIdMap.empty
8094 | SOME exdesc => evalExDesc(exdesc)
8095 in
8096 VIdMap.insert(VI, vid, IdStatus.e)
8097 end
8098
8099
8100 (* Structure Descriptions *)
8101
8102 and evalStrDesc(IB, StrDesc(I, strid, sigexp, strdesc_opt)) =
8103 (* [Rule 181] *)
8104 let
8105 val I = evalSigExp(IB, sigexp)
8106 val SI = case strdesc_opt
8107 of NONE => StrIdMap.empty
8108 | SOME strdesc => evalStrDesc(IB, strdesc)
8109 in
8110 StrIdMap.insert(SI, strid, Interface.Str I)
8111 end
8112
8113
8114 (* Functor Bindings *)
8115
8116 and evalFunBind(B, FunBind(I, funid, strid, sigexp, strexp, funbind_opt)) =
8117 (* [Rule 182] *)
8118 (* Note that there is a typo in this rule. *)
8119 let
8120 val I = evalSigExp(IntBasis.Inter B, sigexp)
8121 val F = case funbind_opt
8122 of NONE => FunIdMap.empty
8123 | SOME funbind => evalFunBind(B, funbind)
8124 in
8125 FunIdMap.insert(F, funid,
8126 DynamicBasis.FunctorClosure((strid,I),strexp,B))
8127 end
8128
8129
8130 (* Functor Declarations *)
8131
8132 and evalFunDec(B, FunDec(I, funbind)) =
8133 (* [Rule 183] *)
8134 let
8135 val F = evalFunBind(B, funbind)
8136 in
8137 F
8138 end
8139
8140
8141 (* Top-level Declarations *)
8142
8143 and evalTopDec(s,B, STRDECTopDec(I, strdec, topdec_opt)) =
8144 (* [Rule 184] *)
8145 (* Note the mistake in the conclusion of this rule. *)
8146 let
8147 val E = evalStrDec(s,B, strdec)
8148 val B' = DynamicBasis.fromE E
8149 val B'' = case topdec_opt
8150 of NONE => DynamicBasis.empty
8151 | SOME topdec => evalTopDec(s,B plus B', topdec)
8152 in
8153 B' plus B''
8154 end
8155
8156 | evalTopDec(s,B, SIGDECTopDec(I, sigdec, topdec_opt)) =
8157 (* [Rule 185] *)
8158 (* Note the mistake in the conclusion of this rule. *)
8159 let
8160 val G = evalSigDec(IntBasis.Inter B, sigdec)
8161 val B' = DynamicBasis.fromG G
8162 val B'' = case topdec_opt
8163 of NONE => DynamicBasis.empty
8164 | SOME topdec => evalTopDec(s,B plus B', topdec)
8165 in
8166 B' plus B''
8167 end
8168
8169 | evalTopDec(s,B, FUNDECTopDec(I, fundec, topdec_opt)) =
8170 (* [Rule 186] *)
8171 (* Note the mistake in the conclusion of this rule. *)
8172 let
8173 val F = evalFunDec(B, fundec)
8174 val B' = DynamicBasis.fromF F
8175 val B'' = case topdec_opt
8176 of NONE => DynamicBasis.empty
8177 | SOME topdec => evalTopDec(s,B plus B', topdec)
8178 in
8179 B' plus B''
8180 end
8181
8182 end
8183(* stop of EvalModule.sml *)
8184(* start of PRETTY_PRINT.sml *)
8185(*
8186 * A generic pretty printer.
8187 *
8188 * Based on:
8189 * Philip Wadler. "A prettier printer"
8190 * http://cm.bell-labs.com/cm/cs/who/wadler/
8191 * and Christian Lindig's port to OCaml.
8192 *
8193 * The semantics has been extended to allow 4 different kinds of
8194 * groups (`boxes'), 2 modes of nesting, and varying break representations.
8195 * This is no more easily described by an algebra though, and the `below'
8196 * combinator looses optimality.
8197 *)
8198
8199signature PRETTY_PRINT =
8200 sig
8201
8202 type doc
8203
8204 val empty : doc (* empty document *)
8205 val break : doc (* space or line break *)
8206 val ebreak : doc (* empty or line break *)
8207 val text : string -> doc (* raw text *)
8208
8209 val ^^ : doc * doc -> doc (* concatenation *)
8210 val ^/^ : doc * doc -> doc (* concatenation with break *)
8211
8212 val hbox : doc -> doc (* horizontal box *)
8213 val vbox : doc -> doc (* vertical box *)
8214 val fbox : doc -> doc (* fill box (h and v) *)
8215 val abox : doc -> doc (* auto box (h or v) *)
8216
8217 val nest : int -> doc -> doc (* indentation by k char's *)
8218 val below : doc -> doc (* keep current indentation *)
8219
8220 val isEmpty : doc -> bool
8221
8222 val toString : doc * int -> string
8223 val output : TextIO.outstream * doc * int -> unit
8224
8225 end
8226(* stop of PRETTY_PRINT.sml *)
8227(* start of PrettyPrint.sml *)
8228(*
8229 * A generic pretty printer.
8230 *
8231 * Based on:
8232 * Philip Wadler. "A prettier printer"
8233 * http://cm.bell-labs.com/cm/cs/who/wadler/
8234 * and Christian Lindig's port to OCaml.
8235 *
8236 * The semantics has been extended to allow 4 different kinds of
8237 * groups (`boxes'), 2 modes of nesting, and varying break representations.
8238 * This is no more easily described by an algebra though, and the `below'
8239 * combinator looses optimality.
8240 *)
8241
8242structure PrettyPrint :> PRETTY_PRINT =
8243 struct
8244
8245 (* Types *)
8246
8247 datatype mode = H | V | F | A
8248
8249 datatype doc =
8250 EMPTY
8251 | BREAK of string
8252 | TEXT of string
8253 | CONS of doc * doc
8254 | BOX of mode * doc
8255 | NEST of int * doc
8256 | BELOW of doc
8257
8258 datatype prim =
8259 PTEXT of string
8260 | PLINE of int
8261
8262
8263 (* Interface operators *)
8264
8265 infixr ^^ ^/^
8266
8267 val empty = EMPTY
8268 val break = BREAK " "
8269 val ebreak = BREAK ""
8270 val text = TEXT
8271
8272 fun x ^^ EMPTY = x
8273 | EMPTY ^^ y = y
8274 | x ^^ y = CONS(x, y)
8275
8276 fun x ^/^ EMPTY = x
8277 | EMPTY ^/^ y = y
8278 | x ^/^ y = CONS(x, CONS(break, y))
8279
8280 fun below EMPTY = EMPTY
8281 | below x = BELOW x
8282
8283 fun hbox EMPTY = EMPTY
8284 | hbox x = BOX(H, x)
8285
8286 fun vbox EMPTY = EMPTY
8287 | vbox x = BOX(V, x)
8288
8289 fun fbox EMPTY = EMPTY
8290 | fbox x = BOX(F, x)
8291
8292 fun abox EMPTY = EMPTY
8293 | abox x = BOX(A, x)
8294
8295 fun nest k EMPTY = EMPTY
8296 | nest k x = NEST(k, x)
8297
8298
8299 fun isEmpty EMPTY = true
8300 | isEmpty _ = false
8301
8302
8303 (* Check whether the first line of a document fits into remaining characters *)
8304
8305 (* We abuse the mode A (which can never occur in the lists passed to
8306 * fits) to flag breaks which occur inside swallowed vboxes.
8307 *)
8308
8309 fun fits(w, z) =
8310 w >= 0 andalso
8311 case z
8312 of [] => true
8313 | (i,m,EMPTY)::z => fits(w, z)
8314 | (i,m,CONS(x,y))::z => fits(w, (i,m,x)::(i,m,y)::z)
8315 | (i,m,TEXT s)::z => fits(w - String.size s, z)
8316 | (i,H,BREAK s)::z => fits(w - String.size s, z)
8317 | (i,A,BREAK s)::z => false
8318 | (i,m,BREAK s)::z => true
8319 | (i,m,BOX(V,x))::z => fits(w, (i,A,x)::z)
8320 | (i,m,BOX(n,x))::z => fits(w, (i,H,x)::z)
8321 | (i,m,NEST(j,x))::z => fits(w, (i,m,x)::z)
8322 | (i,m,BELOW x)::z => fits(w, (i,m,x)::z)
8323
8324
8325 (* Layout *)
8326
8327 fun best(w, k, z, a) =
8328 case z
8329 of [] => List.rev a
8330 | (i,m,EMPTY)::z => best(w, k, z, a)
8331 | (i,m,CONS(x,y))::z => best(w, k, (i,m,x)::(i,m,y)::z, a)
8332 | (i,m,TEXT s)::z => best(w, k + String.size s, z, PTEXT(s)::a)
8333 | (i,H,BREAK s)::z => horizontal(w, k, s, z, a)
8334 | (i,V,BREAK s)::z => vertical(w, i, z, a)
8335 | (i,F,BREAK s)::z => if fits(w - k - String.size s, z)
8336 then horizontal(w, k, s, z, a)
8337 else vertical(w, i, z, a)
8338 | (i,A,BREAK s)::z => raise Fail "PrettyPrint.best"
8339 | (i,m,BOX(A,x))::z => if fits(w - k, (i,H,x)::z)
8340 then best(w, k, (i,H,x)::z, a)
8341 else best(w, k, (i,V,x)::z, a)
8342 | (i,m,BOX(n,x))::z => best(w, k, (i,n,x)::z, a)
8343 | (i,m,NEST(j,x))::z => best(w, k, (i+j,m,x)::z, a)
8344 | (i,m,BELOW x)::z => best(w, k, (k,m,x)::z, a)
8345
8346 and horizontal(w, k, s, z, a) =
8347 best(w, k + String.size s, z, PTEXT(s)::a)
8348
8349 and vertical(w, i, z, a) =
8350 best(w, i, z, PLINE(i)::a)
8351
8352
8353 fun layout(doc, w) = best(w, 0, [(0,V,doc)], [])
8354
8355
8356
8357 (* Convert a document *)
8358
8359 fun primToString(PTEXT s) = s
8360 | primToString(PLINE i) =
8361 String.implode(#"\n" :: List.tabulate(i, fn _ => #" "))
8362
8363 val toString = String.concat o List.map primToString o layout
8364
8365
8366
8367 (* Output a document directly (is MUCH faster!) *)
8368
8369 fun loop 0 f = ()
8370 | loop n f = ( f() ; loop (n-1) f )
8371
8372 fun outputPrim os (PTEXT s) = TextIO.output(os, s)
8373 | outputPrim os (PLINE i) =
8374 ( TextIO.output1(os, #"\n")
8375 ; loop i (fn() => TextIO.output1(os, #" "))
8376 )
8377
8378 fun output(os, doc, w) = List.app (outputPrim os) (layout(doc, w))
8379
8380 end
8381(* stop of PrettyPrint.sml *)
8382(* start of PP_MISC.sml *)
8383(*
8384 * Standard ML miscellaneous pretty printing helpers
8385 *)
8386
8387signature PP_MISC =
8388 sig
8389
8390 type doc = PrettyPrint.doc
8391
8392 val nest: doc -> doc
8393
8394 val paren: doc -> doc
8395 val brace: doc -> doc
8396 val brack: doc -> doc
8397
8398 val ppCommaList: ('a -> doc) -> 'a list -> doc
8399 val ppStarList: ('a -> doc) -> 'a list -> doc
8400 val ppSeq: ('a -> doc) -> 'a list -> doc
8401 val ppSeqPrec: (int -> 'a -> doc) -> int -> 'a list -> doc
8402
8403 end
8404(* stop of PP_MISC.sml *)
8405(* start of PPMisc.sml *)
8406(*
8407 * Standard ML miscellaneous pretty printing helpers
8408 *)
8409
8410structure PPMisc :> PP_MISC =
8411 struct
8412
8413 (* Import *)
8414
8415 open PrettyPrint
8416
8417 infixr ^^
8418
8419
8420 (* Some PP combinators *)
8421
8422 val nest = nest 2
8423
8424 fun paren doc = text "(" ^^ fbox(below doc) ^^ text ")"
8425 fun brace doc = text "{" ^^ fbox(below doc) ^^ text "}"
8426 fun brack doc = text "[" ^^ fbox(below doc) ^^ text "]"
8427
8428 fun ppCommaList ppX [] = empty
8429 | ppCommaList ppX [x] = ppX x
8430 | ppCommaList ppX (x::xs) = ppX x ^^ text "," ^^ break ^^
8431 ppCommaList ppX xs
8432
8433 fun ppStarList ppX [] = empty
8434 | ppStarList ppX [x] = ppX x
8435 | ppStarList ppX (x::xs) = hbox(ppX x ^^ break ^^ text "*") ^^ break ^^
8436 ppStarList ppX xs
8437
8438 fun ppSeqPrec ppXPrec n [] = empty
8439 | ppSeqPrec ppXPrec n [x] = ppXPrec n x
8440 | ppSeqPrec ppXPrec n xs = paren(ppCommaList (ppXPrec 0) xs)
8441
8442 fun ppSeq ppX = ppSeqPrec (fn _ => ppX) 0
8443
8444 end
8445(* stop of PPMisc.sml *)
8446(* start of PP_VAL.sml *)
8447(*
8448 * Standard ML pretty printing of values
8449 *)
8450
8451signature PP_VAL =
8452 sig
8453
8454 type doc = PrettyPrint.doc
8455 type 'a State = 'a State.State
8456 type 'a Val = 'a Val.Val
8457 type 'a ExVal = 'a Val.ExVal
8458
8459 val ppVal: 'a State * 'a Val -> doc
8460 val ppExVal: 'a State * 'a ExVal -> doc
8461
8462 end
8463(* stop of PP_VAL.sml *)
8464(* start of PPVal.sml *)
8465(*
8466 * Standard ML pretty printing of values
8467 *)
8468
8469structure PPVal :> PP_VAL =
8470 struct
8471
8472 (* Import *)
8473
8474 type 'a State = 'a State.State
8475
8476 open Val
8477 open PrettyPrint
8478 open PPMisc
8479
8480 infixr ^^ ^/^
8481
8482
8483 (* Simple objects *)
8484
8485 val ppFn = text "<fn>"
8486
8487 fun ppLab lab = text(Lab.toString lab)
8488 fun ppVId vid = text(VId.toString vid)
8489 fun ppExName en = text(ExName.toString en)
8490 fun ppSVal sv = text(SVal.toString sv)
8491
8492
8493 (* Values *)
8494
8495 (* Precedence:
8496 * 0 : plain expressions
8497 * 1 : constructor arguments
8498 *)
8499
8500 fun ppVal (s, v) = fbox(below(nest(ppValPrec (0, s) v)))
8501 and ppExVal(s, e) = fbox(below(nest(ppExValPrec (0, s) e)))
8502
8503 and ppValPrec (p, s) (op:=) =
8504 ppFn
8505
8506 | ppValPrec (p, s) (SVal sv) =
8507 ppSVal sv
8508
8509 | ppValPrec (p, s) (BasVal b) =
8510 ppFn
8511
8512 | ppValPrec (p, s) (VId vid) =
8513 ppVId vid
8514
8515 | ppValPrec (p, s) (v as VIdVal(vid, v')) =
8516 let
8517 exception NotAList
8518
8519 fun items(VId vid, vs) =
8520 if vid <> VId.fromString "nil" then
8521 raise NotAList
8522 else
8523 List.rev vs
8524
8525 | items(VIdVal(vid, v), vs) =
8526 if vid <> VId.fromString "::" then
8527 raise NotAList
8528 else
8529 (case Val.unpair v
8530 of NONE => raise NotAList
8531 | SOME(v1, v2) => items(v2, v1::vs)
8532 )
8533
8534 | items(_, vs) = raise NotAList
8535 in
8536 let
8537 val vs = items(v, [])
8538 in
8539 brack(ppCommaList (ppValPrec (0, s)) vs)
8540 end
8541 handle NotAList =>
8542 let
8543 val doc = ppVId vid ^/^ ppValPrec (1, s) v'
8544 in
8545 if p = 0 then
8546 doc
8547 else
8548 paren doc
8549 end
8550 end
8551
8552 | ppValPrec (p, s) (ExVal e) =
8553 ppExValPrec (p, s) e
8554
8555 | ppValPrec (p, s) (Record r) =
8556 let
8557 fun isTuple( [], n) = n > 2
8558 | isTuple(lab::labs, n) =
8559 lab = Lab.fromInt n andalso isTuple(labs, n+1)
8560
8561 val labvs = LabMap.listItemsi r
8562 val (labs,vs) = ListPair.unzip labvs
8563 in
8564 if List.null labs then
8565 text "()"
8566 else if isTuple(labs, 1) then
8567 paren(ppCommaList (ppValPrec (0, s)) vs)
8568 else
8569 brace(ppCommaList (ppLabVal s) labvs)
8570 end
8571
8572 | ppValPrec (p, s) (Addr a) =
8573 let
8574 val v = case State.findAddr(s, a)
8575 of SOME v => v
8576 | NONE => raise Fail "PPVal.ppVal: invalid address"
8577
8578 val doc = text "ref" ^/^ ppValPrec (1, s) v
8579 in
8580 if p = 0 then
8581 doc
8582 else
8583 paren doc
8584 end
8585
8586 | ppValPrec (p, s) (FcnClosure _) =
8587 ppFn
8588
8589
8590 and ppLabVal s (lab, v) =
8591 abox(
8592 hbox(
8593 ppLab lab ^/^
8594 text "="
8595 ) ^^
8596 below(nest(break ^^
8597 ppVal(s, v)
8598 ))
8599 )
8600
8601
8602 and ppExValPrec (p, s) (ExName en) =
8603 ppExName en
8604
8605 | ppExValPrec (p, s) (ExNameVal(en, v)) =
8606 let
8607 val doc = ppExName en ^/^ ppValPrec (1, s) v
8608 in
8609 if p = 0 then
8610 doc
8611 else
8612 paren doc
8613 end
8614
8615 end
8616(* stop of PPVal.sml *)
8617(* start of PP_DYNAMIC_ENV.sml *)
8618(*
8619 * Standard ML pretty printing of the dynamic environment
8620 *)
8621
8622signature PP_DYNAMIC_ENV =
8623 sig
8624
8625 type doc = PrettyPrint.doc
8626 type Env = DynamicEnv.Env
8627 type Str = DynamicEnv.Str
8628 type State = DynamicEnv.FcnClosure State.State
8629
8630 val ppEnv: State * Env -> doc
8631 val ppStr: State * Str -> doc
8632
8633 end
8634(* stop of PP_DYNAMIC_ENV.sml *)
8635(* start of PPDynamicEnv.sml *)
8636(*
8637 * Standard ML pretty printing of the dynamic environment
8638 *)
8639
8640structure PPDynamicEnv :> PP_DYNAMIC_ENV =
8641 struct
8642
8643 (* Import *)
8644
8645 type Env = DynamicEnv.Env
8646 type Str = DynamicEnv.Str
8647 type State = DynamicEnv.FcnClosure State.State
8648
8649 open PrettyPrint
8650 open PPMisc
8651
8652 infixr ^^ ^/^
8653
8654
8655 (* Simple objects *)
8656
8657 fun ppVId vid = text(VId.toString vid)
8658 fun ppStrId strid = text(StrId.toString strid)
8659
8660
8661 (* Environments *)
8662
8663 fun ppValEnv(s, VE) =
8664 VIdMap.foldri
8665 (fn(vid, (v,IdStatus.v), doc) =>
8666 abox(
8667 hbox(
8668 text "val" ^/^
8669 ppVId vid ^/^
8670 text "="
8671 ) ^^
8672 nest(break ^^
8673 abox(PPVal.ppVal(s, v))
8674 )
8675 ) ^/^
8676 doc
8677
8678 | (vid, (v,_), doc) => doc
8679 )
8680 empty VE
8681
8682 fun ppExEnv VE =
8683 VIdMap.foldri
8684 (fn(vid, (v,IdStatus.e), doc) =>
8685 hbox(
8686 text "exception" ^/^
8687 ppVId vid
8688 ) ^/^
8689 doc
8690
8691 | (vid, (v,_), doc) => doc
8692 )
8693 empty VE
8694
8695 fun ppConEnv VE =
8696 VIdMap.foldli
8697 (fn(vid, (v,IdStatus.c), doc) =>
8698 hbox(
8699 text "con" ^/^
8700 ppVId vid
8701 ) ^/^
8702 doc
8703
8704 | (vid, (v,_), doc) => doc
8705 )
8706 empty VE
8707
8708 fun ppStrEnv(s, SE) =
8709 StrIdMap.foldri
8710 (fn(strid, S, doc) =>
8711 abox(
8712 hbox(
8713 text "structure" ^/^
8714 ppStrId strid ^/^
8715 text "="
8716 ) ^^
8717 nest(break ^^
8718 ppStr(s, S)
8719 )
8720 ) ^/^
8721 doc
8722 )
8723 empty SE
8724
8725 and ppEnv(s, (SE,TE,VE)) =
8726 vbox(
8727 ppStrEnv(s, SE) ^/^
8728 ppConEnv VE ^/^
8729 ppExEnv VE ^/^
8730 ppValEnv(s, VE)
8731 )
8732
8733
8734 (* Structures *)
8735
8736 and ppStr(s, DynamicEnv.Str E) =
8737 let
8738 val doc = ppEnv(s, E)
8739 in
8740 abox(below(
8741 text "struct" ^^
8742 (if isEmpty doc then
8743 empty
8744 else
8745 nest(vbox(break ^^ doc))
8746 ) ^^ break ^^
8747 text "end"
8748 ))
8749 end
8750
8751 end
8752(* stop of PPDynamicEnv.sml *)
8753(* start of PP_DYNAMIC_BASIS.sml *)
8754(*
8755 * Standard ML pretty printing of the dynamic basis
8756 *)
8757
8758signature PP_DYNAMIC_BASIS =
8759 sig
8760
8761 type doc = PrettyPrint.doc
8762 type Basis = DynamicBasis.Basis
8763 type State = DynamicEnv.FcnClosure State.State
8764
8765 val ppBasis: State * Basis -> doc
8766
8767 end
8768(* stop of PP_DYNAMIC_BASIS.sml *)
8769(* start of PPDynamicBasis.sml *)
8770(*
8771 * Standard ML pretty printing of the dynamic basis
8772 *)
8773
8774structure PPDynamicBasis :> PP_DYNAMIC_BASIS =
8775 struct
8776
8777 (* Import *)
8778
8779 type Basis = DynamicBasis.Basis
8780 type State = DynamicEnv.FcnClosure State.State
8781
8782 open PrettyPrint
8783
8784 infixr ^^ ^/^
8785
8786
8787 (* Simple objects *)
8788
8789 fun ppFunId funid = text(FunId.toString funid)
8790
8791
8792 (* Environments *)
8793
8794 fun ppFunEnv F =
8795 FunIdMap.foldri
8796 (fn(funid, _, doc) =>
8797 hbox(
8798 text "functor" ^/^
8799 ppFunId funid
8800 ) ^/^
8801 doc
8802 )
8803 empty F
8804
8805
8806 (* Basis *)
8807
8808 fun ppBasis(s, (F,G,E)) =
8809 vbox(
8810 ppFunEnv F ^/^
8811 PPDynamicEnv.ppEnv(s, E) ^/^
8812 text ""
8813 )
8814
8815 end
8816(* stop of PPDynamicBasis.sml *)
8817(* start of CHECK_PATTERN.sml *)
8818(*
8819 * Standard ML consistency of patterns and matches
8820 *
8821 * Definition, section 4.11
8822 *
8823 * Note:
8824 * The requirement to check for irredundancy of matches is a `bug' in the
8825 * definition since this cannot be checked in general for two reasons:
8826 *
8827 * (1) There may be (hidden) aliasing of exception constructors.
8828 * Consequently, we only detect redundant exception constructors
8829 * if they are denoted by the same longvid.
8830 *
8831 * (2) There is no requirement of consistency for constructors in
8832 * sharing specifications or type realisations (actually, we
8833 * consider this a serious bug). For example,
8834 * datatype t1 = A | B
8835 * datatype t2 = C
8836 * sharing type t1 = t2
8837 * is a legal specification. This allows a mix of the constructors
8838 * to appear in matches, rendering the terms of irredundancy and
8839 * exhaustiveness meaningless. We make no attempt to detect this,
8840 * so generated warnings may or may not make sense in that situation.
8841 *)
8842
8843
8844signature CHECK_PATTERN =
8845 sig
8846
8847 (* Import *)
8848
8849 type Pat = GrammarCore.Pat
8850 type Match = GrammarCore.Match
8851 type Env = StaticEnv.Env
8852
8853
8854 (* Operations *)
8855
8856 val checkPat: Env * Pat -> unit
8857 val checkMatch: Env * Match -> unit
8858
8859 end
8860(* stop of CHECK_PATTERN.sml *)
8861(* start of CheckPattern.sml *)
8862(*
8863 * Standard ML consistency of patterns and matches
8864 *
8865 * Definition, section 4.11
8866 *
8867 * Note:
8868 * The requirement to check for irredundancy of matches is a `bug' in the
8869 * definition since this cannot be checked in general for two reasons:
8870 *
8871 * (1) There may be (hidden) aliasing of exception constructors.
8872 * Consequently, we only detect redundant exception constructors
8873 * if they are denoted by the same longvid.
8874 *
8875 * (2) There is no requirement of consistency for constructors in
8876 * sharing specifications or type realisations (actually, we
8877 * consider this a serious bug). For example,
8878 * datatype t1 = A | B
8879 * datatype t2 = C
8880 * sharing type t1 = t2
8881 * is a legal specification. This allows a mix of the constructors
8882 * to appear in matches, rendering the terms of irredundancy and
8883 * exhaustiveness meaningless. We make no attempt to detect this,
8884 * so generated warnings may or may not make sense in that situation.
8885 *
8886 * Bugs:
8887 * All types of special constants are assumed to be infinite, so that
8888 * a match only gets exhaustive by placing a variable. This is a bit
8889 * inaccurate for char in particular where the programmer actually would
8890 * be able to write down the complete set of values.
8891 * The reason is that for special constants to be treated properly in
8892 * the presence of overloading we would require the (resolved) type
8893 * information.
8894 *)
8895
8896structure CheckPattern :> CHECK_PATTERN =
8897 struct
8898
8899 (* Import *)
8900
8901 type SCon = SCon.SCon
8902 type Lab = Lab.Lab
8903 type VId = VId.Id
8904 type longVId = LongVId.longId
8905 type Pat = GrammarCore.Pat
8906 type Match = GrammarCore.Match
8907 type Env = StaticEnv.Env
8908
8909 type SConSet = SConSet.set
8910 type VIdSet = VIdSet.set
8911 type LongVIdSet = LongVIdSet.set
8912 type 'a LabMap = 'a LabMap.map
8913
8914
8915 open GrammarCore
8916
8917
8918
8919 (*
8920 * Algorithm has been derived from:
8921 * Peter Sestoft.
8922 * "ML pattern matching compilation and partial evaluation",
8923 * in: Dagstuhl Seminar on Partial Evaluation,
8924 * Lecture Notes in Computer Science, Springer-Verlag 1996
8925 *)
8926
8927
8928 (* Value description *)
8929
8930 datatype description =
8931 ANY
8932 | SCON of SCon
8933 | NOT_SCON of SConSet
8934 | EXCON of longVId * description option
8935 | NOT_EXCON of LongVIdSet
8936 | CON of VId * description option
8937 | NOT_CON of VIdSet
8938 | RECORD of description LabMap
8939
8940 datatype context =
8941 EXCON' of longVId
8942 | CON' of VId
8943 | LAB' of Lab
8944 | RECORD' of description LabMap
8945
8946 type knowledge = description * context list
8947
8948 type continuations = PatRow option list * Match option
8949
8950
8951
8952 (* Extending the context on partial success *)
8953
8954 fun augment(EXCON'(longvid)::context, desc) =
8955 augment(context, EXCON(longvid, SOME desc))
8956
8957 | augment(CON'(vid)::context, desc) =
8958 augment(context, CON(vid, SOME desc))
8959
8960 | augment(LAB'(lab)::RECORD'(descs)::context, desc) =
8961 RECORD'(LabMap.insert(descs, lab, desc)) :: context
8962
8963 | augment _ = raise Fail "CheckPattern.augment: invalid context"
8964
8965
8966 (* Building the description on failure *)
8967
8968 fun build([], desc) =
8969 desc
8970
8971 | build(EXCON'(longvid)::context, desc) =
8972 build(context, EXCON(longvid, SOME desc))
8973
8974 | build(CON'(vid)::context, desc) =
8975 build(context, CON(vid, SOME desc))
8976
8977 | build(LAB'(lab)::RECORD'(descs)::context, desc) =
8978 build(context, RECORD(LabMap.insert(descs, lab, desc)))
8979
8980 | build _ = raise Fail "CheckPattern.build: invalid context"
8981
8982
8983 (* Result type for static matching *)
8984
8985 structure RegionSet = FinSetFn(type ord_key = Source.region
8986 val compare = Source.compare)
8987
8988 type result = RegionSet.set * bool
8989
8990 val success = ( RegionSet.empty, true )
8991 val failure = ( RegionSet.empty, false )
8992
8993 fun branch((P1, exhaustive1), (P2, exhaustive2)) =
8994 ( RegionSet.union(P1, P2), exhaustive1 andalso exhaustive2 )
8995
8996 fun reached(I, (P, exhaustive)) =
8997 ( RegionSet.add(P, I), exhaustive )
8998
8999
9000
9001 (* Static pattern matching *)
9002
9003 fun matchMatch(E, desc, Match(_, mrule, match_opt)) =
9004 matchMrule(E, desc, mrule, match_opt)
9005
9006
9007 and matchMrule(E, desc, Mrule(I, pat, exp), match_opt) =
9008 reached(I, matchPat(E, (desc, []), pat, ([], match_opt)))
9009
9010
9011 and matchAtPat(E, know, atpat, cont) =
9012 case atpat
9013 of WILDCARDAtPat(_) =>
9014 succeed(E, know, cont)
9015
9016 | SCONAtPat(_, scon) =>
9017 matchSCon(E, know, scon, cont)
9018
9019 | LONGVIDAtPat(_, _, longvid) =>
9020 (case StaticEnv.findLongVId(E, longvid)
9021 of NONE =>
9022 succeed(E, know, cont)
9023
9024 | SOME(sigma, IdStatus.v) =>
9025 succeed(E, know, cont)
9026
9027 | SOME(sigma, IdStatus.e) =>
9028 matchExCon(E, know, longvid, NONE, cont)
9029
9030 | SOME((_,tau), IdStatus.c) =>
9031 let
9032 val vid = LongVId.toId longvid
9033 val span = TyName.span(Type.tyname(Type.range tau))
9034 in
9035 matchCon(E, know, vid, span, NONE, cont)
9036 end
9037 )
9038
9039 | RECORDAtPat(_, patrow_opt) =>
9040 matchRecord(E, know, patrow_opt, cont)
9041
9042 | PARAtPat(_, pat) =>
9043 matchPat(E, know, pat, cont)
9044
9045
9046 and matchPat(E, know, pat, cont) =
9047 case pat
9048 of ATPATPat(_, atpat) =>
9049 matchAtPat(E, know, atpat, cont)
9050
9051 | CONPat(_, _, longvid, atpat) =>
9052 (case StaticEnv.findLongVId(E, longvid)
9053 of SOME(sigma, IdStatus.e) =>
9054 matchExCon(E, know, longvid, SOME atpat, cont)
9055
9056 | SOME((_,tau), IdStatus.c) =>
9057 let
9058 val vid = LongVId.toId longvid
9059 val span = TyName.span(Type.tyname(Type.range tau))
9060 in
9061 matchCon(E, know, vid, span, SOME atpat, cont)
9062 end
9063
9064 | _ => raise Fail "CheckMatching.matchPat: \
9065 \invalid constructed pattern"
9066 )
9067
9068 | TYPEDPat(_, pat, ty) =>
9069 matchPat(E, know, pat, cont)
9070
9071 | ASPat(_, _, vid, ty_opt, pat) =>
9072 matchPat(E, know, pat, cont)
9073
9074
9075 and matchRecord(E, (desc, context), patrow_opt, cont) =
9076 let
9077 val descs = case desc
9078 of ANY => LabMap.empty
9079 | RECORD descs => descs
9080 | _ =>
9081 raise Fail "CheckPattern.matchRecord: type error"
9082 in
9083 matchPatRowOpt(E, RECORD'(descs)::context, patrow_opt, cont)
9084 end
9085
9086
9087 and matchPatRowOpt(E, RECORD'(descs)::context, patrow_opt,
9088 cont as (patrow_opts, match_opt)) =
9089 (case patrow_opt
9090 of SOME(ROWPatRow(_, lab, pat, patrow_opt')) =>
9091 let
9092 val desc' = case LabMap.find(descs, lab)
9093 of NONE => ANY
9094 | SOME desc' => desc'
9095 in
9096 matchPat(E, (desc', LAB'(lab)::RECORD'(descs)::context), pat,
9097 (patrow_opt'::patrow_opts, match_opt))
9098 end
9099
9100 | _ =>
9101 succeed(E, (RECORD descs, context), cont)
9102 )
9103 | matchPatRowOpt _ =
9104 raise Fail "CheckPattern.matchPatRowOpt: inconsistent context"
9105
9106
9107 and matchSCon(E, know as (desc, context), scon, cont) =
9108 let
9109 val knowSucc = (SCON scon, context)
9110 fun knowFail scons = (NOT_SCON(SConSet.add(scons, scon)), context)
9111 in
9112 case desc
9113 of ANY =>
9114 branch(succeed(E, knowSucc, cont),
9115 fail(E, knowFail SConSet.empty, cont)
9116 )
9117
9118 | SCON scon' =>
9119 if SCon.compare(scon, scon') = EQUAL then
9120 succeed(E, know, cont)
9121 else
9122 fail(E, know, cont)
9123
9124 | NOT_SCON scons =>
9125 if SConSet.member(scons, scon) then
9126 fail(E, know, cont)
9127 else
9128 branch(succeed(E, knowSucc, cont),
9129 fail(E, knowFail scons, cont)
9130 )
9131
9132 | _ => raise Fail "CheckPattern.matchSCon: type error"
9133 end
9134
9135
9136 and matchExCon(E, know as (desc, context), longvid, atpat_opt, cont) =
9137 let
9138 val knowSucc = (EXCON(longvid, NONE), EXCON'(longvid)::context)
9139 fun knowFail longvids =
9140 (NOT_EXCON(LongVIdSet.add(longvids, longvid)), context)
9141 in
9142 case desc
9143 of ANY =>
9144 branch(matchArgOpt(E, knowSucc, SOME ANY, atpat_opt, cont),
9145 fail(E, knowFail LongVIdSet.empty, cont)
9146 )
9147
9148 | EXCON(longvid', desc_opt) =>
9149 if longvid = longvid' then
9150 matchArgOpt(E, knowSucc, desc_opt, atpat_opt, cont)
9151 else
9152 fail(E, know, cont)
9153
9154 | NOT_EXCON longvids =>
9155 if LongVIdSet.member(longvids, longvid) then
9156 fail(E, know, cont)
9157 else
9158 branch(matchArgOpt(E, knowSucc, SOME ANY, atpat_opt, cont),
9159 fail(E, knowFail longvids, cont)
9160 )
9161
9162 | _ => raise Fail "CheckPattern.matchSCon: type error"
9163 end
9164
9165
9166 and matchCon(E, know as (desc, context), vid, span, atpat_opt, cont) =
9167 let
9168 val knowSucc = (CON(vid, NONE), CON'(vid)::context)
9169 fun knowFail vids = (NOT_CON(VIdSet.add(vids, vid)), context)
9170 in
9171 case desc
9172 of ANY =>
9173 if span = 1 then
9174 matchArgOpt(E, knowSucc, SOME ANY, atpat_opt, cont)
9175 else
9176 branch(matchArgOpt(E, knowSucc, SOME ANY, atpat_opt, cont),
9177 fail(E, knowFail VIdSet.empty, cont)
9178 )
9179
9180 | CON(vid', desc_opt) =>
9181 if vid = vid' then
9182 matchArgOpt(E, knowSucc, desc_opt, atpat_opt, cont)
9183 else
9184 fail(E, know, cont)
9185
9186 | NOT_CON vids =>
9187 if VIdSet.member(vids, vid) then
9188 fail(E, know, cont)
9189 else if VIdSet.numItems vids = span - 1 then
9190 matchArgOpt(E, knowSucc, SOME ANY, atpat_opt, cont)
9191 else
9192 branch(matchArgOpt(E, knowSucc, SOME ANY, atpat_opt, cont),
9193 fail(E, knowFail vids, cont)
9194 )
9195
9196 | _ => raise Fail "CheckPattern.matchSCon: type error"
9197 end
9198
9199
9200 and matchArgOpt(E, (desc, context), desc_opt, atpat_opt, cont) =
9201 case atpat_opt
9202 of NONE =>
9203 succeed(E, (desc, List.tl context), cont)
9204
9205 | SOME atpat =>
9206 matchAtPat(E, (valOf desc_opt, context), atpat, cont)
9207
9208
9209
9210 and succeed(E, know, ([], match_opt)) =
9211 success
9212
9213 | succeed(E, (desc, context), (patrow_opt::patrow_opts, match_opt)) =
9214 let
9215 val context' = augment(context, desc)
9216 in
9217 matchPatRowOpt(E, context', patrow_opt, (patrow_opts, match_opt))
9218 end
9219
9220
9221 and fail(E, know, (_, NONE)) =
9222 failure
9223
9224 | fail(E, (desc, context), (_, SOME match)) =
9225 matchMatch(E, build(context, desc), match)
9226
9227
9228
9229 (* Checking matches [Section 4.11, item 2] *)
9230
9231 fun checkReachableMrule(reachables, Mrule(I, _, _)) =
9232 if RegionSet.member(reachables, I) then
9233 ()
9234 else
9235 Error.warning(I, "redundant match rule")
9236
9237 fun checkReachableMatchOpt(reachables, NONE) = ()
9238 | checkReachableMatchOpt(reachables, SOME(Match(_, mrule, match_opt))) =
9239 ( checkReachableMrule(reachables, mrule)
9240 ; checkReachableMatchOpt(reachables, match_opt)
9241 )
9242
9243 fun checkMatch(E, match) =
9244 let
9245 val (reachables, exhaustive) = matchMatch(E, ANY, match)
9246 in
9247 checkReachableMatchOpt(reachables, SOME match)
9248 ; if exhaustive then
9249 ()
9250 else
9251 Error.warning(infoMatch match, "match not exhaustive")
9252 end
9253
9254
9255
9256 (* Checking single patterns [Section 4.11, item 3] *)
9257
9258 fun checkPat(E, pat) =
9259 let
9260 val (_, exhaustive) = matchPat(E, (ANY, []), pat, ([], NONE))
9261 in
9262 if exhaustive then
9263 ()
9264 else
9265 Error.warning(infoPat pat, "pattern not exhaustive")
9266 end
9267
9268 end
9269(* stop of CheckPattern.sml *)
9270(* start of ELAB_CORE.sml *)
9271(*
9272 * Standard ML core elaboration
9273 *
9274 * Definition, sections 4.10, 4.11, 4.6, 4.7, 2.9
9275 *
9276 * Notes:
9277 * - Elaboration also checks the syntactic restrictions [Section 2.9]
9278 * and the further restrictions [Section 4.11].
9279 * - To implement the 3rd restriction in 4.11 elabDec is passed an
9280 * additional boolean argument to recognise being on the toplevel.
9281 *)
9282
9283
9284signature ELAB_CORE =
9285 sig
9286
9287 (* Import types *)
9288
9289 type Dec = GrammarCore.Dec
9290 type Ty = GrammarCore.Ty
9291 type TyVarseq = GrammarCore.TyVarseq
9292
9293 type VId = VId.Id
9294 type TyVar = TyVar.TyVar
9295 type TyVarSet = TyVarSet.set
9296 type Type = Type.Type
9297 type Env = StaticEnv.Env
9298 type Context = Context.Context
9299
9300
9301 (* Export *)
9302
9303 val elabDec: bool * Context * Dec -> Env
9304 val elabTy: Context * Ty -> Type
9305
9306 val tyvars: TyVarseq -> TyVarSet * TyVar list
9307
9308 val validBindVId: VId -> bool
9309 val validConBindVId: VId -> bool
9310
9311 end
9312(* stop of ELAB_CORE.sml *)
9313(* start of ElabCore.sml *)
9314(*
9315 * Standard ML core elaboration
9316 *
9317 * Definition, sections 4.10, 4.11, 4.6, 4.7, 2.9
9318 *
9319 * Notes:
9320 * - Elaboration also checks the syntactic restrictions [Section 2.9]
9321 * and the further restrictions [Section 4.11].
9322 * - To implement the 3rd restriction in 4.11 some elab functions are
9323 * passed an additional boolean argument to recognise being on the toplevel.
9324 * - There is a bug in the Definition -- an important syntactic restriction
9325 * is missing:
9326 * "Any tyvar occuring on the right side of a typbind or datbind of the
9327 * form tyvarseq tycon = ... must occur in tyvarseq."
9328 * - The definition says that overloaded types get defaulted if the
9329 * "surrounding text" does not resolve it. It leaves some freedom to
9330 * how large this context may be. We choose the innermost value binding.
9331 * - The definition states that "the program context" must determine the
9332 * exact type of flexible records, but it does not say how large this
9333 * context may be either. Again we choose the innermost surrounding value
9334 * binding.
9335 * - Most conditions on type names can be ignored since they are
9336 * always ensured by the Stamp mechanism.
9337 *
9338 * Bugs:
9339 * - Unresolved overloading is left unnoticed if it never propagates to a
9340 * value binding's result environment. To resolve all cases we either had
9341 * to annotate all expressions with their types and walk the whole tree
9342 * for each value binding's RHS, or extend the inference results with
9343 * complicated information on overloaded type variables, or use some dirty
9344 * side effect hack.
9345 * - The same goes for unresolved flexible record types, for essentially the
9346 * same reason.
9347 *)
9348
9349structure ElabCore :> ELAB_CORE =
9350 struct
9351
9352 (* Import *)
9353
9354 type Dec = GrammarCore.Dec
9355 type Ty = GrammarCore.Ty
9356 type TyVarseq = GrammarCore.TyVarseq
9357
9358 type VId = VId.Id
9359 type TyVar = TyVar.TyVar
9360 type TyVarSet = TyVarSet.set
9361 type Type = Type.Type
9362 type Env = StaticEnv.Env
9363 type Context = Context.Context
9364
9365
9366 open GrammarCore
9367
9368
9369 (* Some helpers for error messages *)
9370
9371 val error = Error.error
9372
9373 fun errorLab(I, s, lab) = error(I, s ^ Lab.toString lab)
9374 fun errorVId(I, s, vid) = error(I, s ^ VId.toString vid)
9375 fun errorTyCon(I, s, tycon) = error(I, s ^ TyCon.toString tycon)
9376 fun errorTyVar(I, s, tyvar) = error(I, s ^ TyVar.toString tyvar)
9377
9378 fun errorLongVId(I, s, longvid) = error(I, s ^ LongVId.toString longvid)
9379 fun errorLongTyCon(I, s, longtycon) =
9380 error(I, s ^ LongTyCon.toString longtycon)
9381 fun errorLongStrId(I, s, longstrid) =
9382 error(I, s ^ LongStrId.toString longstrid)
9383
9384
9385
9386 (* Helpers for context modification *)
9387
9388 val plus = StaticEnv.plus
9389 val plusU = Context.plusU
9390 val plusVE = Context.plusVE
9391 val oplusE = Context.oplusE
9392 val oplusTE = Context.oplusTE
9393 val oplusVEandTE = Context.oplusVEandTE
9394
9395 infix plusU plusVE oplusE oplusTE oplusVEandTE
9396
9397
9398
9399 (* Checking restriction for vids in binding [Section 2.9, 5th bullet] *)
9400
9401 fun validBindVId vid =
9402 vid <> VId.fromString "true" andalso
9403 vid <> VId.fromString "false" andalso
9404 vid <> VId.fromString "nil" andalso
9405 vid <> VId.fromString "::" andalso
9406 vid <> VId.fromString "ref"
9407
9408 fun validConBindVId vid =
9409 validBindVId vid andalso
9410 vid <> VId.fromString "it"
9411
9412
9413 (* Treating tyvarseqs *)
9414
9415 fun tyvars(TyVarseq(I, tyvars)) =
9416 let
9417 fun collect( [], U) = U
9418 | collect(tyvar::tyvars, U) =
9419 if TyVarSet.member(U, tyvar) then
9420 (* Syntactic restriction [Section 2.9, 3rd bullet] *)
9421 errorTyVar(I, "duplicate type variable ", tyvar)
9422 else
9423 collect(tyvars, TyVarSet.add(U, tyvar))
9424 in
9425 ( collect(tyvars, TyVarSet.empty), tyvars )
9426 end
9427
9428
9429
9430 (* Typing special constants [Section 4.1, Appendix E.1] *)
9431
9432 fun typeSCon(SCon.INT _) = Type.fromOverloadingClass InitialStaticEnv.Int
9433 | typeSCon(SCon.WORD _) = Type.fromOverloadingClass InitialStaticEnv.Word
9434 | typeSCon(SCon.CHAR _) = Type.fromOverloadingClass InitialStaticEnv.Char
9435 | typeSCon(SCon.REAL _) = Type.fromOverloadingClass InitialStaticEnv.Real
9436 | typeSCon(SCon.STRING _) =
9437 Type.fromOverloadingClass InitialStaticEnv.String
9438
9439
9440 (* Calculate sets of unguarded explicit type variables [Section 4.6] *)
9441
9442 local
9443 val op+ = TyVarSet.union
9444
9445 fun ? tyvarsX NONE = TyVarSet.empty
9446 | ? tyvarsX (SOME x) = tyvarsX x
9447 in
9448
9449 fun unguardedTyVarsAtExp(RECORDAtExp(_, exprow_opt)) =
9450 ?unguardedTyVarsExpRow exprow_opt
9451 | unguardedTyVarsAtExp(LETAtExp(_, dec, exp)) =
9452 unguardedTyVarsDec dec + unguardedTyVarsExp exp
9453 | unguardedTyVarsAtExp(PARAtExp(_, exp)) =
9454 unguardedTyVarsExp exp
9455 | unguardedTyVarsAtExp _ = TyVarSet.empty
9456
9457 and unguardedTyVarsExpRow(ExpRow(_, lab, exp, exprow_opt)) =
9458 unguardedTyVarsExp exp + ?unguardedTyVarsExpRow exprow_opt
9459
9460 and unguardedTyVarsExp(ATEXPExp(_, atexp)) =
9461 unguardedTyVarsAtExp atexp
9462 | unguardedTyVarsExp(APPExp(_, exp, atexp)) =
9463 unguardedTyVarsExp exp + unguardedTyVarsAtExp atexp
9464 | unguardedTyVarsExp(TYPEDExp(_, exp, ty)) =
9465 unguardedTyVarsExp exp + unguardedTyVarsTy ty
9466 | unguardedTyVarsExp(HANDLEExp(_, exp, match)) =
9467 unguardedTyVarsExp exp + unguardedTyVarsMatch match
9468 | unguardedTyVarsExp(RAISEExp(_, exp)) =
9469 unguardedTyVarsExp exp
9470 | unguardedTyVarsExp(FNExp(_, match)) =
9471 unguardedTyVarsMatch match
9472
9473 and unguardedTyVarsMatch(Match(_, mrule, match_opt)) =
9474 unguardedTyVarsMrule mrule + ?unguardedTyVarsMatch match_opt
9475
9476 and unguardedTyVarsMrule(Mrule(_, pat, exp)) =
9477 unguardedTyVarsPat pat + unguardedTyVarsExp exp
9478
9479 and unguardedTyVarsDec(ABSTYPEDec(_, datbind, dec)) =
9480 unguardedTyVarsDec dec
9481 | unguardedTyVarsDec(EXCEPTIONDec(_, exbind)) =
9482 unguardedTyVarsExBind exbind
9483 | unguardedTyVarsDec(LOCALDec(_, dec1, dec2)) =
9484 unguardedTyVarsDec dec1 + unguardedTyVarsDec dec2
9485 | unguardedTyVarsDec(SEQDec(_, dec1, dec2)) =
9486 unguardedTyVarsDec dec1 + unguardedTyVarsDec dec2
9487 | unguardedTyVarsDec _ = TyVarSet.empty
9488
9489 and unguardedTyVarsValBind(PLAINValBind(_, pat, exp, valbind_opt)) =
9490 unguardedTyVarsPat pat + unguardedTyVarsExp exp +
9491 ?unguardedTyVarsValBind valbind_opt
9492 | unguardedTyVarsValBind(RECValBind(_, valbind)) =
9493 unguardedTyVarsValBind valbind
9494
9495 and unguardedTyVarsExBind(NEWExBind(_, _, vid, ty_opt, exbind_opt)) =
9496 ?unguardedTyVarsTy ty_opt + ?unguardedTyVarsExBind exbind_opt
9497 | unguardedTyVarsExBind(EQUALExBind(_, _, vid, _, longvid, exbind_opt)) =
9498 ?unguardedTyVarsExBind exbind_opt
9499
9500 and unguardedTyVarsAtPat(RECORDAtPat(_, patrow_opt)) =
9501 ?unguardedTyVarsPatRow patrow_opt
9502 | unguardedTyVarsAtPat(PARAtPat(_, pat)) =
9503 unguardedTyVarsPat pat
9504 | unguardedTyVarsAtPat _ = TyVarSet.empty
9505
9506 and unguardedTyVarsPatRow(WILDCARDPatRow(_)) = TyVarSet.empty
9507 | unguardedTyVarsPatRow(ROWPatRow(_, lab, pat, patrow_opt)) =
9508 unguardedTyVarsPat pat + ?unguardedTyVarsPatRow patrow_opt
9509
9510 and unguardedTyVarsPat(ATPATPat(_, atpat)) =
9511 unguardedTyVarsAtPat atpat
9512 | unguardedTyVarsPat(CONPat(_, _, longvid, atpat)) =
9513 unguardedTyVarsAtPat atpat
9514 | unguardedTyVarsPat(TYPEDPat(_, pat, ty)) =
9515 unguardedTyVarsPat pat + unguardedTyVarsTy ty
9516 | unguardedTyVarsPat(ASPat(_, _, vid, ty_opt, pat)) =
9517 ?unguardedTyVarsTy ty_opt + unguardedTyVarsPat pat
9518
9519 and unguardedTyVarsTy(TYVARTy(_, tyvar)) = TyVarSet.singleton tyvar
9520 | unguardedTyVarsTy(RECORDTy(_, tyrow_opt)) =
9521 ?unguardedTyVarsTyRow tyrow_opt
9522 | unguardedTyVarsTy(TYCONTy(_, tyseq, longtycon)) =
9523 unguardedTyVarsTyseq tyseq
9524 | unguardedTyVarsTy(ARROWTy(_, ty, ty')) =
9525 unguardedTyVarsTy ty + unguardedTyVarsTy ty'
9526 | unguardedTyVarsTy(PARTy(_, ty)) =
9527 unguardedTyVarsTy ty
9528
9529 and unguardedTyVarsTyRow(TyRow(_, lab, ty, tyrow_opt)) =
9530 unguardedTyVarsTy ty + ?unguardedTyVarsTyRow tyrow_opt
9531
9532 and unguardedTyVarsTyseq(Tyseq(_, tys)) =
9533 List.foldl (fn(ty,U) => unguardedTyVarsTy ty + U) TyVarSet.empty tys
9534
9535 end (* local *)
9536
9537
9538
9539 (* Check whether a pattern binds an identifier *)
9540
9541 local
9542 fun ? boundByX(NONE, vid) = false
9543 | ? boundByX(SOME x, vid) = boundByX(x, vid)
9544 in
9545
9546 fun boundByAtPat(WILDCARDAtPat(_), vid) = false
9547 | boundByAtPat(SCONAtPat(_, scon), vid) = false
9548 | boundByAtPat(LONGVIDAtPat(_, _, longvid), vid) =
9549 let
9550 val (strids,vid') = LongVId.explode longvid
9551 in
9552 List.null strids andalso vid = vid'
9553 end
9554 | boundByAtPat(RECORDAtPat(_, patrow_opt), vid) =
9555 ?boundByPatRow(patrow_opt, vid)
9556 | boundByAtPat(PARAtPat(_, pat), vid) = boundByPat(pat, vid)
9557
9558 and boundByPatRow(WILDCARDPatRow(_), vid) = false
9559 | boundByPatRow(ROWPatRow(_, lab, pat, patrow_opt), vid) =
9560 boundByPat(pat, vid) orelse ?boundByPatRow(patrow_opt, vid)
9561
9562 and boundByPat(ATPATPat(_, atpat), vid) = boundByAtPat(atpat, vid)
9563 | boundByPat(CONPat(_, _, longvid, atpat), vid) = boundByAtPat(atpat, vid)
9564 | boundByPat(TYPEDPat(_, pat, ty), vid) = boundByPat(pat, vid)
9565 | boundByPat(ASPat(_, _, vid', ty_opt, pat), vid) =
9566 vid = vid' orelse boundByPat(pat, vid)
9567
9568 end (* local *)
9569
9570
9571
9572 (* Non-expansive expressions [Section 4.7] *)
9573
9574 local
9575 fun ? isNonExpansiveX C NONE = true
9576 | ? isNonExpansiveX C (SOME x) = isNonExpansiveX C x
9577 in
9578
9579 fun isNonExpansiveAtExp C (SCONAtExp(_, scon)) = true
9580 | isNonExpansiveAtExp C (LONGVIDAtExp(_, _, longvid)) = true
9581 | isNonExpansiveAtExp C (RECORDAtExp(_, exprow_opt)) =
9582 ?isNonExpansiveExpRow C exprow_opt
9583 | isNonExpansiveAtExp C (PARAtExp(_, exp)) = isNonExpansiveExp C exp
9584 | isNonExpansiveAtExp C _ = false
9585
9586 and isNonExpansiveExpRow C (ExpRow(_, lab, exp, exprow_opt)) =
9587 isNonExpansiveExp C exp andalso ?isNonExpansiveExpRow C exprow_opt
9588
9589 and isNonExpansiveExp C (ATEXPExp(_, atexp)) = isNonExpansiveAtExp C atexp
9590 | isNonExpansiveExp C (APPExp(_, exp, atexp)) =
9591 isConExp C exp andalso isNonExpansiveAtExp C atexp
9592 | isNonExpansiveExp C (TYPEDExp(_, exp, ty)) = isNonExpansiveExp C exp
9593 | isNonExpansiveExp C (FNExp(_, match)) = true
9594 | isNonExpansiveExp C _ = false
9595
9596 and isConAtExp C (PARAtExp(_, exp)) = isConExp C exp
9597 | isConAtExp C (LONGVIDAtExp(_, _, longvid)) =
9598 LongVId.explode longvid <> ([],VId.fromString "ref") andalso
9599 (case Context.findLongVId(C, longvid)
9600 of SOME(_,is) => is=IdStatus.c orelse is=IdStatus.e
9601 | NONE => false
9602 )
9603 | isConAtExp C _ = false
9604
9605 and isConExp C (ATEXPExp(_, atexp)) = isConAtExp C atexp
9606 | isConExp C (TYPEDExp(_, ATEXPExp(_, atexp), ty)) = isConAtExp C atexp
9607 | isConExp C _ = false
9608
9609 end (* local *)
9610
9611
9612
9613 (* Closure of value environments [Section 4.8] *)
9614
9615 fun hasNonExpansiveRHS C (vid, PLAINValBind(I, pat, exp, valbind_opt)) =
9616 if boundByPat(pat, vid) then
9617 isNonExpansiveExp C exp
9618 else
9619 hasNonExpansiveRHS C (vid, valOf valbind_opt)
9620
9621 | hasNonExpansiveRHS C (vid, RECValBind _) =
9622 (* A rec valbind can only contain functions. *)
9623 true
9624
9625 fun Clos (C,valbind) VE =
9626 let
9627 val tyvarsC = Context.tyvars C
9628
9629 fun alphas(vid, tau) =
9630 if hasNonExpansiveRHS C (vid, valbind) then
9631 TyVarSet.listItems
9632 (TyVarSet.difference(Type.tyvars tau, tyvarsC))
9633 else
9634 []
9635 in
9636 VIdMap.mapi
9637 (fn(vid, ((_,tau),is)) => ((alphas(vid,tau),tau),is))
9638 VE
9639 end
9640
9641
9642 (* Inference rules [Section 4.10] *)
9643
9644
9645 (* Atomic Expressions *)
9646
9647 fun elabAtExp(C, SCONAtExp(I, scon)) =
9648 (* [Rule 1] *)
9649 typeSCon scon
9650
9651 | elabAtExp(C, LONGVIDAtExp(I, _, longvid)) =
9652 (* [Rule 2] *)
9653 let
9654 val (sigma,is) = case Context.findLongVId(C, longvid)
9655 of SOME valstr => valstr
9656 | NONE =>
9657 errorLongVId(I, "unknown identifier ",longvid)
9658 val tau = TypeScheme.instance sigma
9659 in
9660 tau
9661 end
9662
9663 | elabAtExp(C, RECORDAtExp(I, exprow_opt)) =
9664 (* [Rule 3] *)
9665 let
9666 val rho = case exprow_opt
9667 of NONE => Type.emptyRho
9668 | SOME exprow => elabExpRow(C, exprow)
9669 in
9670 Type.fromRowType rho
9671 end
9672
9673 | elabAtExp(C, LETAtExp(I, dec, exp)) =
9674 (* [Rule 4] *)
9675 let
9676 val E = elabDec(false, C, dec)
9677 val tau = elabExp(C oplusE E, exp)
9678 in
9679 if TyNameSet.isSubset(Type.tynames tau, Context.Tof C) then
9680 tau
9681 else
9682 error(I, "escaping local type name in let expression")
9683 end
9684
9685 | elabAtExp(C, PARAtExp(I, exp)) =
9686 (* [Rule 5] *)
9687 let
9688 val tau = elabExp(C, exp)
9689 in
9690 tau
9691 end
9692
9693
9694 (* Expression Rows *)
9695
9696 and elabExpRow(C, ExpRow(I, lab, exp, exprow_opt)) =
9697 (* [Rule 6] *)
9698 let
9699 val tau = elabExp(C, exp)
9700 val rho = case exprow_opt
9701 of NONE => Type.emptyRho
9702 | SOME exprow => elabExpRow(C, exprow)
9703 in
9704 if isSome(Type.findLab(rho, lab)) then
9705 (* Syntactic restriction [Section 2.9, 1st bullet] *)
9706 errorLab(I, "duplicate label ", lab)
9707 else
9708 Type.insertRho(rho, lab, tau)
9709 end
9710
9711
9712 (* Expressions *)
9713
9714 and elabExp(C, ATEXPExp(I, atexp)) =
9715 (* [Rule 7] *)
9716 let
9717 val tau = elabAtExp(C, atexp)
9718 in
9719 tau
9720 end
9721
9722 | elabExp(C, APPExp(I, exp, atexp)) =
9723 (* [Rule 8] *)
9724 let
9725 val tau1 = elabExp(C, exp)
9726 val tau' = elabAtExp(C, atexp)
9727 val tau = Type.invent()
9728 in
9729 Type.unify(tau1, Type.fromFunType(tau',tau))
9730 handle Type.Unify => error(I, "type mismatch on application")
9731 ; tau
9732 end
9733
9734 | elabExp(C, TYPEDExp(I, exp, ty)) =
9735 (* [Rule 9] *)
9736 let
9737 val tau1 = elabExp(C, exp)
9738 val tau = elabTy(C, ty)
9739 in
9740 Type.unify(tau1,tau)
9741 handle Type.Unify =>
9742 error(I, "expression does not match annotation")
9743 ; tau
9744 end
9745
9746 | elabExp(C, HANDLEExp(I, exp, match)) =
9747 (* [Rule 10] *)
9748 let
9749 val tau1 = elabExp(C, exp)
9750 val tau2 = elabMatch(C, match)
9751 in
9752 Type.unify(tau1,tau2)
9753 handle Type.Unify =>
9754 error(I, "type mismatch between expression and handler")
9755 ; tau1
9756 end
9757
9758 | elabExp(C, RAISEExp(I, exp)) =
9759 (* [Rule 11] *)
9760 let
9761 val tau1 = elabExp(C, exp)
9762 in
9763 Type.unify(tau1, InitialStaticEnv.tauExn)
9764 handle Type.Unify =>
9765 error(I, "raised expression is not an exception")
9766 ; Type.invent()
9767 end
9768
9769 | elabExp(C, FNExp(I, match)) =
9770 (* [Rule 12] *)
9771 let
9772 val tau = elabMatch(C, match)
9773 in
9774 (* Further restriction [Section 4.11, item 2] *)
9775 CheckPattern.checkMatch(Context.Eof C, match)
9776 ; tau
9777 end
9778
9779
9780 (* Matches *)
9781
9782 and elabMatch(C, Match(I, mrule, match_opt)) =
9783 (* [Rule 13] *)
9784 let
9785 val tau = elabMrule(C, mrule)
9786 in
9787 case match_opt
9788 of NONE => tau
9789 | SOME match =>
9790 let
9791 val tau2 = elabMatch(C, match)
9792 in
9793 Type.unify(tau, tau2)
9794 handle Type.Unify =>
9795 error(I, "type mismatch between different matches")
9796 ; tau
9797 end
9798 end
9799
9800
9801 (* Match rules *)
9802
9803 and elabMrule(C, Mrule(I, pat, exp)) =
9804 (* [Rule 14] *)
9805 let
9806 val (VE,tau) = elabPat(C, pat)
9807 val tau' = elabExp(C plusVE VE, exp)
9808 (* Side condition on type names is always ensured. *)
9809 in
9810 Type.fromFunType(tau,tau')
9811 end
9812
9813
9814 (* Declarations *)
9815
9816 and elabDec(toplevel, C, VALDec(I, tyvarseq, valbind)) =
9817 (* [Rule 15] *)
9818 let
9819 val U' = #1(tyvars(tyvarseq))
9820 (* Collect implicitly bound tyvars [Section 4.6] *)
9821 val U = TyVarSet.union(U',
9822 TyVarSet.difference(unguardedTyVarsValBind valbind,
9823 Context.Uof C))
9824 val VE = elabValBind(toplevel, C plusU U, valbind)
9825 val VE' = Clos(C,valbind) VE
9826 val _ = StaticEnv.defaultOverloaded VE'
9827 in
9828 if not(TyVarSet.isEmpty(
9829 TyVarSet.intersection(Context.Uof C, U))) then
9830 (* Syntactic restriction [Section 2.9, last bullet] *)
9831 error(I, "some type variables shadow previous ones")
9832 else if StaticEnv.containsFlexibleType VE' then
9833 (* Further restriction [Section 4.11, item 1] *)
9834 error(I, "unresolved flexible record type")
9835 else if TyVarSet.isEmpty(
9836 TyVarSet.intersection(U, StaticEnv.tyvarsVE VE')) then
9837 StaticEnv.fromVE VE'
9838 else
9839 error(I, "some explicit type variables cannot be generalised")
9840 end
9841
9842 | elabDec(toplevel, C, TYPEDec(I, typbind)) =
9843 (* [Rule 16] *)
9844 let
9845 val TE = elabTypBind(C, typbind)
9846 in
9847 StaticEnv.fromTE TE
9848 end
9849
9850 | elabDec(toplevel, C, DATATYPEDec(I, datbind)) =
9851 (* [Rule 17] *)
9852 let
9853 val TE1 = lhsDatBind datbind
9854 val (VE2,TE2) = elabDatBind(C oplusTE TE1, datbind)
9855 val (TE, VE) = StaticEnv.maximiseEquality(TE2,VE2)
9856 (* Side condition on type names is always ensured. *)
9857 in
9858 StaticEnv.fromVEandTE(VE,TE)
9859 end
9860
9861 | elabDec(toplevel, C, REPLICATIONDec(I, tycon, longtycon)) =
9862 (* [Rule 18] *)
9863 let
9864 val (theta,VE) = case Context.findLongTyCon(C, longtycon)
9865 of SOME tystr => tystr
9866 | NONE =>
9867 errorLongTyCon(I, "unknown type ", longtycon)
9868 val TE = TyConMap.singleton(tycon, (theta,VE))
9869 in
9870 StaticEnv.fromVEandTE(VE,TE)
9871 end
9872
9873 | elabDec(toplevel, C, ABSTYPEDec(I, datbind, dec)) =
9874 (* [Rule 19] *)
9875 let
9876 val TE1 = lhsDatBind datbind
9877 val (VE2,TE2) = elabDatBind(C oplusTE TE1, datbind)
9878 val (TE, VE) = StaticEnv.maximiseEquality(TE2,VE2)
9879 val E = elabDec(false, C oplusVEandTE (VE,TE), dec)
9880 (* Side condition on type names is always ensured. *)
9881 in
9882 StaticEnv.Abs(TE,E)
9883 end
9884
9885 | elabDec(toplevel, C, EXCEPTIONDec(I, exbind)) =
9886 (* [Rule 20] *)
9887 let
9888 val VE = elabExBind(C, exbind)
9889 in
9890 StaticEnv.fromVE VE
9891 end
9892
9893 | elabDec(toplevel, C, LOCALDec(I, dec1, dec2)) =
9894 (* [Rule 21] *)
9895 let
9896 val E1 = elabDec(false, C, dec1)
9897 val E2 = elabDec(false, C oplusE E1, dec2)
9898 in
9899 E2
9900 end
9901
9902 | elabDec(toplevel, C, OPENDec(I, longstrids)) =
9903 (* [Rule 22] *)
9904 let
9905 val Es =
9906 List.map
9907 (fn longstrid =>
9908 case Context.findLongStrId(C, longstrid)
9909 of SOME(StaticEnv.Str E) => E
9910 | NONE =>
9911 errorLongStrId(I, "unknown structure ", longstrid))
9912 longstrids
9913 in
9914 List.foldl StaticEnv.plus StaticEnv.empty Es
9915 end
9916
9917 | elabDec(toplevel, C, EMPTYDec(I)) =
9918 (* [Rule 23] *)
9919 StaticEnv.empty
9920
9921 | elabDec(toplevel, C, SEQDec(I, dec1, dec2)) =
9922 (* [Rule 24] *)
9923 let
9924 val E1 = elabDec(toplevel, C, dec1)
9925 val E2 = elabDec(toplevel, C oplusE E1, dec2)
9926 in
9927 StaticEnv.plus(E1, E2)
9928 end
9929
9930
9931 (* Value Bindings *)
9932
9933 and elabValBind(toplevel, C, PLAINValBind(I, pat, exp, valbind_opt)) =
9934 (* [Rule 25] *)
9935 let
9936 val (VE,tau1) = elabPat(C, pat)
9937 val tau2 = elabExp(C, exp)
9938 val VE' = case valbind_opt
9939 of NONE => VIdMap.empty
9940 | SOME valbind => elabValBind(toplevel, C, valbind)
9941 in
9942 Type.unify(tau1,tau2)
9943 handle Type.Unify =>
9944 error(I, "type mismatch between pattern and expression")
9945 ; if toplevel then () else
9946 (* Further restriction [Section 4.11, item 3] *)
9947 CheckPattern.checkPat(Context.Eof C, pat)
9948 ; VIdMap.unionWithi
9949 (fn(vid,_,_) =>
9950 (* Syntactic restriction [Section 2.9, 2nd bullet] *)
9951 errorVId(I, "duplicate variable ", vid))
9952 (VE,VE')
9953 end
9954
9955 | elabValBind(toplevel, C, RECValBind(I, valbind)) =
9956 (* [Rule 26] *)
9957 let
9958 val VE1 = lhsRecValBind valbind
9959 val VE = elabValBind(toplevel, C plusVE VE1, valbind)
9960 (* Side condition on type names is always ensured. *)
9961 in
9962 VE
9963 end
9964
9965
9966 (* Type Bindings *)
9967
9968 and elabTypBind(C, TypBind(I, tyvarseq, tycon, ty, typbind_opt)) =
9969 (* [Rule 27] *)
9970 let
9971 val (U,alphas) = tyvars tyvarseq
9972 val tau = elabTy(C, ty)
9973 val TE = case typbind_opt
9974 of NONE => TyConMap.empty
9975 | SOME typbind => elabTypBind(C, typbind)
9976 in
9977 if not(TyVarSet.isSubset(Type.tyvars tau, U)) then
9978 (* Syntactic restriction (missing in the Definition!) *)
9979 error(I, "free type variables in type binding")
9980 else if isSome(TyConMap.find(TE, tycon)) then
9981 (* Syntactic restriction [Section 2.9, 2nd bullet] *)
9982 errorTyCon(I, "duplicate type constructor ", tycon)
9983 else
9984 TyConMap.insert(TE, tycon, ((alphas,tau),VIdMap.empty))
9985 end
9986
9987
9988 (* Datatype Bindings *)
9989
9990 and elabDatBind(C, DatBind(I, tyvarseq, tycon, conbind, datbind_opt)) =
9991 (* [Rule 28, part 2] *)
9992 let
9993 val (U,alphas) = tyvars tyvarseq
9994 val (alphas,tau) = case Context.findTyCon(C, tycon)
9995 of SOME(theta,VE) => theta
9996 | NONE => (* lhsDatBind inserted it! *)
9997 raise Fail "ElabCore.elabDatBind: \
9998 \tycon not pre-bound"
9999 val VE = elabConBind(C,tau, conbind)
10000 val(VE',TE') = case datbind_opt
10001 of NONE => ( VIdMap.empty, TyConMap.empty )
10002 | SOME datbind => elabDatBind(C, datbind)
10003 (* Side condition on t is always true. *)
10004 val ClosVE = if TyVarSet.isSubset(StaticEnv.tyvarsVE VE, U) then
10005 StaticEnv.Clos VE
10006 else
10007 (* Syntactic restriction (missing in Definition!)*)
10008 error(I, "free type variables in datatype binding")
10009 in
10010 if isSome(TyConMap.find(TE', tycon)) then
10011 (* Syntactic restriction [Section 2.9, 2nd bullet] *)
10012 errorTyCon(I, "duplicate type constructor ", tycon)
10013 else
10014 ( VIdMap.unionWithi (fn(vid,_,_) =>
10015 (* Syntactic restriction [Section 2.9, 2nd bullet] *)
10016 errorVId(I, "duplicate data cnstructor ", vid)) (ClosVE,VE')
10017 , TyConMap.insert(TE', tycon, ((alphas,tau),ClosVE))
10018 )
10019 end
10020
10021
10022 (* Constructor Bindings *)
10023
10024 and elabConBind(C,tau, ConBind(I, _, vid, ty_opt, conbind_opt)) =
10025 (* [Rule 29] *)
10026 let
10027 val tau1 = case ty_opt
10028 of NONE => tau
10029 | SOME ty =>
10030 let
10031 val tau' = elabTy(C, ty)
10032 in
10033 Type.fromFunType(tau',tau)
10034 end
10035 val VE = case conbind_opt
10036 of NONE => VIdMap.empty
10037 | SOME conbind => elabConBind(C,tau, conbind)
10038 in
10039 if isSome(VIdMap.find(VE, vid)) then
10040 (* Syntactic restriction [Section 2.9, 2nd bullet] *)
10041 errorVId(I, "duplicate data constructor ", vid)
10042 else if not(validConBindVId vid) then
10043 (* Syntactic restriction [Section 2.9, 5th bullet] *)
10044 errorVId(I, "illegal rebinding of identifier ", vid)
10045 else
10046 VIdMap.insert(VE, vid, (([],tau1),IdStatus.c))
10047 end
10048
10049
10050 (* Exception Bindings *)
10051
10052 and elabExBind(C, NEWExBind(I, _, vid, ty_opt, exbind_opt)) =
10053 (* [Rule 30] *)
10054 let
10055 val tau1 = case ty_opt
10056 of NONE => InitialStaticEnv.tauExn
10057 | SOME ty =>
10058 let
10059 val tau = elabTy(C, ty)
10060 in
10061 Type.fromFunType(tau, InitialStaticEnv.tauExn)
10062 end
10063 val VE = case exbind_opt
10064 of NONE => VIdMap.empty
10065 | SOME exbind => elabExBind(C, exbind)
10066 in
10067 if isSome(VIdMap.find(VE, vid)) then
10068 (* Syntactic restriction [Section 2.9, 2nd bullet] *)
10069 errorVId(I, "duplicate exception constructor ", vid)
10070 else if not(validConBindVId vid) then
10071 (* Syntactic restriction [Section 2.9, 5th bullet] *)
10072 errorVId(I, "illegal rebinding of identifier ", vid)
10073 else
10074 VIdMap.insert(VE, vid, (([],tau1),IdStatus.e))
10075 end
10076
10077 | elabExBind(C, EQUALExBind(I, _, vid, _, longvid, exbind_opt)) =
10078 (* [Rule 31] *)
10079 let
10080 val tau = case Context.findLongVId(C, longvid)
10081 of SOME(([],tau),IdStatus.e) => tau
10082 | SOME _ =>
10083 errorLongVId(I, "non-exception identifier ", longvid)
10084 | NONE =>
10085 errorLongVId(I, "unknown identifier ", longvid)
10086 val VE = case exbind_opt
10087 of NONE => VIdMap.empty
10088 | SOME exbind => elabExBind(C, exbind)
10089 in
10090 if isSome(VIdMap.find(VE, vid)) then
10091 (* Syntactic restriction [Section 2.9, 2nd bullet] *)
10092 errorVId(I, "duplicate exception constructor ", vid)
10093 else
10094 VIdMap.insert(VE, vid, (([],tau),IdStatus.e))
10095 end
10096
10097
10098 (* Atomic Patterns *)
10099
10100 and elabAtPat(C, WILDCARDAtPat(I)) =
10101 (* [Rule 32] *)
10102 ( VIdMap.empty, Type.invent() )
10103
10104 | elabAtPat(C, SCONAtPat(I, scon)) =
10105 (* [Rule 33] *)
10106 (case scon
10107 of SCon.REAL _ =>
10108 (* Syntactic restriction [Section 2.9, 6th bullet] *)
10109 error(I, "real constant in pattern")
10110 | _ =>
10111 ( VIdMap.empty, typeSCon scon )
10112 )
10113
10114 | elabAtPat(C, LONGVIDAtPat(I, _, longvid)) =
10115 (* [Rule 34 and 35] *)
10116 let
10117 val (strids,vid) = LongVId.explode longvid
10118 in
10119 if List.null strids andalso
10120 ( case Context.findVId(C, vid)
10121 of NONE => true
10122 | SOME(sigma,is) => is = IdStatus.v ) then
10123 (* [Rule 34] *)
10124 let
10125 val tau = Type.invent()
10126 in
10127 ( VIdMap.singleton(vid, (([],tau),IdStatus.v))
10128 , tau )
10129 end
10130 else
10131 (* [Rule 35] *)
10132 let
10133 val (sigma,is) = case Context.findLongVId(C, longvid)
10134 of SOME valstr => valstr
10135 | NONE =>
10136 errorLongVId(I,"unknown constructor ",
10137 longvid)
10138 val tau = TypeScheme.instance sigma
10139 (* Note that tau will always be a ConsType. *)
10140 in
10141 if is <> IdStatus.v then
10142 ( VIdMap.empty, tau )
10143 else
10144 error(I, "non-constructor long identifier in pattern")
10145 end
10146 end
10147
10148 | elabAtPat(C, RECORDAtPat(I, patrow_opt)) =
10149 (* [Rule 36] *)
10150 let
10151 val (VE,rho) = case patrow_opt
10152 of NONE => ( VIdMap.empty, Type.emptyRho )
10153 | SOME patrow => elabPatRow(C, patrow)
10154 in
10155 (VE, Type.fromRowType rho)
10156 end
10157
10158 | elabAtPat(C, PARAtPat(I, pat)) =
10159 (* [Rule 37] *)
10160 let
10161 val (VE,tau) = elabPat(C, pat)
10162 in
10163 (VE,tau)
10164 end
10165
10166
10167 (* Pattern Rows *)
10168
10169 and elabPatRow(C, WILDCARDPatRow(I)) =
10170 (* [Rule 38] *)
10171 ( VIdMap.empty, Type.inventRho() )
10172
10173 | elabPatRow(C, ROWPatRow(I, lab, pat, patrow_opt)) =
10174 (* [Rule 39] *)
10175 let
10176 val (VE,tau) = elabPat(C, pat)
10177 val (VE',rho) = case patrow_opt
10178 of NONE => ( VIdMap.empty, Type.emptyRho )
10179 | SOME patrow => elabPatRow(C, patrow)
10180 in
10181 if isSome(Type.findLab(rho, lab)) then
10182 (* Syntactic restriction [Section 2.9, 1st bullet] *)
10183 errorLab(I, "duplicate label ", lab)
10184 else
10185 ( VIdMap.unionWithi (fn(vid,_,_) =>
10186 errorVId(I, "duplicate variable ", vid)) (VE,VE')
10187 , Type.insertRho(rho, lab, tau)
10188 )
10189 end
10190
10191
10192 (* Patterns *)
10193
10194 and elabPat(C, ATPATPat(I, atpat)) =
10195 (* [Rule 40] *)
10196 let
10197 val (VE,tau) = elabAtPat(C, atpat)
10198 in
10199 (VE,tau)
10200 end
10201
10202 | elabPat(C, CONPat(I, _, longvid, atpat)) =
10203 (* [Rule 41] *)
10204 let
10205 val (sigma,is) = case Context.findLongVId(C, longvid)
10206 of SOME valstr => valstr
10207 | NONE =>
10208 errorLongVId(I, "unknown constructor ", longvid)
10209 val _ = if is <> IdStatus.v then () else
10210 errorLongVId(I, "non-constructor ", longvid)
10211 val (tau',tau) = case !(TypeScheme.instance sigma)
10212 of Type.FunType(tau',tau) => (tau', tau)
10213 | _ =>
10214 errorLongVId(I,"misplaced nullary constructor ",
10215 longvid)
10216 val (VE,tau'2) = elabAtPat(C, atpat)
10217 in
10218 Type.unify(tau',tau'2)
10219 handle Type.Unify =>
10220 error(I, "type mismatch in constructor pattern")
10221 ; (VE,tau)
10222 end
10223
10224 | elabPat(C, TYPEDPat(I, pat, ty)) =
10225 (* [Rule 42] *)
10226 let
10227 val (VE,tau1) = elabPat(C, pat)
10228 val tau = elabTy(C, ty)
10229 in
10230 Type.unify(tau1,tau)
10231 handle Type.Unify => error(I, "pattern does not match annotation")
10232 ; (VE,tau)
10233 end
10234
10235 | elabPat(C, ASPat(I, _, vid, ty_opt, pat)) =
10236 (* [Rule 43] *)
10237 let
10238 val (VE1,tau1) = elabPat(C, pat)
10239 val (VE, tau) =
10240 case ty_opt
10241 of NONE => (VE1,tau1)
10242 | SOME ty =>
10243 let
10244 val tau = elabTy(C, ty)
10245 in
10246 Type.unify(tau1,tau)
10247 handle Type.Unify =>
10248 error(I, "pattern does not match annotation")
10249 ; (VE1,tau)
10250 end
10251 in
10252 if not( case Context.findVId(C, vid)
10253 of NONE => true
10254 | SOME(sigma,is) => is = IdStatus.v ) then
10255 errorVId(I, "misplaced constructor ", vid)
10256 else if isSome(VIdMap.find(VE, vid)) then
10257 errorVId(I, "duplicate variable ", vid)
10258 else
10259 ( VIdMap.insert(VE, vid, (([],tau),IdStatus.v)), tau )
10260 end
10261
10262
10263 (* Type Expressions *)
10264
10265 and elabTy(C, ty) = Type.normalise(elabTy'(C, ty))
10266
10267 and elabTy'(C, TYVARTy(I, tyvar)) =
10268 (* [Rule 44] *)
10269 let
10270 val alpha = tyvar
10271 in
10272 Type.fromTyVar alpha
10273 end
10274
10275 | elabTy'(C, RECORDTy(I, tyrow_opt)) =
10276 (* [Rule 45] *)
10277 let
10278 val rho = case tyrow_opt
10279 of NONE => Type.emptyRho
10280 | SOME tyrow => elabTyRow'(C, tyrow)
10281 in
10282 Type.fromRowType rho
10283 end
10284
10285 | elabTy'(C, TYCONTy(I, tyseq, longtycon)) =
10286 (* [Rule 46] *)
10287 let
10288 val Tyseq(I',tys) = tyseq
10289 val k = List.length tys
10290 val taus = List.map (fn ty => elabTy'(C, ty)) tys
10291 val (theta,VE) =
10292 case Context.findLongTyCon(C, longtycon)
10293 of SOME tystr => tystr
10294 | NONE =>
10295 errorLongTyCon(I, "unknown type constructor ", longtycon)
10296 in
10297 TypeFcn.apply(taus, theta)
10298 handle TypeFcn.Apply =>
10299 errorLongTyCon(I, "arity mismatch at type application ",
10300 longtycon)
10301 end
10302
10303 | elabTy'(C, ARROWTy(I, ty, ty')) =
10304 (* [Rule 47] *)
10305 let
10306 val tau = elabTy'(C, ty)
10307 val tau' = elabTy'(C, ty')
10308 in
10309 Type.fromFunType(tau,tau')
10310 end
10311
10312 | elabTy'(C, PARTy(I, ty)) =
10313 (* [Rule 48] *)
10314 let
10315 val tau = elabTy'(C, ty)
10316 in
10317 tau
10318 end
10319
10320
10321 (* Type-expression Rows *)
10322
10323 and elabTyRow'(C, TyRow(I, lab, ty, tyrow_opt)) =
10324 (* [Rule 49] *)
10325 let
10326 val tau = elabTy'(C, ty)
10327 val rho = case tyrow_opt
10328 of NONE => Type.emptyRho
10329 | SOME tyrow => elabTyRow'(C, tyrow)
10330 in
10331 if isSome(Type.findLab(rho, lab)) then
10332 (* Syntactic restriction [Section 2.9, 1st bullet] *)
10333 errorLab(I, "duplicate label ", lab)
10334 else
10335 Type.insertRho(rho, lab, tau)
10336 end
10337
10338
10339
10340 (* Build tentative VE from LHSs of recursive valbind *)
10341
10342 and lhsRecValBind(PLAINValBind(I, pat, exp, valbind_opt)) =
10343 let
10344 val VE = lhsRecValBindPat pat
10345 val VE' = case valbind_opt
10346 of NONE => VIdMap.empty
10347 | SOME valbind => lhsRecValBind valbind
10348 val _ = case exp
10349 of FNExp _ => ()
10350 | _ =>
10351 (* Syntactic restriction [Section 2.9, 4th bullet] *)
10352 error(I, "illegal expression within recursive \
10353 \value binding")
10354 in
10355 VIdMap.unionWithi
10356 (fn(vid,_,_) =>
10357 (* Syntactic restriction [Section 2.9, 2nd bullet] *)
10358 errorVId(I, "duplicate variable ", vid)) (VE,VE')
10359 end
10360
10361 | lhsRecValBind(RECValBind(I, valbind)) =
10362 lhsRecValBind valbind
10363
10364 and lhsRecValBindPat(ATPATPat(I, atpat)) =
10365 lhsRecValBindAtPat atpat
10366
10367 | lhsRecValBindPat(CONPat(I, _, longvid, atpat)) =
10368 lhsRecValBindAtPat atpat
10369
10370 | lhsRecValBindPat(TYPEDPat(I, pat, ty)) =
10371 lhsRecValBindPat pat
10372
10373 | lhsRecValBindPat(ASPat(I, _, vid, ty_opt, pat)) =
10374 let
10375 val VE = lhsRecValBindPat pat
10376 in
10377 if isSome(VIdMap.find(VE, vid)) then
10378 (* Syntactic restriction [Section 2.9, 2nd bullet] *)
10379 errorVId(I, "duplicate variable ", vid)
10380 else if not(validBindVId vid) then
10381 (* Syntactic restriction [Section 2.9, 5th bullet] *)
10382 errorVId(I, "illegal rebinding of identifier ", vid)
10383 else
10384 VIdMap.insert(VE, vid, (([],Type.invent()), IdStatus.v))
10385 end
10386
10387 and lhsRecValBindAtPat(WILDCARDAtPat(I)) =
10388 VIdMap.empty
10389
10390 | lhsRecValBindAtPat(SCONAtPat(I, scon)) =
10391 VIdMap.empty
10392
10393 | lhsRecValBindAtPat(LONGVIDAtPat(I, _, longvid)) =
10394 (case LongVId.explode longvid
10395 of ([], vid) =>
10396 if not(validBindVId vid) then
10397 (* Syntactic restriction [Section 2.9, 5th bullet] *)
10398 errorVId(I, "illegal rebinding of identifier ", vid)
10399 else
10400 VIdMap.singleton(vid, (([],Type.invent()),IdStatus.v))
10401
10402 | _ => VIdMap.empty
10403 )
10404
10405 | lhsRecValBindAtPat(RECORDAtPat(I, patrow_opt)) =
10406 (case patrow_opt
10407 of NONE => VIdMap.empty
10408 | SOME patrow => lhsRecValBindPatRow patrow
10409 )
10410
10411 | lhsRecValBindAtPat(PARAtPat(I, pat)) =
10412 lhsRecValBindPat pat
10413
10414 and lhsRecValBindPatRow(WILDCARDPatRow(I)) =
10415 VIdMap.empty
10416
10417 | lhsRecValBindPatRow(ROWPatRow(I, lab, pat, patrow_opt)) =
10418 let
10419 val VE = lhsRecValBindPat pat
10420 in
10421 case patrow_opt
10422 of NONE => VE
10423 | SOME patrow =>
10424 let
10425 val VE' = lhsRecValBindPatRow patrow
10426 in
10427 VIdMap.unionWithi (fn(vid,_,_) =>
10428 (* Syntactic restriction [Section 2.9, 2nd bullet] *)
10429 errorVId(I, "duplicate variable ", vid)) (VE,VE')
10430 end
10431 end
10432
10433
10434
10435 (* Build tentative TE from LHSs of datbind *)
10436
10437 and lhsDatBind(DatBind(I, tyvarseq, tycon, conbind, datbind_opt)) =
10438 (* [Rule 28, part 1] *)
10439 let
10440 val (U,alphas) = tyvars tyvarseq
10441 val k = List.length alphas
10442 val span = lhsConBind conbind
10443 val t = TyName.tyname(tycon, k, TyName.EQ, span)
10444 val tau = Type.fromConsType(List.map Type.fromTyVar alphas,t)
10445 val TE' = case datbind_opt
10446 of NONE => TyConMap.empty
10447 | SOME datbind => lhsDatBind datbind
10448 in
10449 if isSome(TyConMap.find(TE', tycon)) then
10450 (* Syntactic restriction [Section 2.9, 2nd bullet] *)
10451 errorTyCon(I, "duplicate type constructor ", tycon)
10452 else
10453 TyConMap.insert(TE', tycon, ((alphas,tau), VIdMap.empty))
10454 end
10455
10456 and lhsConBind(ConBind(I, _, vid, ty_opt, conbind_opt)) =
10457 case conbind_opt
10458 of NONE => 1
10459 | SOME conbind => 1 + lhsConBind conbind
10460
10461 end
10462(* stop of ElabCore.sml *)
10463(* start of ELAB_MODULE.sml *)
10464(*
10465 * Standard ML modules elaboration
10466 *
10467 * Definition, sections 5.7 and 3.5
10468 *
10469 * Note:
10470 * Elaboration also checks the syntactic restrictions [Section 3.5].
10471 *)
10472
10473signature ELAB_MODULE =
10474 sig
10475
10476 (* Import types *)
10477
10478 type TopDec = GrammarModule.TopDec
10479 type Basis = StaticBasis.Basis
10480
10481
10482 (* Export *)
10483
10484 val elabTopDec: Basis * TopDec -> Basis
10485
10486 end
10487(* stop of ELAB_MODULE.sml *)
10488(* start of ElabModule.sml *)
10489(*
10490 * Standard ML modules elaboration
10491 *
10492 * Definition, sections 5.7 and 3.5
10493 *
10494 * Notes:
10495 * - Elaboration also checks the syntactic restrictions [Section 3.5].
10496 * - To implement the 3rd restriction in 4.11 some elab functions are
10497 * passed an additional boolean argument to recognise being on the toplevel.
10498 *)
10499
10500structure ElabModule :> ELAB_MODULE =
10501 struct
10502
10503 (* Import *)
10504
10505 type TopDec = GrammarModule.TopDec
10506 type Basis = StaticBasis.Basis
10507
10508
10509 open GrammarModule
10510
10511
10512 (* Helpers for error messages *)
10513
10514 val error = Error.error
10515
10516 fun errorVId (I, s, vid) = error(I, s ^ VId.toString vid)
10517 fun errorTyCon(I, s, tycon) = error(I, s ^ TyCon.toString tycon)
10518 fun errorStrId(I, s, strid) = error(I, s ^ StrId.toString strid)
10519 fun errorSigId(I, s, sigid) = error(I, s ^ SigId.toString sigid)
10520 fun errorFunId(I, s, funid) = error(I, s ^ FunId.toString funid)
10521
10522 fun errorLongTyCon(I, s, longtycon) =
10523 error(I, s ^ LongTyCon.toString longtycon)
10524 fun errorLongStrId(I, s, longstrid) =
10525 error(I, s ^ LongStrId.toString longstrid)
10526
10527
10528 (* Helpers for basis modification *)
10529
10530 val plus = StaticBasis.plus
10531 val plusT = StaticBasis.plusT
10532 val oplusSE = StaticBasis.oplusSE
10533 val oplusG = StaticBasis.oplusG
10534 val oplusF = StaticBasis.oplusF
10535 val oplusE = StaticBasis.oplusE
10536
10537 infix plus plusT oplusG oplusF oplusE oplusSE
10538
10539
10540
10541 (* Inference rules [Section 5.7] *)
10542
10543
10544 (* Structure Expressions *)
10545
10546 fun elabStrExp(B, STRUCTStrExp(I, strdec)) =
10547 (* [Rule 50] *)
10548 let
10549 val E = elabStrDec(false, B, strdec)
10550 in
10551 E
10552 end
10553
10554 | elabStrExp(B, LONGSTRIDStrExp(I, longstrid)) =
10555 (* [Rule 51] *)
10556 let
10557 val E = case StaticBasis.findLongStrId(B, longstrid)
10558 of SOME(StaticEnv.Str E) => E
10559 | NONE =>
10560 errorLongStrId(I, "unknown structure ", longstrid)
10561 in
10562 E
10563 end
10564
10565 | elabStrExp(B, TRANSStrExp(I, strexp, sigexp)) =
10566 (* [Rule 52] *)
10567 let
10568 val E = elabStrExp(B, strexp)
10569 val Sigma = elabSigExp(B, sigexp)
10570 val (E',_) = Sig.match(E, Sigma)
10571 handle Sig.Match =>
10572 error(I, "structure does not match constraint")
10573 in
10574 E'
10575 end
10576
10577 | elabStrExp(B, OPAQStrExp(I, strexp, sigexp)) =
10578 (* [Rule 53] *)
10579 let
10580 val E = elabStrExp(B, strexp)
10581 val (T',E') = Sig.rename(elabSigExp(B, sigexp))
10582 val (E'',_) = Sig.match(E, (T',E'))
10583 handle Sig.Match =>
10584 error(I, "structure does not match constraint")
10585 (* Renaming ensures side condition on T' *)
10586 in
10587 E'
10588 end
10589
10590 | elabStrExp(B, APPStrExp(I, funid, strexp)) =
10591 (* [Rule 54] *)
10592 let
10593 val E = elabStrExp(B, strexp)
10594 val (T1'',(E1'',(T1',E1'))) =
10595 case StaticBasis.findFunId(B, funid)
10596 of SOME Phi => Phi
10597 | NONE => errorFunId(I, "unknown functor ", funid)
10598 val (E'',phi) = Sig.match(E, (T1'',E1''))
10599 handle Sig.Match =>
10600 error(I, "structure does not match constraint")
10601 val (T',E') = Sig.rename (T1', StaticEnv.realise phi E1')
10602 (* Renaming ensures side condition on T' *)
10603 in
10604 E'
10605 end
10606
10607 | elabStrExp(B, LETStrExp(I, strdec, strexp)) =
10608 (* [Rule 55] *)
10609 let
10610 val E1 = elabStrDec(false, B, strdec)
10611 val E2 = elabStrExp(B oplusE E1, strexp)
10612 in
10613 E2
10614 end
10615
10616
10617 (* Structure-level Declarations *)
10618
10619 and elabStrDec(toplevel, B, DECStrDec(I, dec)) =
10620 (* [Rule 56] *)
10621 let
10622 val E = ElabCore.elabDec(toplevel, StaticBasis.Cof B, dec)
10623 in
10624 E
10625 end
10626
10627 | elabStrDec(toplevel, B, STRUCTUREStrDec(I, strbind)) =
10628 (* [Rule 57] *)
10629 let
10630 val SE = elabStrBind(B, strbind)
10631 in
10632 StaticEnv.fromSE SE
10633 end
10634
10635 | elabStrDec(toplevel, B, LOCALStrDec(I, strdec1, strdec2)) =
10636 (* [Rule 58] *)
10637 let
10638 val E1 = elabStrDec(false, B, strdec1)
10639 val E2 = elabStrDec(false, B oplusE E1, strdec2)
10640 in
10641 E2
10642 end
10643
10644 | elabStrDec(toplevel, B, EMPTYStrDec(I)) =
10645 (* [Rule 59] *)
10646 StaticEnv.empty
10647
10648 | elabStrDec(toplevel, B, SEQStrDec(I, strdec1, strdec2)) =
10649 (* [Rule 60] *)
10650 let
10651 val E1 = elabStrDec(toplevel, B, strdec1)
10652 val E2 = elabStrDec(toplevel, B oplusE E1, strdec2)
10653 in
10654 StaticEnv.plus(E1,E2)
10655 end
10656
10657
10658 (* Structure Bindings *)
10659
10660 and elabStrBind(B, StrBind(I, strid, strexp, strbind_opt)) =
10661 (* [Rule 61] *)
10662 let
10663 val E = elabStrExp(B, strexp)
10664 val SE = case strbind_opt
10665 of NONE => StrIdMap.empty
10666 | SOME strbind =>
10667 elabStrBind(B plusT StaticEnv.tynames E, strbind)
10668 in
10669 if isSome(StrIdMap.find(SE, strid)) then
10670 (* Syntactic restriction [Section 3.5, 1st bullet] *)
10671 errorStrId(I, "duplicate structure identifier ", strid)
10672 else
10673 StrIdMap.insert(SE, strid, StaticEnv.Str E)
10674 end
10675
10676
10677 (* Signature Expressions *)
10678
10679 and elabSigExpE(B, SIGSigExp(I, spec)) =
10680 (* [Rule 62] *)
10681 let
10682 val E = elabSpec(B, spec)
10683 in
10684 E
10685 end
10686
10687 | elabSigExpE(B, SIGIDSigExp(I, sigid)) =
10688 (* [Rule 63] *)
10689 let
10690 val (T,E) = case StaticBasis.findSigId(B, sigid)
10691 of SOME Sigma => Sig.rename Sigma
10692 | NONE => errorSigId(I, "unknown signature ",sigid)
10693 in
10694 E
10695 end
10696
10697 | elabSigExpE(B, WHERETYPESigExp(I, sigexp, tyvarseq, longtycon, ty)) =
10698 (* [Rule 64] *)
10699 let
10700 val E = elabSigExpE(B, sigexp)
10701 val alphas = #2(ElabCore.tyvars tyvarseq)
10702 val tau = ElabCore.elabTy(StaticBasis.Cof B, ty)
10703 val t = case StaticEnv.findLongTyCon(E,longtycon)
10704 of NONE =>
10705 errorLongTyCon(I, "unknown type ", longtycon)
10706 | SOME(theta,VE) =>
10707 case TypeFcn.toTyName theta
10708 of NONE =>
10709 errorLongTyCon(I, "non-flexible type ", longtycon)
10710 | SOME t => t
10711 val _ = if not(TyNameSet.member(StaticBasis.Tof B, t)) then ()
10712 else errorLongTyCon(I, "rigid type ", longtycon)
10713 val phi = TyNameMap.singleton(t, (alphas,tau))
10714 val _ = if TyName.equality t = TyName.NOEQ
10715 orelse TypeFcn.admitsEquality (alphas,tau) then () else
10716 error(I, "type realisation does not respect equality")
10717 val E' = StaticEnv.realise phi E
10718 val _ = if StaticEnv.isWellFormed E' then () else
10719 error(I, "type realisation does not respect datatype")
10720 in
10721 E'
10722 end
10723
10724 and elabSigExp(B, sigexp) =
10725 (* [Rule 65] *)
10726 let
10727 val E = elabSigExpE(B, sigexp)
10728 val T = TyNameSet.difference(StaticEnv.tynames E, StaticBasis.Tof B)
10729 in
10730 (T,E)
10731 end
10732
10733
10734 (* Signature Declarations *)
10735
10736 and elabSigDec(B, SigDec(I, sigbind)) =
10737 (* [Rule 66] *)
10738 let
10739 val G = elabSigBind(B, sigbind)
10740 in
10741 G
10742 end
10743
10744
10745 (* Signature Bindings *)
10746
10747 and elabSigBind(B, SigBind(I, sigid, sigexp, sigbind_opt)) =
10748 (* [Rule 67] *)
10749 let
10750 val Sigma = elabSigExp(B, sigexp)
10751 val G = case sigbind_opt
10752 of NONE => SigIdMap.empty
10753 | SOME sigbind => elabSigBind(B, sigbind)
10754 in
10755 if isSome(SigIdMap.find(G, sigid)) then
10756 (* Syntactic restriction [Section 3.5, 1st bullet] *)
10757 errorSigId(I, "duplicate signature identifier ", sigid)
10758 else
10759 SigIdMap.insert(G, sigid, Sigma)
10760 end
10761
10762
10763 (* Specifications *)
10764
10765 and elabSpec(B, VALSpec(I, valdesc)) =
10766 (* [Rule 68] *)
10767 let
10768 val VE = elabValDesc(StaticBasis.Cof B, valdesc)
10769 in
10770 StaticEnv.fromVE(StaticEnv.Clos VE)
10771 end
10772
10773 | elabSpec(B, TYPESpec(I, typdesc)) =
10774 (* [Rule 69] *)
10775 let
10776 val TE = elabTypDesc(StaticBasis.Cof B, typdesc)
10777 (* Side condition on type names is always ensured. *)
10778 in
10779 StaticEnv.fromTE TE
10780 end
10781
10782 | elabSpec(B, EQTYPESpec(I, typdesc)) =
10783 (* [Rule 70] *)
10784 let
10785 val TE = elabTypDesc(StaticBasis.Cof B, typdesc)
10786 val _ = StaticEnv.makeEquality TE
10787 in
10788 StaticEnv.fromTE TE
10789 end
10790
10791 | elabSpec(B, DATATYPESpec(I, datdesc)) =
10792 (* [Rule 71] *)
10793 let
10794 val TE1 = lhsDatDesc datdesc
10795 val (VE2,TE2) = elabDatDesc(Context.oplusTE(StaticBasis.Cof B,TE1),
10796 datdesc)
10797 val (TE, VE) = StaticEnv.maximiseEquality(TE2,VE2)
10798 (* Side condition on type names is always ensured. *)
10799 in
10800 StaticEnv.fromVEandTE(VE,TE)
10801 end
10802
10803 | elabSpec(B, REPLICATIONSpec(I, tycon, longtycon)) =
10804 (* [Rule 72] *)
10805 let
10806 val (theta,VE) = case StaticBasis.findLongTyCon(B, longtycon)
10807 of SOME tystr => tystr
10808 | NONE =>
10809 errorLongTyCon(I, "unknown type ", longtycon)
10810 val TE = TyConMap.singleton(tycon, (theta,VE))
10811 in
10812 StaticEnv.fromVEandTE(VE,TE)
10813 end
10814
10815 | elabSpec(B, EXCEPTIONSpec(I, exdesc)) =
10816 (* [Rule 73] *)
10817 let
10818 val VE = elabExDesc(StaticBasis.Cof B, exdesc)
10819 in
10820 StaticEnv.fromVE VE
10821 end
10822
10823 | elabSpec(B, STRUCTURESpec(I, strdesc)) =
10824 (* [Rule 74] *)
10825 let
10826 val SE = elabStrDesc(B, strdesc)
10827 in
10828 StaticEnv.fromSE SE
10829 end
10830
10831 | elabSpec(B, INCLUDESpec(I, sigexp)) =
10832 (* [Rule 75] *)
10833 let
10834 val E = elabSigExpE(B, sigexp)
10835 in
10836 E
10837 end
10838
10839 | elabSpec(B, EMPTYSpec(I)) =
10840 (* [Rule 76] *)
10841 StaticEnv.empty
10842
10843 | elabSpec(B, SEQSpec(I, spec1, spec2)) =
10844 (* [Rule 77] *)
10845 let
10846 val E1 = elabSpec(B, spec1)
10847 val E2 = elabSpec(B oplusE E1, spec2)
10848 val _ = if StaticEnv.disjoint(E1,E2) then () else
10849 error(I, "duplicate specifications in signature")
10850 in
10851 StaticEnv.plus(E1,E2)
10852 end
10853
10854 | elabSpec(B, SHARINGTYPESpec(I, spec, longtycons)) =
10855 (* [Rule 78] *)
10856 let
10857 val E = elabSpec(B, spec)
10858 val ts =
10859 List.map
10860 (fn longtycon =>
10861 case StaticEnv.findLongTyCon(E, longtycon)
10862 of NONE =>
10863 errorLongTyCon(I, "unknown type ", longtycon)
10864 | SOME(theta,VE) =>
10865 case TypeFcn.toTyName theta
10866 of NONE =>
10867 errorLongTyCon(I, "non-flexible type ", longtycon)
10868 | SOME t =>
10869 if TyNameSet.member(StaticBasis.Tof B, t) then
10870 errorLongTyCon(I, "rigid type ", longtycon)
10871 else
10872 t
10873 )
10874 longtycons
10875 val equality = if List.exists
10876 (fn t => TyName.equality t <> TyName.NOEQ) ts
10877 then TyName.EQ
10878 else TyName.NOEQ
10879 val span = List.foldl
10880 (fn(t, span) => Int.max(TyName.span t, span))
10881 0 ts
10882 val t1 = List.hd ts
10883 val t = TyName.tyname(TyName.tycon t1, TyName.arity t1,
10884 equality, span)
10885 val theta = TypeFcn.fromTyName t
10886 val phi = List.foldl
10887 (fn(ti, phi) => TyNameMap.insert(phi, ti, theta))
10888 TyNameMap.empty ts
10889 in
10890 StaticEnv.realise phi E
10891 end
10892
10893 | elabSpec(B, SHARINGSpec(I, spec, longstrids)) =
10894 (* [Appendix A] *)
10895 let
10896 fun shareFlexibleTyName(t1, t2, phi) =
10897 let
10898 val equality = if TyName.equality t1 <> TyName.NOEQ
10899 orelse TyName.equality t2 <> TyName.NOEQ
10900 then TyName.EQ
10901 else TyName.NOEQ
10902 val t = TyName.tyname(TyName.tycon t1,
10903 TyName.arity t1,
10904 equality,
10905 Int.max(TyName.span t1,
10906 TyName.span t2))
10907 val theta = TypeFcn.fromTyName t
10908 in
10909 TyNameMap.insert(TyNameMap.insert(phi,
10910 t1, theta),
10911 t2, theta)
10912 end
10913
10914 fun shareTE(TE1, TE2, phi) =
10915 TyConMap.foldli
10916 (fn(tycon, (theta1,VE1), phi) =>
10917 case TyConMap.find(TE2, tycon)
10918 of NONE => phi
10919 | SOME(theta2,VE2) =>
10920 case (TypeFcn.toTyName(TypeFcn.realise phi theta1),
10921 TypeFcn.toTyName(TypeFcn.realise phi theta2))
10922 of (SOME t1, SOME t2) =>
10923 if TyNameSet.member(StaticBasis.Tof B, t1)
10924 orelse TyNameSet.member(StaticBasis.Tof B,t2) then
10925 errorTyCon(I, "structure contains rigid type ",
10926 tycon)
10927 else
10928 shareFlexibleTyName(t1, t2, phi)
10929 | _ =>
10930 errorTyCon(I, "structure contains non-flexible \
10931 \type ", tycon)
10932 )
10933 phi TE1
10934
10935 fun shareSE(SE1, SE2, phi) =
10936 StrIdMap.foldli
10937 (fn(strid, StaticEnv.Str E1, phi) =>
10938 case StrIdMap.find(SE2, strid)
10939 of NONE => phi
10940 | SOME(StaticEnv.Str E2) => shareE(E1, E2, phi)
10941 )
10942 phi SE1
10943
10944 and shareE((SE1,TE1,VE1), (SE2,TE2,VE2), phi) =
10945 let
10946 val phi' = shareTE(TE1, TE2, phi)
10947 val phi'' = shareSE(SE1, SE2, phi')
10948 in
10949 phi''
10950 end
10951
10952 fun share1(E1, [], phi) = phi
10953 | share1(E1, E2::Es, phi) =
10954 let
10955 val phi' = shareE(E1, E2, phi)
10956 in
10957 share1(E1, Es, phi')
10958 end
10959
10960 fun shareAll( [], phi) = phi
10961 | shareAll(E::Es, phi) =
10962 let
10963 val phi' = share1(E, Es, phi)
10964 in
10965 shareAll(Es, phi')
10966 end
10967
10968 val E = elabSpec(B, spec)
10969 val Es = List.map
10970 (fn longstrid =>
10971 case StaticEnv.findLongStrId(E, longstrid)
10972 of SOME(StaticEnv.Str E') => E'
10973 | NONE =>
10974 errorLongStrId(I, "unknown structure ", longstrid)
10975 ) longstrids
10976 val phi = shareAll(Es, TyNameMap.empty)
10977 in
10978 StaticEnv.realise phi E
10979 end
10980
10981
10982 (* Value Descriptions *)
10983
10984 and elabValDesc(C, ValDesc(I, vid, ty, valdesc_opt)) =
10985 (* [Rule 79] *)
10986 let
10987 val tau = ElabCore.elabTy(C, ty)
10988 val VE = case valdesc_opt
10989 of NONE => VIdMap.empty
10990 | SOME valdesc => elabValDesc(C, valdesc)
10991 in
10992 if isSome(VIdMap.find(VE, vid)) then
10993 (* Syntactic restriction [Section 3.5, 2nd bullet] *)
10994 errorVId(I, "duplicate variable ", vid)
10995 else if not(ElabCore.validBindVId vid) then
10996 (* Syntactic restriction [Section 3.5, 5th bullet] *)
10997 errorVId(I, "illegal specification of identifier ", vid)
10998 else
10999 VIdMap.insert(VE, vid, (([],tau),IdStatus.v))
11000 end
11001
11002
11003 (* Type Descriptions *)
11004
11005 and elabTypDesc(C, TypDesc(I, tyvarseq, tycon, typdesc_opt)) =
11006 (* [Rule 80] *)
11007 let
11008 val alphas = #2(ElabCore.tyvars tyvarseq)
11009 val k = List.length alphas
11010 val t = TyName.tyname(tycon, k, TyName.NOEQ, 0)
11011 val TE = case typdesc_opt
11012 of NONE => TyConMap.empty
11013 | SOME typdesc => elabTypDesc(C, typdesc)
11014 (* Side condition on t is always true. *)
11015 val tau = Type.fromConsType (List.map Type.fromTyVar alphas, t)
11016 in
11017 if isSome(TyConMap.find(TE, tycon)) then
11018 (* Syntactic restriction [Section 3.5, 2nd bullet] *)
11019 errorTyCon(I, "duplicate type constructor ", tycon)
11020 else
11021 TyConMap.insert(TE, tycon, ((alphas,tau),VIdMap.empty))
11022 end
11023
11024
11025 (* Datatype Descriptions *)
11026
11027 and elabDatDesc(C, DatDesc(I, tyvarseq, tycon, condesc, datdesc_opt)) =
11028 (* [Rule 81, part 2] *)
11029 let
11030 val (U,alphas) = ElabCore.tyvars tyvarseq
11031 val (alphas,tau) = case Context.findTyCon(C, tycon)
11032 of SOME(theta,VE) => theta
11033 | NONE => (* lhsDatDesc inserted it! *)
11034 raise Fail "ElabCore.elabDatDesc: \
11035 \tycon not pre-bound"
11036 val VE = elabConDesc(C,tau, condesc)
11037 val(VE',TE') = case datdesc_opt
11038 of NONE => ( VIdMap.empty, TyConMap.empty )
11039 | SOME datdesc => elabDatDesc(C, datdesc)
11040 (* Side condition on t is always true. *)
11041 val ClosVE = if TyVarSet.isSubset(StaticEnv.tyvarsVE VE, U) then
11042 StaticEnv.Clos VE
11043 else
11044 (* Syntactic restriction [Section 3.5,4th bullet]*)
11045 error(I, "free type variables \
11046 \in datatype description")
11047 in
11048 if isSome(TyConMap.find(TE', tycon)) then
11049 (* Syntactic restriction [Section 3.5, 2nd bullet] *)
11050 errorTyCon(I, "duplicate type constructor ", tycon)
11051 else
11052 ( VIdMap.unionWithi (fn(vid,_,_) =>
11053 (* Syntactic restriction [Section 3.5, 2nd bullet] *)
11054 errorVId(I, "duplicate data cnstructor ", vid)) (ClosVE,VE')
11055 , TyConMap.insert(TE', tycon, ((alphas,tau),ClosVE))
11056 )
11057 end
11058
11059
11060 (* Constructor Descriptions *)
11061
11062 and elabConDesc(C,tau, ConDesc(I, vid, ty_opt, condesc_opt)) =
11063 (* [Rule 82] *)
11064 let
11065 val tau1 = case ty_opt
11066 of NONE => tau
11067 | SOME ty =>
11068 let
11069 val tau' = ElabCore.elabTy(C, ty)
11070 in
11071 Type.fromFunType(tau',tau)
11072 end
11073 val VE = case condesc_opt
11074 of NONE => VIdMap.empty
11075 | SOME condesc => elabConDesc(C,tau, condesc)
11076 in
11077 if isSome(VIdMap.find(VE, vid)) then
11078 (* Syntactic restriction [Section 3.5, 2nd bullet] *)
11079 errorVId(I, "duplicate data constructor ", vid)
11080 else if not(ElabCore.validConBindVId vid) then
11081 (* Syntactic restriction [Section 3.5, 5th bullet] *)
11082 errorVId(I, "illegal specifiation of identifier ", vid)
11083 else
11084 VIdMap.insert(VE, vid, (([],tau1),IdStatus.c))
11085 end
11086
11087
11088 (* Exception Description *)
11089
11090 and elabExDesc(C, ExDesc(I, vid, ty_opt, exdesc_opt)) =
11091 (* [Rule 83] *)
11092 let
11093 val tau1 = case ty_opt
11094 of NONE => InitialStaticEnv.tauExn
11095 | SOME ty =>
11096 let
11097 val tau = ElabCore.elabTy(C, ty)
11098 val _ = if TyVarSet.isEmpty(Type.tyvars tau)
11099 then () else
11100 error(I, "free type variables \
11101 \in exception description")
11102 in
11103 Type.fromFunType(tau, InitialStaticEnv.tauExn)
11104 end
11105 val VE = case exdesc_opt
11106 of NONE => VIdMap.empty
11107 | SOME exdesc => elabExDesc(C, exdesc)
11108 in
11109 if isSome(VIdMap.find(VE, vid)) then
11110 (* Syntactic restriction [Section 3.5, 2nd bullet] *)
11111 errorVId(I, "duplicate exception constructor ", vid)
11112 else if not(ElabCore.validConBindVId vid) then
11113 (* Syntactic restriction [Section 3.5, 5th bullet] *)
11114 errorVId(I, "illegal specification of identifier ", vid)
11115 else
11116 VIdMap.insert(VE, vid, (([],tau1),IdStatus.e))
11117 end
11118
11119
11120 (* Structure Descriptions *)
11121
11122 and elabStrDesc(B, StrDesc(I, strid, sigexp, strdesc_opt)) =
11123 (* [Rule 84] *)
11124 let
11125 val E = elabSigExpE(B, sigexp)
11126 val SE = case strdesc_opt
11127 of NONE => StrIdMap.empty
11128 | SOME strdesc =>
11129 elabStrDesc(B plusT StaticEnv.tynames E, strdesc)
11130 in
11131 if isSome(StrIdMap.find(SE, strid)) then
11132 (* Syntactic restriction [Section 3.5, 2nd bullet] *)
11133 errorStrId(I, "duplicate structure identifier ", strid)
11134 else
11135 StrIdMap.insert(SE, strid, StaticEnv.Str E)
11136 end
11137
11138
11139 (* Functor Declarations *)
11140
11141 and elabFunDec(B, FunDec(I, funbind)) =
11142 (* [Rule 85] *)
11143 let
11144 val F = elabFunBind(B, funbind)
11145 in
11146 F
11147 end
11148
11149
11150 (* Functor Bindings *)
11151
11152 and elabFunBind(B, FunBind(I, funid, strid, sigexp, strexp, funbind_opt)) =
11153 (* [Rule 86] *)
11154 let
11155 val (T,E) = elabSigExp(B, sigexp)
11156 val E' = elabStrExp(
11157 B oplusSE StrIdMap.singleton(strid,StaticEnv.Str E),
11158 strexp)
11159 (* Side condition on T is always ensured. *)
11160 val T' = TyNameSet.difference(StaticEnv.tynames E',
11161 TyNameSet.union(StaticBasis.Tof B, T))
11162 val F = case funbind_opt
11163 of NONE => FunIdMap.empty
11164 | SOME funbind => elabFunBind(B, funbind)
11165 in
11166 if isSome(FunIdMap.find(F, funid)) then
11167 (* Syntactic restriction [Section 3.5, 1st bullet] *)
11168 errorFunId(I, "duplicate functor identifier ", funid)
11169 else
11170 FunIdMap.insert(F, funid, (T,(E,(T',E'))))
11171 end
11172
11173
11174 (* Top-level Declarations *)
11175
11176 and elabTopDec(B, STRDECTopDec(I, strdec, topdec_opt)) =
11177 (* [Rule 87] *)
11178 let
11179 val E = elabStrDec(true, B, strdec)
11180 val B' = case topdec_opt
11181 of NONE => StaticBasis.empty
11182 | SOME topdec => elabTopDec(B oplusE E, topdec)
11183 val B'' = StaticBasis.plus
11184 (StaticBasis.fromTandE(StaticEnv.tynames E, E), B')
11185 in
11186 if TyVarSet.isEmpty(StaticBasis.tyvars B'') then
11187 B''
11188 else
11189 error(I, "free type variables on top-level")
11190 end
11191
11192 | elabTopDec(B, SIGDECTopDec(I, sigdec, topdec_opt)) =
11193 (* [Rule 88] *)
11194 let
11195 val G = elabSigDec(B, sigdec)
11196 val B' = case topdec_opt
11197 of NONE => StaticBasis.empty
11198 | SOME topdec => elabTopDec(B oplusG G, topdec)
11199 val B'' = StaticBasis.plus
11200 (StaticBasis.fromTandG(StaticBasis.tynamesG G, G), B')
11201 in
11202 B''
11203 end
11204
11205 | elabTopDec(B, FUNDECTopDec(I, fundec, topdec_opt)) =
11206 (* [Rule 89] *)
11207 let
11208 val F = elabFunDec(B, fundec)
11209 val B' = case topdec_opt
11210 of NONE => StaticBasis.empty
11211 | SOME topdec => elabTopDec(B oplusF F, topdec)
11212 val B'' = StaticBasis.plus
11213 (StaticBasis.fromTandF(StaticBasis.tynamesF F, F), B')
11214 in
11215 if TyVarSet.isEmpty(StaticBasis.tyvars B'') then
11216 B''
11217 else
11218 error(I, "free type variables on top-level")
11219 end
11220
11221
11222
11223 (* Build tentative TE from LHSs of datdesc *)
11224
11225 and lhsDatDesc(DatDesc(I, tyvarseq, tycon, condesc, datdesc_opt)) =
11226 (* [Rule 81, part 1] *)
11227 let
11228 val (U,alphas) = ElabCore.tyvars tyvarseq
11229 val k = List.length alphas
11230 val span = lhsConDesc condesc
11231 val t = TyName.tyname(tycon, k, TyName.EQ, span)
11232 val tau = Type.fromConsType(List.map Type.fromTyVar alphas,t)
11233 val TE' = case datdesc_opt
11234 of NONE => TyConMap.empty
11235 | SOME datdesc => lhsDatDesc datdesc
11236 in
11237 if isSome(TyConMap.find(TE', tycon)) then
11238 (* Syntactic restriction [Section 3.5, 2nd bullet] *)
11239 errorTyCon(I, "duplicate type constructor ", tycon)
11240 else
11241 TyConMap.insert(TE', tycon, ((alphas,tau), VIdMap.empty))
11242 end
11243
11244 and lhsConDesc(ConDesc(I, vid, ty_opt, condesc_opt)) =
11245 case condesc_opt
11246 of NONE => 1
11247 | SOME condesc => 1 + lhsConDesc condesc
11248
11249 end
11250(* stop of ElabModule.sml *)
11251(* start of PP_TYPE.sml *)
11252(*
11253 * Standard ML pretty printing of types and type schemes
11254 *)
11255
11256signature PP_TYPE =
11257 sig
11258
11259 type doc = PrettyPrint.doc
11260 type Type = Type.Type
11261 type TypeScheme = TypeScheme.TypeScheme
11262
11263 val ppType: Type -> doc
11264 val ppTypeScheme: TypeScheme -> doc
11265
11266 end
11267(* stop of PP_TYPE.sml *)
11268(* start of PPType.sml *)
11269(*
11270 * Standard ML pretty printing of types and type schemes
11271 *)
11272
11273structure PPType :> PP_TYPE =
11274 struct
11275
11276 (* Import *)
11277
11278 type TypeScheme = TypeScheme.TypeScheme
11279
11280 open Type
11281 open PrettyPrint
11282 open PPMisc
11283
11284 infixr ^^ ^/^
11285
11286
11287 (* Simple objects *)
11288
11289 fun ppLab lab = text(Lab.toString lab)
11290 fun ppTyVar alpha = text(TyVar.toString alpha)
11291 fun ppTyName t = text(TyName.toString t)
11292
11293 fun ppOverloadingClass O =
11294 let
11295 val T = OverloadingClass.set O
11296 val t = OverloadingClass.default O
11297 val ts = t :: TyNameSet.listItems(TyNameSet.delete(T,t))
11298 in
11299 brack(ppCommaList ppTyName ts)
11300 end
11301
11302
11303 fun ppRowVar CLOSEDRow = empty
11304 | ppRowVar(FLEXRow _) = text "," ^^ break ^^ text "..."
11305
11306
11307 (* Types *)
11308
11309 (* Precedence:
11310 * 0 : function arrow (ty1 -> ty2)
11311 * 1 : tuple (ty1 * ... * tyn)
11312 * 2 : constructed type (tyseq tycon)
11313 *)
11314
11315 fun ppType tau = fbox(below(nest(ppTypePrec 0 tau)))
11316
11317 and ppTypePrec p (ref tau') = ppType'Prec p tau'
11318
11319 and ppType'Prec p (TyVar(alpha)) = ppTyVar alpha
11320
11321 | ppType'Prec p (RowType(Rho,r)) =
11322 let
11323 fun isTuple( [], n) = n > 2
11324 | isTuple(lab::labs, n) =
11325 lab = Lab.fromInt n andalso isTuple(labs, n+1)
11326
11327 val labtaus = LabMap.listItemsi Rho
11328 val (labs,taus) = ListPair.unzip labtaus
11329 in
11330 if r = CLOSEDRow andalso List.null labs then
11331 text "unit"
11332 else if r = CLOSEDRow andalso isTuple(labs, 1) then
11333 let
11334 val doc = ppStarList (ppTypePrec 2) taus
11335 in
11336 if p > 1 then
11337 paren doc
11338 else
11339 fbox(below(nest doc))
11340 end
11341 else
11342 brace(ppCommaList ppLabType labtaus ^^ ppRowVar r)
11343 end
11344
11345 | ppType'Prec p (FunType(tau1,tau2)) =
11346 let
11347 val doc = ppTypePrec 1 tau1 ^/^
11348 text "->" ^/^
11349 ppTypePrec 0 tau2
11350 in
11351 if p > 0 then
11352 paren doc
11353 else
11354 doc
11355 end
11356
11357 | ppType'Prec p (ConsType(taus,t)) =
11358 fbox(nest(ppSeqPrec ppTypePrec 2 taus ^/^ ppTyName t))
11359
11360 | ppType'Prec p (Overloaded(O)) =
11361 text "'" ^^ ppOverloadingClass O
11362
11363 | ppType'Prec p (Link tau) =
11364 ppTypePrec p tau
11365
11366 and ppLabType(lab, tau) =
11367 abox(
11368 hbox(
11369 ppLab lab ^/^
11370 text ":"
11371 ) ^^
11372 below(nest(break ^^
11373 ppType tau
11374 ))
11375 )
11376
11377
11378 (* Type schemes *)
11379
11380 fun ppTypeScheme sigma =
11381 let
11382 val (alphas,tau) = TypeScheme.normalise sigma
11383 in
11384 ppType tau
11385 end
11386
11387 end
11388(* stop of PPType.sml *)
11389(* start of PP_STATIC_ENV.sml *)
11390(*
11391 * Standard ML pretty printing of the static environment
11392 *)
11393
11394signature PP_STATIC_ENV =
11395 sig
11396
11397 type doc = PrettyPrint.doc
11398 type ValEnv = StaticEnv.ValEnv
11399 type TyEnv = StaticEnv.TyEnv
11400 type Env = StaticEnv.Env
11401 type TyNameSet = TyNameSet.set
11402
11403 val ppEnv: Env -> doc
11404 val ppSig: TyNameSet * Env -> doc
11405
11406 val ppTyEnv: TyNameSet * TyEnv -> doc
11407 val ppExEnv: ValEnv -> doc
11408
11409 end
11410(* stop of PP_STATIC_ENV.sml *)
11411(* start of PPStaticEnv.sml *)
11412(*
11413 * Standard ML pretty printing of the static environment
11414 *)
11415
11416structure PPStaticEnv :> PP_STATIC_ENV =
11417 struct
11418
11419 (* Import *)
11420
11421 type ValEnv = StaticEnv.ValEnv
11422 type TyEnv = StaticEnv.TyEnv
11423 type Env = StaticEnv.Env
11424 type TyNameSet = TyNameSet.set
11425
11426 open PrettyPrint
11427 open PPMisc
11428
11429 infixr ^^ ^/^
11430
11431
11432 (* Simple objects *)
11433
11434 fun ppVId vid = text(VId.toString vid)
11435 fun ppTyCon tycon = text(TyCon.toString tycon)
11436 fun ppTyVar alpha = text(TyVar.toString alpha)
11437 fun ppStrId strid = text(StrId.toString strid)
11438
11439 fun ppTyName t = text(TyName.toString t)
11440
11441
11442 (* Environments *)
11443
11444 fun ppConTypeScheme (_, ref(Type.FunType(tau,_))) =
11445 text "of" ^^ break ^^ PPType.ppType tau
11446
11447 | ppConTypeScheme _ = empty
11448
11449
11450 fun ppValEnv VE =
11451 VIdMap.foldri
11452 (fn(vid, (sigma,IdStatus.v), doc) =>
11453 abox(
11454 hbox(
11455 text "val" ^/^
11456 ppVId vid ^/^
11457 text ":"
11458 ) ^^
11459 nest(break ^^
11460 abox(PPType.ppTypeScheme sigma)
11461 )
11462 ) ^/^
11463 doc
11464
11465 | (vid, (sigma,_), doc) => doc
11466 )
11467 empty VE
11468
11469 fun ppExEnv VE =
11470 VIdMap.foldri
11471 (fn(vid, (sigma,IdStatus.e), doc) =>
11472 abox(
11473 hbox(
11474 text "exception" ^/^
11475 ppVId vid
11476 ) ^^
11477 nest(break ^^
11478 abox(ppConTypeScheme sigma)
11479 )
11480 ) ^/^
11481 doc
11482
11483 | (vid, (sigma,_), doc) => doc
11484 )
11485 empty VE
11486
11487 fun ppConEnv VE =
11488 VIdMap.foldli
11489 (fn(vid, (sigma,_), doc) =>
11490 doc ^/^
11491 abox(
11492 hbox(
11493 (if isEmpty doc then empty else text "|") ^/^
11494 ppVId vid
11495 ) ^^
11496 nest(text "" ^/^
11497 abox(ppConTypeScheme sigma)
11498 )
11499 )
11500 )
11501 empty VE
11502
11503
11504 fun absTy(T, tycon, theta) =
11505 case TypeFcn.toTyName theta
11506 of NONE => NONE
11507 | SOME t => if TyName.tycon t = tycon
11508 andalso TyNameSet.member(T, t) then
11509 SOME(TyName.equality t <> TyName.NOEQ)
11510 else
11511 NONE
11512
11513 fun ppAbsTyEnv(T,TE) =
11514 TyConMap.foldri
11515 (fn(tycon, (theta as (alphas,tau), VE), doc) =>
11516 if VIdMap.isEmpty VE then
11517 case absTy(T, tycon, theta)
11518 of NONE => doc
11519 | SOME eq =>
11520 abox(
11521 hbox(
11522 text(if eq then "eqtype" else "type") ^/^
11523 ppSeq ppTyVar alphas ^/^
11524 ppTyCon tycon
11525 )
11526 ) ^/^
11527 doc
11528 else
11529 doc
11530 )
11531 empty TE
11532
11533 fun ppSynTyEnv(T,TE) =
11534 TyConMap.foldri
11535 (fn(tycon, (theta as (alphas,tau), VE), doc) =>
11536 if VIdMap.isEmpty VE
11537 andalso not(isSome(absTy(T, tycon, theta))) then
11538 abox(
11539 hbox(
11540 text "type" ^/^
11541 ppSeq ppTyVar alphas ^/^
11542 ppTyCon tycon ^/^
11543 text "="
11544 ) ^^
11545 nest(break ^^
11546 abox(PPType.ppType tau)
11547 )
11548 ) ^/^
11549 doc
11550 else
11551 doc
11552 )
11553 empty TE
11554
11555 fun ppDataTyEnv TE =
11556 TyConMap.foldri
11557 (fn(tycon, ((alphas,tau),VE), doc) =>
11558 if VIdMap.isEmpty VE then
11559 doc
11560 else
11561 abox(
11562 hbox(
11563 text "datatype" ^/^
11564 ppSeq ppTyVar alphas ^/^
11565 ppTyCon tycon ^/^
11566 text "="
11567 ) ^^
11568 nest(break ^^
11569 abox(ppConEnv VE)
11570 )
11571 ) ^/^
11572 doc
11573 )
11574 empty TE
11575
11576 fun ppTyEnv(T,TE) =
11577 vbox(
11578 ppAbsTyEnv(T,TE) ^/^
11579 ppSynTyEnv(T,TE) ^/^
11580 ppDataTyEnv TE
11581 )
11582
11583 fun ppStrEnv(T,SE) =
11584 StrIdMap.foldri
11585 (fn(strid, StaticEnv.Str E, doc) =>
11586 abox(
11587 hbox(
11588 text "structure" ^/^
11589 ppStrId strid ^/^
11590 text ":"
11591 ) ^^
11592 nest(break ^^
11593 ppSig (T,E)
11594 )
11595 ) ^/^
11596 doc
11597 )
11598 empty SE
11599
11600 and ppEnv'(T,(SE,TE,VE)) =
11601 vbox(
11602 ppStrEnv(T,SE) ^/^
11603 ppTyEnv(T,TE) ^/^
11604 ppExEnv VE ^/^
11605 ppValEnv VE
11606 )
11607
11608 and ppEnv E = ppEnv'(TyNameSet.empty,E)
11609
11610
11611 (* Signatures *)
11612
11613 and ppSig (T,E) =
11614 let
11615 val doc = ppEnv'(T, E)
11616 in
11617 abox(below(
11618 text "sig" ^^
11619 brace(ppCommaList ppTyName (TyNameSet.listItems T)) ^^
11620 (if isEmpty doc then
11621 empty
11622 else
11623 nest(vbox(break ^^ doc))
11624 ) ^^ break ^^
11625 text "end"
11626 ))
11627 end
11628
11629 end
11630(* stop of PPStaticEnv.sml *)
11631(* start of PP_STATIC_BASIS.sml *)
11632(*
11633 * Standard ML pretty printing of the static basis
11634 *)
11635
11636signature PP_STATIC_BASIS =
11637 sig
11638
11639 type doc = PrettyPrint.doc
11640 type Basis = StaticBasis.Basis
11641 type SigEnv = StaticBasis.SigEnv
11642 type FunEnv = StaticBasis.FunEnv
11643
11644 val ppBasis: Basis -> doc
11645 val ppSigEnv: SigEnv -> doc
11646 val ppFunEnv: FunEnv -> doc
11647
11648 end
11649(* stop of PP_STATIC_BASIS.sml *)
11650(* start of PPStaticBasis.sml *)
11651(*
11652 * Standard ML pretty printing of the static basis
11653 *)
11654
11655structure PPStaticBasis :> PP_STATIC_BASIS =
11656 struct
11657
11658 (* Import *)
11659
11660 type Basis = StaticBasis.Basis
11661 type SigEnv = StaticBasis.SigEnv
11662 type FunEnv = StaticBasis.FunEnv
11663
11664 open PrettyPrint
11665 open PPMisc
11666
11667 infixr ^^ ^/^
11668
11669
11670 (* Simple objects *)
11671
11672 fun ppSigId sigid = text(SigId.toString sigid)
11673 fun ppFunId funid = text(FunId.toString funid)
11674
11675
11676 (* Environments *)
11677
11678 fun ppSigEnv G =
11679 SigIdMap.foldri
11680 (fn(sigid, Sigma, doc) =>
11681 abox(
11682 hbox(
11683 text "signature" ^/^
11684 ppSigId sigid ^/^
11685 text "="
11686 ) ^^
11687 nest(break ^^
11688 PPStaticEnv.ppSig Sigma
11689 )
11690 ) ^/^
11691 doc
11692 )
11693 empty G
11694
11695 fun ppFunEnv F =
11696 FunIdMap.foldri
11697 (fn(funid, (T,(E,Sigma)), doc) =>
11698 abox(
11699 hbox(
11700 text "functor" ^/^
11701 ppFunId funid
11702 ) ^^
11703 nest(ebreak ^^
11704 abox(
11705 hbox(
11706 text "(" ^^
11707 text "Arg" ^/^
11708 text ":"
11709 ) ^^
11710 nest(break ^^
11711 PPStaticEnv.ppSig(T,E)
11712 ) ^^ ebreak ^^
11713 hbox(
11714 text ")" ^/^
11715 text ":"
11716 )
11717 ) ^/^
11718 PPStaticEnv.ppSig Sigma
11719 )
11720 ) ^/^
11721 doc
11722 )
11723 empty F
11724
11725
11726 (* Basis *)
11727
11728 fun ppBasis (T,F,G,E) =
11729 vbox(
11730 ppSigEnv G ^/^
11731 ppFunEnv F ^/^
11732 PPStaticEnv.ppEnv E ^/^
11733 text ""
11734 )
11735
11736 end
11737(* stop of PPStaticBasis.sml *)
11738(* start of PP_ENV.sml *)
11739(*
11740 * Standard ML pretty printing of the combined static/dynamic environment
11741 *)
11742
11743signature PP_ENV =
11744 sig
11745
11746 type doc = PrettyPrint.doc
11747 type Env = StaticEnv.Env * DynamicEnv.Env
11748 type State = PPDynamicEnv.State
11749
11750 val ppEnv: State * Env -> doc
11751
11752 end
11753(* stop of PP_ENV.sml *)
11754(* start of PPEnv.sml *)
11755(*
11756 * Standard ML pretty printing of the combined static/dynamic environment
11757 *)
11758
11759structure PPEnv :> PP_ENV =
11760 struct
11761
11762 (* Import *)
11763
11764 type Env = StaticEnv.Env * DynamicEnv.Env
11765 type State = PPDynamicEnv.State
11766
11767 open PrettyPrint
11768 open PPMisc
11769
11770 infixr ^^ ^/^
11771
11772
11773 (* Simple objects *)
11774
11775 fun ppVId vid = text(VId.toString vid)
11776 fun ppStrId strid = text(StrId.toString strid)
11777
11778
11779 (* Environments *)
11780
11781 fun ppValEnv(s, (VE_STAT,VE_DYN)) =
11782 VIdMap.foldri
11783 (fn(vid, (sigma,IdStatus.v), doc) =>
11784 let
11785 val (v,is) = valOf(VIdMap.find(VE_DYN, vid))
11786 in
11787 fbox(
11788 hbox(
11789 text "val" ^/^
11790 ppVId vid
11791 ) ^^
11792 nest(break ^^
11793 text "=" ^/^
11794 below(abox(PPVal.ppVal(s, v))) ^/^
11795 text ":" ^/^
11796 below(abox(PPType.ppTypeScheme sigma))
11797 )
11798 ) ^/^
11799 doc
11800 end
11801
11802 | (vid, (sigma,_), doc) => doc
11803 )
11804 empty VE_STAT
11805
11806 fun ppStrEnv(s, T, (SE_STAT,SE_DYN)) =
11807 StrIdMap.foldri
11808 (fn(strid, StaticEnv.Str E_STAT, doc) =>
11809 let
11810 val DynamicEnv.Str E_DYN = valOf(StrIdMap.find(SE_DYN, strid))
11811 in
11812 abox(
11813 hbox(
11814 text "structure" ^/^
11815 ppStrId strid ^/^
11816 text "="
11817 ) ^^
11818 nest(break ^^
11819 ppStr (s, T, (E_STAT,E_DYN))
11820 )
11821 ) ^/^
11822 doc
11823 end
11824 )
11825 empty SE_STAT
11826
11827 and ppEnv'(s, T, ((SE_STAT,TE_STAT,VE_STAT), (SE_DYN, TE_DYN, VE_DYN))) =
11828 vbox(
11829 ppStrEnv(s, T, (SE_STAT,SE_DYN)) ^/^
11830 PPStaticEnv.ppTyEnv(T,TE_STAT) ^/^
11831 PPStaticEnv.ppExEnv VE_STAT ^/^
11832 ppValEnv(s, (VE_STAT,VE_DYN))
11833 )
11834
11835 and ppEnv(s, E) = ppEnv'(s, TyNameSet.empty, E)
11836
11837
11838 (* Structures *)
11839
11840 and ppStr(s, T, E) =
11841 let
11842 val doc = ppEnv'(s, T, E)
11843 in
11844 abox(below(
11845 text "struct" ^^
11846 (if isEmpty doc then
11847 empty
11848 else
11849 nest(vbox(break ^^ doc))
11850 ) ^^ break ^^
11851 text "end"
11852 ))
11853 end
11854
11855 end
11856(* stop of PPEnv.sml *)
11857(* start of PP_BASIS.sml *)
11858(*
11859 * Standard ML pretty printing of the combined basis
11860 *)
11861
11862signature PP_BASIS =
11863 sig
11864
11865 type doc = PrettyPrint.doc
11866 type Basis = Basis.Basis
11867 type State = PPEnv.State
11868
11869 val ppBasis: State * Basis -> doc
11870
11871 end
11872(* stop of PP_BASIS.sml *)
11873(* start of PPBasis.sml *)
11874(*
11875 * Standard ML pretty printing of the combined basis
11876 *)
11877
11878structure PPBasis :> PP_BASIS =
11879 struct
11880
11881 (* Import *)
11882
11883 type Basis = Basis.Basis
11884 type State = PPEnv.State
11885
11886 open PrettyPrint
11887
11888 infixr ^^ ^/^
11889
11890
11891 (* Basis *)
11892
11893 fun ppBasis (s, ((T,F_STAT,G_STAT,E_STAT), (F_DYN,G_DYN,E_DYN))) =
11894 vbox(
11895 PPStaticBasis.ppSigEnv G_STAT ^/^
11896 PPStaticBasis.ppFunEnv F_STAT ^/^
11897 PPEnv.ppEnv(s, (E_STAT,E_DYN)) ^/^
11898 text ""
11899 )
11900
11901 end
11902(* stop of PPBasis.sml *)
11903(* start of PROGRAM.sml *)
11904(*
11905 * Standard ML programs
11906 *
11907 * Definition, section 8
11908 *
11909 * Note:
11910 * State is passed as reference and modified via side effects. This way
11911 * expanding out the state and exception convention in the inference rules
11912 * of modules and core can be avoided. Note that the state therefore
11913 * never is returned.
11914 *)
11915
11916signature PROGRAM =
11917 sig
11918
11919 (* Import types *)
11920
11921 type Program = GrammarProgram.Program
11922 type StaticBasis = StaticBasis.Basis
11923 type DynamicBasis = DynamicBasis.Basis
11924 type Basis = Basis.Basis
11925 type State = EvalModule.State
11926
11927
11928 (* Export *)
11929
11930 val execProgram: State ref * Basis * Program -> Basis
11931 val elabProgram: StaticBasis * Program -> StaticBasis
11932 val evalProgram: State ref * DynamicBasis * Program -> DynamicBasis
11933
11934 end
11935(* stop of PROGRAM.sml *)
11936(* start of Program.sml *)
11937(*
11938 * Standard ML programs
11939 *
11940 * Definition, section 8
11941 *
11942 * Note:
11943 * State is passed as reference and modified via side effects. This way
11944 * expanding out the state and exception convention in the inference rules
11945 * of modules and core can be avoided. Note that the state therefore
11946 * never is returned.
11947 *)
11948
11949structure Program :> PROGRAM =
11950 struct
11951
11952 (* Import *)
11953
11954 type StaticBasis = StaticBasis.Basis
11955 type DynamicBasis = DynamicBasis.Basis
11956 type Basis = Basis.Basis
11957 type State = EvalModule.State
11958
11959
11960 open GrammarProgram
11961
11962
11963 (* Helpers for output *)
11964
11965 val width = 79
11966
11967 fun printException(s, e) =
11968 ( TextIO.output(TextIO.stdOut, "Uncaught exception: ")
11969 ; PrettyPrint.output(TextIO.stdOut, PPVal.ppExVal(s, e), width)
11970 ; TextIO.output1(TextIO.stdOut, #"\n")
11971 ; TextIO.flushOut TextIO.stdOut
11972 )
11973
11974 fun printStaticBasis B_STAT =
11975 ( PrettyPrint.output(TextIO.stdOut, PPStaticBasis.ppBasis B_STAT,
11976 width)
11977 ; TextIO.flushOut TextIO.stdOut
11978 )
11979
11980 fun printDynamicBasis(s, B_DYN) =
11981 ( PrettyPrint.output(TextIO.stdOut, PPDynamicBasis.ppBasis(s, B_DYN),
11982 width)
11983 ; TextIO.flushOut TextIO.stdOut
11984 )
11985
11986 fun printBasis(s, B) =
11987 ( PrettyPrint.output(TextIO.stdOut, PPBasis.ppBasis(s, B), width)
11988 ; TextIO.flushOut TextIO.stdOut
11989 )
11990
11991
11992 (* Helpers for basis modification *)
11993
11994 val oplus = Basis.oplus
11995
11996 infix oplus
11997
11998
11999 (* Inference rules [Section 8] *)
12000
12001 fun execProgram(s,B, Program(I, topdec, program_opt)) =
12002 (* [Rules 187 to 189] *)
12003 let
12004 val B_STAT1 = ElabModule.elabTopDec(Basis.B_STATof B, topdec)
12005 val B_DYN1 = EvalModule.evalTopDec(s,Basis.B_DYNof B, topdec)
12006 (* [Rule 189] *)
12007 val _ = printBasis(!s, (B_STAT1,B_DYN1))
12008 val B' = B oplus (B_STAT1,B_DYN1)
12009 val B'' = case program_opt
12010 of NONE => B'
12011 | SOME program => execProgram(s,B', program)
12012 in
12013 B''
12014 end
12015 handle Error.Error m =>
12016 (* [Rule 187] *)
12017 let
12018 val B' = case program_opt
12019 of NONE => B
12020 | SOME program => execProgram(s,B, program)
12021 in
12022 B'
12023 end
12024
12025 | Pack.Pack e =>
12026 (* [Rule 188] *)
12027 let
12028 val _ = printException(!s, e)
12029 val B' = case program_opt
12030 of NONE => B
12031 | SOME program => execProgram(s,B, program)
12032 in
12033 B'
12034 end
12035
12036
12037 (* Elaboration only *)
12038
12039 fun elabProgram(B_STAT, Program(I, topdec, program_opt)) =
12040 let
12041 val B_STAT1 = ElabModule.elabTopDec(B_STAT, topdec)
12042 val _ = printStaticBasis B_STAT1
12043 val B_STAT' = StaticBasis.plus(B_STAT, B_STAT1)
12044 val B_STAT'' = case program_opt
12045 of NONE => B_STAT'
12046 | SOME program => elabProgram(B_STAT', program)
12047 in
12048 B_STAT''
12049 end
12050 handle Error.Error m =>
12051 B_STAT
12052
12053
12054 (* Evaluation only *)
12055
12056 fun evalProgram(s,B_DYN, Program(I, topdec, program_opt)) =
12057 let
12058 val B_DYN1 = EvalModule.evalTopDec(s,B_DYN, topdec)
12059 val _ = printDynamicBasis(!s, B_DYN1)
12060 val B_DYN' = DynamicBasis.plus(B_DYN, B_DYN1)
12061 val B_DYN'' = case program_opt
12062 of NONE => B_DYN'
12063 | SOME program => evalProgram(s,B_DYN', program)
12064 in
12065 B_DYN''
12066 end
12067 handle Error.Error m =>
12068 (* Runtime error *)
12069 let
12070 val B_DYN' = case program_opt
12071 of NONE => B_DYN
12072 | SOME program =>
12073 evalProgram(s,B_DYN, program)
12074 in
12075 B_DYN'
12076 end
12077
12078 | Pack.Pack e =>
12079 let
12080 val _ = printException(!s, e)
12081 val B_DYN' = case program_opt
12082 of NONE => B_DYN
12083 | SOME program =>
12084 evalProgram(s,B_DYN, program)
12085 in
12086 B_DYN'
12087 end
12088
12089 end
12090(* stop of Program.sml *)
12091(* start of ml-yacc/lib/base.sig *)
12092(* ML-Yacc Parser Generator (c) 1989 Andrew W. Appel, David R. Tarditi *)
12093
12094(* base.sig: Base signature file for SML-Yacc. This file contains signatures
12095 that must be loaded before any of the files produced by ML-Yacc are loaded
12096*)
12097
12098(* STREAM: signature for a lazy stream.*)
12099
12100signature STREAM =
12101 sig type 'xa stream
12102 val streamify : (unit -> '_a) -> '_a stream
12103 val cons : '_a * '_a stream -> '_a stream
12104 val get : '_a stream -> '_a * '_a stream
12105 end
12106
12107(* LR_TABLE: signature for an LR Table.
12108
12109 The list of actions and gotos passed to mkLrTable must be ordered by state
12110 number. The values for state 0 are the first in the list, the values for
12111 state 1 are next, etc.
12112*)
12113
12114signature LR_TABLE =
12115 sig
12116 datatype ('a,'b) pairlist = EMPTY | PAIR of 'a * 'b * ('a,'b) pairlist
12117 datatype state = STATE of int
12118 datatype term = T of int
12119 datatype nonterm = NT of int
12120 datatype action = SHIFT of state
12121 | REDUCE of int
12122 | ACCEPT
12123 | ERROR
12124 type table
12125
12126 val numStates : table -> int
12127 val numRules : table -> int
12128 val describeActions : table -> state ->
12129 (term,action) pairlist * action
12130 val describeGoto : table -> state -> (nonterm,state) pairlist
12131 val action : table -> state * term -> action
12132 val goto : table -> state * nonterm -> state
12133 val initialState : table -> state
12134 exception Goto of state * nonterm
12135
12136 val mkLrTable : {actions : ((term,action) pairlist * action) array,
12137 gotos : (nonterm,state) pairlist array,
12138 numStates : int, numRules : int,
12139 initialState : state} -> table
12140 end
12141
12142(* TOKEN: signature revealing the internal structure of a token. This signature
12143 TOKEN distinct from the signature {parser name}_TOKENS produced by ML-Yacc.
12144 The {parser name}_TOKENS structures contain some types and functions to
12145 construct tokens from values and positions.
12146
12147 The representation of token was very carefully chosen here to allow the
12148 polymorphic parser to work without knowing the types of semantic values
12149 or line numbers.
12150
12151 This has had an impact on the TOKENS structure produced by SML-Yacc, which
12152 is a structure parameter to lexer functors. We would like to have some
12153 type 'a token which functions to construct tokens would create. A
12154 constructor function for a integer token might be
12155
12156 INT: int * 'a * 'a -> 'a token.
12157
12158 This is not possible because we need to have tokens with the representation
12159 given below for the polymorphic parser.
12160
12161 Thus our constructur functions for tokens have the form:
12162
12163 INT: int * 'a * 'a -> (svalue,'a) token
12164
12165 This in turn has had an impact on the signature that lexers for SML-Yacc
12166 must match and the types that a user must declare in the user declarations
12167 section of lexers.
12168*)
12169
12170signature TOKEN =
12171 sig
12172 structure LrTable : LR_TABLE
12173 datatype ('a,'b) token = TOKEN of LrTable.term * ('a * 'b * 'b)
12174 val sameToken : ('a,'b) token * ('a,'b) token -> bool
12175 end
12176
12177(* LR_PARSER: signature for a polymorphic LR parser *)
12178
12179signature LR_PARSER =
12180 sig
12181 structure Stream: STREAM
12182 structure LrTable : LR_TABLE
12183 structure Token : TOKEN
12184
12185 sharing LrTable = Token.LrTable
12186
12187 exception ParseError
12188
12189 val parse : {table : LrTable.table,
12190 lexer : ('_b,'_c) Token.token Stream.stream,
12191 arg: 'arg,
12192 saction : int *
12193 '_c *
12194 (LrTable.state * ('_b * '_c * '_c)) list *
12195 'arg ->
12196 LrTable.nonterm *
12197 ('_b * '_c * '_c) *
12198 ((LrTable.state *('_b * '_c * '_c)) list),
12199 void : '_b,
12200 ec : { is_keyword : LrTable.term -> bool,
12201 noShift : LrTable.term -> bool,
12202 preferred_change : (LrTable.term list * LrTable.term list) list,
12203 errtermvalue : LrTable.term -> '_b,
12204 showTerminal : LrTable.term -> string,
12205 terms: LrTable.term list,
12206 error : string * '_c * '_c -> unit
12207 },
12208 lookahead : int (* max amount of lookahead used in *)
12209 (* error correction *)
12210 } -> '_b *
12211 (('_b,'_c) Token.token Stream.stream)
12212 end
12213
12214(* LEXER: a signature that most lexers produced for use with SML-Yacc's
12215 output will match. The user is responsible for declaring type token,
12216 type pos, and type svalue in the UserDeclarations section of a lexer.
12217
12218 Note that type token is abstract in the lexer. This allows SML-Yacc to
12219 create a TOKENS signature for use with lexers produced by ML-Lex that
12220 treats the type token abstractly. Lexers that are functors parametrized by
12221 a Tokens structure matching a TOKENS signature cannot examine the structure
12222 of tokens.
12223*)
12224
12225signature LEXER =
12226 sig
12227 structure UserDeclarations :
12228 sig
12229 type ('a,'b) token
12230 type pos
12231 type svalue
12232 end
12233 val makeLexer : (int -> string) -> unit ->
12234 (UserDeclarations.svalue,UserDeclarations.pos) UserDeclarations.token
12235 end
12236
12237(* ARG_LEXER: the %arg option of ML-Lex allows users to produce lexers which
12238 also take an argument before yielding a function from unit to a token
12239*)
12240
12241signature ARG_LEXER =
12242 sig
12243 structure UserDeclarations :
12244 sig
12245 type ('a,'b) token
12246 type pos
12247 type svalue
12248 type arg
12249 end
12250 val makeLexer : (int -> string) -> UserDeclarations.arg -> unit ->
12251 (UserDeclarations.svalue,UserDeclarations.pos) UserDeclarations.token
12252 end
12253
12254(* PARSER_DATA: the signature of ParserData structures in {parser name}LrValsFun
12255 produced by SML-Yacc. All such structures match this signature.
12256
12257 The {parser name}LrValsFun produces a structure which contains all the values
12258 except for the lexer needed to call the polymorphic parser mentioned
12259 before.
12260
12261*)
12262
12263signature PARSER_DATA =
12264 sig
12265 (* the type of line numbers *)
12266
12267 type pos
12268
12269 (* the type of semantic values *)
12270
12271 type svalue
12272
12273 (* the type of the user-supplied argument to the parser *)
12274 type arg
12275
12276 (* the intended type of the result of the parser. This value is
12277 produced by applying extract from the structure Actions to the
12278 final semantic value resultiing from a parse.
12279 *)
12280
12281 type result
12282
12283 structure LrTable : LR_TABLE
12284 structure Token : TOKEN
12285 sharing Token.LrTable = LrTable
12286
12287 (* structure Actions contains the functions which mantain the
12288 semantic values stack in the parser. Void is used to provide
12289 a default value for the semantic stack.
12290 *)
12291
12292 structure Actions :
12293 sig
12294 val actions : int * pos *
12295 (LrTable.state * (svalue * pos * pos)) list * arg->
12296 LrTable.nonterm * (svalue * pos * pos) *
12297 ((LrTable.state *(svalue * pos * pos)) list)
12298 val void : svalue
12299 val extract : svalue -> result
12300 end
12301
12302 (* structure EC contains information used to improve error
12303 recovery in an error-correcting parser *)
12304
12305 structure EC :
12306 sig
12307 val is_keyword : LrTable.term -> bool
12308 val noShift : LrTable.term -> bool
12309 val preferred_change : (LrTable.term list * LrTable.term list) list
12310 val errtermvalue : LrTable.term -> svalue
12311 val showTerminal : LrTable.term -> string
12312 val terms: LrTable.term list
12313 end
12314
12315 (* table is the LR table for the parser *)
12316
12317 val table : LrTable.table
12318 end
12319
12320(* signature PARSER is the signature that most user parsers created by
12321 SML-Yacc will match.
12322*)
12323
12324signature PARSER =
12325 sig
12326 structure Token : TOKEN
12327 structure Stream : STREAM
12328 exception ParseError
12329
12330 (* type pos is the type of line numbers *)
12331
12332 type pos
12333
12334 (* type result is the type of the result from the parser *)
12335
12336 type result
12337
12338 (* the type of the user-supplied argument to the parser *)
12339 type arg
12340
12341 (* type svalue is the type of semantic values for the semantic value
12342 stack
12343 *)
12344
12345 type svalue
12346
12347 (* val makeLexer is used to create a stream of tokens for the parser *)
12348
12349 val makeLexer : (int -> string) ->
12350 (svalue,pos) Token.token Stream.stream
12351
12352 (* val parse takes a stream of tokens and a function to print
12353 errors and returns a value of type result and a stream containing
12354 the unused tokens
12355 *)
12356
12357 val parse : int * ((svalue,pos) Token.token Stream.stream) *
12358 (string * pos * pos -> unit) * arg ->
12359 result * (svalue,pos) Token.token Stream.stream
12360
12361 val sameToken : (svalue,pos) Token.token * (svalue,pos) Token.token ->
12362 bool
12363 end
12364
12365(* signature ARG_PARSER is the signature that will be matched by parsers whose
12366 lexer takes an additional argument.
12367*)
12368
12369signature ARG_PARSER =
12370 sig
12371 structure Token : TOKEN
12372 structure Stream : STREAM
12373 exception ParseError
12374
12375 type arg
12376 type lexarg
12377 type pos
12378 type result
12379 type svalue
12380
12381 val makeLexer : (int -> string) -> lexarg ->
12382 (svalue,pos) Token.token Stream.stream
12383 val parse : int * ((svalue,pos) Token.token Stream.stream) *
12384 (string * pos * pos -> unit) * arg ->
12385 result * (svalue,pos) Token.token Stream.stream
12386
12387 val sameToken : (svalue,pos) Token.token * (svalue,pos) Token.token ->
12388 bool
12389 end
12390
12391(* stop of ml-yacc/lib/base.sig *)
12392(* start of ml-yacc/lib/join.sml *)
12393(* ML-Yacc Parser Generator (c) 1989 Andrew W. Appel, David R. Tarditi *)
12394
12395(* functor Join creates a user parser by putting together a Lexer structure,
12396 an LrValues structure, and a polymorphic parser structure. Note that
12397 the Lexer and LrValues structure must share the type pos (i.e. the type
12398 of line numbers), the type svalues for semantic values, and the type
12399 of tokens.
12400*)
12401
12402functor Join(structure Lex : LEXER
12403 structure ParserData: PARSER_DATA
12404 structure LrParser : LR_PARSER
12405 sharing ParserData.LrTable = LrParser.LrTable
12406 sharing ParserData.Token = LrParser.Token
12407 sharing type Lex.UserDeclarations.svalue = ParserData.svalue
12408 sharing type Lex.UserDeclarations.pos = ParserData.pos
12409 sharing type Lex.UserDeclarations.token = ParserData.Token.token)
12410 : PARSER =
12411struct
12412 structure Token = ParserData.Token
12413 structure Stream = LrParser.Stream
12414
12415 exception ParseError = LrParser.ParseError
12416
12417 type arg = ParserData.arg
12418 type pos = ParserData.pos
12419 type result = ParserData.result
12420 type svalue = ParserData.svalue
12421 val makeLexer = LrParser.Stream.streamify o Lex.makeLexer
12422 val parse = fn (lookahead,lexer,error,arg) =>
12423 (fn (a,b) => (ParserData.Actions.extract a,b))
12424 (LrParser.parse {table = ParserData.table,
12425 lexer=lexer,
12426 lookahead=lookahead,
12427 saction = ParserData.Actions.actions,
12428 arg=arg,
12429 void= ParserData.Actions.void,
12430 ec = {is_keyword = ParserData.EC.is_keyword,
12431 noShift = ParserData.EC.noShift,
12432 preferred_change = ParserData.EC.preferred_change,
12433 errtermvalue = ParserData.EC.errtermvalue,
12434 error=error,
12435 showTerminal = ParserData.EC.showTerminal,
12436 terms = ParserData.EC.terms}}
12437 )
12438 val sameToken = Token.sameToken
12439end
12440
12441(* functor JoinWithArg creates a variant of the parser structure produced
12442 above. In this case, the makeLexer take an additional argument before
12443 yielding a value of type unit -> (svalue,pos) token
12444 *)
12445
12446functor JoinWithArg(structure Lex : ARG_LEXER
12447 structure ParserData: PARSER_DATA
12448 structure LrParser : LR_PARSER
12449 sharing ParserData.LrTable = LrParser.LrTable
12450 sharing ParserData.Token = LrParser.Token
12451 sharing type Lex.UserDeclarations.svalue = ParserData.svalue
12452 sharing type Lex.UserDeclarations.pos = ParserData.pos
12453 sharing type Lex.UserDeclarations.token = ParserData.Token.token)
12454 : ARG_PARSER =
12455struct
12456 structure Token = ParserData.Token
12457 structure Stream = LrParser.Stream
12458
12459 exception ParseError = LrParser.ParseError
12460
12461 type arg = ParserData.arg
12462 type lexarg = Lex.UserDeclarations.arg
12463 type pos = ParserData.pos
12464 type result = ParserData.result
12465 type svalue = ParserData.svalue
12466
12467 val makeLexer = fn s => fn arg =>
12468 LrParser.Stream.streamify (Lex.makeLexer s arg)
12469 val parse = fn (lookahead,lexer,error,arg) =>
12470 (fn (a,b) => (ParserData.Actions.extract a,b))
12471 (LrParser.parse {table = ParserData.table,
12472 lexer=lexer,
12473 lookahead=lookahead,
12474 saction = ParserData.Actions.actions,
12475 arg=arg,
12476 void= ParserData.Actions.void,
12477 ec = {is_keyword = ParserData.EC.is_keyword,
12478 noShift = ParserData.EC.noShift,
12479 preferred_change = ParserData.EC.preferred_change,
12480 errtermvalue = ParserData.EC.errtermvalue,
12481 error=error,
12482 showTerminal = ParserData.EC.showTerminal,
12483 terms = ParserData.EC.terms}}
12484 )
12485 val sameToken = Token.sameToken
12486end;
12487(* stop of ml-yacc/lib/join.sml *)
12488(* start of ml-yacc/lib/lrtable.sml *)
12489(* ML-Yacc Parser Generator (c) 1989 Andrew W. Appel, David R. Tarditi *)
12490structure LrTable : LR_TABLE =
12491 struct
12492 open Array List
12493 infix 9 sub
12494 datatype ('a,'b) pairlist = EMPTY
12495 | PAIR of 'a * 'b * ('a,'b) pairlist
12496 datatype term = T of int
12497 datatype nonterm = NT of int
12498 datatype state = STATE of int
12499 datatype action = SHIFT of state
12500 | REDUCE of int (* rulenum from grammar *)
12501 | ACCEPT
12502 | ERROR
12503 exception Goto of state * nonterm
12504 type table = {states: int, rules : int,initialState: state,
12505 action: ((term,action) pairlist * action) array,
12506 goto : (nonterm,state) pairlist array}
12507 val numStates = fn ({states,...} : table) => states
12508 val numRules = fn ({rules,...} : table) => rules
12509 val describeActions =
12510 fn ({action,...} : table) =>
12511 fn (STATE s) => action sub s
12512 val describeGoto =
12513 fn ({goto,...} : table) =>
12514 fn (STATE s) => goto sub s
12515 fun findTerm (T term,row,default) =
12516 let fun find (PAIR (T key,data,r)) =
12517 if key < term then find r
12518 else if key=term then data
12519 else default
12520 | find EMPTY = default
12521 in find row
12522 end
12523 fun findNonterm (NT nt,row) =
12524 let fun find (PAIR (NT key,data,r)) =
12525 if key < nt then find r
12526 else if key=nt then SOME data
12527 else NONE
12528 | find EMPTY = NONE
12529 in find row
12530 end
12531 val action = fn ({action,...} : table) =>
12532 fn (STATE state,term) =>
12533 let val (row,default) = action sub state
12534 in findTerm(term,row,default)
12535 end
12536 val goto = fn ({goto,...} : table) =>
12537 fn (a as (STATE state,nonterm)) =>
12538 case findNonterm(nonterm,goto sub state)
12539 of SOME state => state
12540 | NONE => raise (Goto a)
12541 val initialState = fn ({initialState,...} : table) => initialState
12542 val mkLrTable = fn {actions,gotos,initialState,numStates,numRules} =>
12543 ({action=actions,goto=gotos,
12544 states=numStates,
12545 rules=numRules,
12546 initialState=initialState} : table)
12547end;
12548(* stop of ml-yacc/lib/lrtable.sml *)
12549(* start of ml-yacc/lib/stream.sml *)
12550(* ML-Yacc Parser Generator (c) 1989 Andrew W. Appel, David R. Tarditi *)
12551
12552(* Stream: a structure implementing a lazy stream. The signature STREAM
12553 is found in base.sig *)
12554
12555structure Stream :> STREAM =
12556struct
12557 datatype 'a str = EVAL of 'a * 'a str ref | UNEVAL of (unit->'a)
12558
12559 type 'a stream = 'a str ref
12560
12561 fun get(ref(EVAL t)) = t
12562 | get(s as ref(UNEVAL f)) =
12563 let val t = (f(), ref(UNEVAL f)) in s := EVAL t; t end
12564
12565 fun streamify f = ref(UNEVAL f)
12566 fun cons(a,s) = ref(EVAL(a,s))
12567
12568end;
12569(* stop of ml-yacc/lib/stream.sml *)
12570(* start of ml-yacc/lib/parser2.sml *)
12571(* ML-Yacc Parser Generator (c) 1989 Andrew W. Appel, David R. Tarditi *)
12572
12573(* parser.sml: This is a parser driver for LR tables with an error-recovery
12574 routine added to it. The routine used is described in detail in this
12575 article:
12576
12577 'A Practical Method for LR and LL Syntactic Error Diagnosis and
12578 Recovery', by M. Burke and G. Fisher, ACM Transactions on
12579 Programming Langauges and Systems, Vol. 9, No. 2, April 1987,
12580 pp. 164-197.
12581
12582 This program is an implementation is the partial, deferred method discussed
12583 in the article. The algorithm and data structures used in the program
12584 are described below.
12585
12586 This program assumes that all semantic actions are delayed. A semantic
12587 action should produce a function from unit -> value instead of producing the
12588 normal value. The parser returns the semantic value on the top of the
12589 stack when accept is encountered. The user can deconstruct this value
12590 and apply the unit -> value function in it to get the answer.
12591
12592 It also assumes that the lexer is a lazy stream.
12593
12594 Data Structures:
12595 ----------------
12596
12597 * The parser:
12598
12599 The state stack has the type
12600
12601 (state * (semantic value * line # * line #)) list
12602
12603 The parser keeps a queue of (state stack * lexer pair). A lexer pair
12604 consists of a terminal * value pair and a lexer. This allows the
12605 parser to reconstruct the states for terminals to the left of a
12606 syntax error, and attempt to make error corrections there.
12607
12608 The queue consists of a pair of lists (x,y). New additions to
12609 the queue are cons'ed onto y. The first element of x is the top
12610 of the queue. If x is nil, then y is reversed and used
12611 in place of x.
12612
12613 Algorithm:
12614 ----------
12615
12616 * The steady-state parser:
12617
12618 This parser keeps the length of the queue of state stacks at
12619 a steady state by always removing an element from the front when
12620 another element is placed on the end.
12621
12622 It has these arguments:
12623
12624 stack: current stack
12625 queue: value of the queue
12626 lexPair ((terminal,value),lex stream)
12627
12628 When SHIFT is encountered, the state to shift to and the value are
12629 are pushed onto the state stack. The state stack and lexPair are
12630 placed on the queue. The front element of the queue is removed.
12631
12632 When REDUCTION is encountered, the rule is applied to the current
12633 stack to yield a triple (nonterm,value,new stack). A new
12634 stack is formed by adding (goto(top state of stack,nonterm),value)
12635 to the stack.
12636
12637 When ACCEPT is encountered, the top value from the stack and the
12638 lexer are returned.
12639
12640 When an ERROR is encountered, fixError is called. FixError
12641 takes the arguments to the parser, fixes the error if possible and
12642 returns a new set of arguments.
12643
12644 * The distance-parser:
12645
12646 This parser includes an additional argument distance. It pushes
12647 elements on the queue until it has parsed distance tokens, or an
12648 ACCEPT or ERROR occurs. It returns a stack, lexer, the number of
12649 tokens left unparsed, a queue, and an action option.
12650*)
12651
12652signature FIFO =
12653 sig type 'a queue
12654 val empty : 'a queue
12655 exception Empty
12656 val get : 'a queue -> 'a * 'a queue
12657 val put : 'a * 'a queue -> 'a queue
12658 end
12659
12660(* drt (12/15/89) -- the functor should be used in development work, but
12661 it wastes space in the release version.
12662
12663functor ParserGen(structure LrTable : LR_TABLE
12664 structure Stream : STREAM) : LR_PARSER =
12665*)
12666
12667structure LrParser :> LR_PARSER =
12668 struct
12669 structure LrTable = LrTable
12670 structure Stream = Stream
12671
12672 structure Token : TOKEN =
12673 struct
12674 structure LrTable = LrTable
12675 datatype ('a,'b) token = TOKEN of LrTable.term * ('a * 'b * 'b)
12676 val sameToken = fn (TOKEN(t,_),TOKEN(t',_)) => t=t'
12677 end
12678
12679 open LrTable
12680 open Token
12681
12682 val DEBUG1 = false
12683 val DEBUG2 = false
12684 exception ParseError
12685 exception ParseImpossible of int
12686
12687 structure Fifo :> FIFO =
12688 struct
12689 type 'a queue = ('a list * 'a list)
12690 val empty = (nil,nil)
12691 exception Empty
12692 fun get(a::x, y) = (a, (x,y))
12693 | get(nil, nil) = raise Empty
12694 | get(nil, y) = get(rev y, nil)
12695 fun put(a,(x,y)) = (x,a::y)
12696 end
12697
12698 type ('a,'b) elem = (state * ('a * 'b * 'b))
12699 type ('a,'b) stack = ('a,'b) elem list
12700 type ('a,'b) lexv = ('a,'b) token
12701 type ('a,'b) lexpair = ('a,'b) lexv * (('a,'b) lexv Stream.stream)
12702 type ('a,'b) distanceParse =
12703 ('a,'b) lexpair *
12704 ('a,'b) stack *
12705 (('a,'b) stack * ('a,'b) lexpair) Fifo.queue *
12706 int ->
12707 ('a,'b) lexpair *
12708 ('a,'b) stack *
12709 (('a,'b) stack * ('a,'b) lexpair) Fifo.queue *
12710 int *
12711 action option
12712
12713 type ('a,'b) ecRecord =
12714 {is_keyword : term -> bool,
12715 preferred_change : (term list * term list) list,
12716 error : string * 'b * 'b -> unit,
12717 errtermvalue : term -> 'a,
12718 terms : term list,
12719 showTerminal : term -> string,
12720 noShift : term -> bool}
12721
12722 local
12723 val print = fn s => TextIO.output(TextIO.stdOut,s)
12724 val println = fn s => (print s; print "\n")
12725 val showState = fn (STATE s) => "STATE " ^ (Int.toString s)
12726 in
12727 fun printStack(stack: ('a,'b) stack, n: int) =
12728 case stack
12729 of (state,_) :: rest =>
12730 (print("\t" ^ Int.toString n ^ ": ");
12731 println(showState state);
12732 printStack(rest, n+1))
12733 | nil => ()
12734
12735 fun prAction showTerminal
12736 (stack as (state,_) :: _, next as (TOKEN (term,_),_), action) =
12737 (println "Parse: state stack:";
12738 printStack(stack, 0);
12739 print(" state="
12740 ^ showState state
12741 ^ " next="
12742 ^ showTerminal term
12743 ^ " action="
12744 );
12745 case action
12746 of SHIFT state => println ("SHIFT " ^ (showState state))
12747 | REDUCE i => println ("REDUCE " ^ (Int.toString i))
12748 | ERROR => println "ERROR"
12749 | ACCEPT => println "ACCEPT")
12750 | prAction _ (_,_,action) = ()
12751 end
12752
12753 (* ssParse: parser which maintains the queue of (state * lexvalues) in a
12754 steady-state. It takes a table, showTerminal function, saction
12755 function, and fixError function. It parses until an ACCEPT is
12756 encountered, or an exception is raised. When an error is encountered,
12757 fixError is called with the arguments of parseStep (lexv,stack,and
12758 queue). It returns the lexv, and a new stack and queue adjusted so
12759 that the lexv can be parsed *)
12760
12761 val ssParse =
12762 fn (table,showTerminal,saction,fixError,arg) =>
12763 let val prAction = prAction showTerminal
12764 val action = LrTable.action table
12765 val goto = LrTable.goto table
12766 fun parseStep(args as
12767 (lexPair as (TOKEN (terminal, value as (_,leftPos,_)),
12768 lexer
12769 ),
12770 stack as (state,_) :: _,
12771 queue)) =
12772 let val nextAction = action (state,terminal)
12773 val _ = if DEBUG1 then prAction(stack,lexPair,nextAction)
12774 else ()
12775 in case nextAction
12776 of SHIFT s =>
12777 let val newStack = (s,value) :: stack
12778 val newLexPair = Stream.get lexer
12779 val (_,newQueue) =Fifo.get(Fifo.put((newStack,newLexPair),
12780 queue))
12781 in parseStep(newLexPair,(s,value)::stack,newQueue)
12782 end
12783 | REDUCE i =>
12784 (case saction(i,leftPos,stack,arg)
12785 of (nonterm,value,stack as (state,_) :: _) =>
12786 parseStep(lexPair,(goto(state,nonterm),value)::stack,
12787 queue)
12788 | _ => raise (ParseImpossible 197))
12789 | ERROR => parseStep(fixError args)
12790 | ACCEPT =>
12791 (case stack
12792 of (_,(topvalue,_,_)) :: _ =>
12793 let val (token,restLexer) = lexPair
12794 in (topvalue,Stream.cons(token,restLexer))
12795 end
12796 | _ => raise (ParseImpossible 202))
12797 end
12798 | parseStep _ = raise (ParseImpossible 204)
12799 in parseStep
12800 end
12801
12802 (* distanceParse: parse until n tokens are shifted, or accept or
12803 error are encountered. Takes a table, showTerminal function, and
12804 semantic action function. Returns a parser which takes a lexPair
12805 (lex result * lexer), a state stack, a queue, and a distance
12806 (must be > 0) to parse. The parser returns a new lex-value, a stack
12807 with the nth token shifted on top, a queue, a distance, and action
12808 option. *)
12809
12810 val distanceParse =
12811 fn (table,showTerminal,saction,arg) =>
12812 let val prAction = prAction showTerminal
12813 val action = LrTable.action table
12814 val goto = LrTable.goto table
12815 fun parseStep(lexPair,stack,queue,0) = (lexPair,stack,queue,0,NONE)
12816 | parseStep(lexPair as (TOKEN (terminal, value as (_,leftPos,_)),
12817 lexer
12818 ),
12819 stack as (state,_) :: _,
12820 queue,distance) =
12821 let val nextAction = action(state,terminal)
12822 val _ = if DEBUG1 then prAction(stack,lexPair,nextAction)
12823 else ()
12824 in case nextAction
12825 of SHIFT s =>
12826 let val newStack = (s,value) :: stack
12827 val newLexPair = Stream.get lexer
12828 in parseStep(newLexPair,(s,value)::stack,
12829 Fifo.put((newStack,newLexPair),queue),distance-1)
12830 end
12831 | REDUCE i =>
12832 (case saction(i,leftPos,stack,arg)
12833 of (nonterm,value,stack as (state,_) :: _) =>
12834 parseStep(lexPair,(goto(state,nonterm),value)::stack,
12835 queue,distance)
12836 | _ => raise (ParseImpossible 240))
12837 | ERROR => (lexPair,stack,queue,distance,SOME nextAction)
12838 | ACCEPT => (lexPair,stack,queue,distance,SOME nextAction)
12839 end
12840 | parseStep _ = raise (ParseImpossible 242)
12841 in parseStep : ('_a,'_b) distanceParse
12842 end
12843
12844(* mkFixError: function to create fixError function which adjusts parser state
12845 so that parse may continue in the presence of an error *)
12846
12847fun mkFixError({is_keyword,terms,errtermvalue,
12848 preferred_change,noShift,
12849 showTerminal,error,...} : ('_a,'_b) ecRecord,
12850 distanceParse : ('_a,'_b) distanceParse,
12851 minAdvance,maxAdvance)
12852
12853 (lexv as (TOKEN (term,value as (_,leftPos,_)),_),stack,queue) =
12854 let val _ = if DEBUG2 then
12855 error("syntax error found at " ^ (showTerminal term),
12856 leftPos,leftPos)
12857 else ()
12858
12859 fun tokAt(t,p) = TOKEN(t,(errtermvalue t,p,p))
12860
12861 val minDelta = 3
12862
12863 (* pull all the state * lexv elements from the queue *)
12864
12865 val stateList =
12866 let fun f q = let val (elem,newQueue) = Fifo.get q
12867 in elem :: (f newQueue)
12868 end handle Fifo.Empty => nil
12869 in f queue
12870 end
12871
12872 (* now number elements of stateList, giving distance from
12873 error token *)
12874
12875 val (_, numStateList) =
12876 List.foldr (fn (a,(num,r)) => (num+1,(a,num)::r)) (0, []) stateList
12877
12878 (* Represent the set of potential changes as a linked list.
12879
12880 Values of datatype Change hold information about a potential change.
12881
12882 oper = oper to be applied
12883 pos = the # of the element in stateList that would be altered.
12884 distance = the number of tokens beyond the error token which the
12885 change allows us to parse.
12886 new = new terminal * value pair at that point
12887 orig = original terminal * value pair at the point being changed.
12888 *)
12889
12890 datatype ('a,'b) change = CHANGE of
12891 {pos : int, distance : int, leftPos: 'b, rightPos: 'b,
12892 new : ('a,'b) lexv list, orig : ('a,'b) lexv list}
12893
12894
12895 val showTerms = concat o map (fn TOKEN(t,_) => " " ^ showTerminal t)
12896
12897 val printChange = fn c =>
12898 let val CHANGE {distance,new,orig,pos,...} = c
12899 in (print ("{distance= " ^ (Int.toString distance));
12900 print (",orig ="); print(showTerms orig);
12901 print (",new ="); print(showTerms new);
12902 print (",pos= " ^ (Int.toString pos));
12903 print "}\n")
12904 end
12905
12906 val printChangeList = app printChange
12907
12908(* parse: given a lexPair, a stack, and the distance from the error
12909 token, return the distance past the error token that we are able to parse.*)
12910
12911 fun parse (lexPair,stack,queuePos : int) =
12912 case distanceParse(lexPair,stack,Fifo.empty,queuePos+maxAdvance+1)
12913 of (_,_,_,distance,SOME ACCEPT) =>
12914 if maxAdvance-distance-1 >= 0
12915 then maxAdvance
12916 else maxAdvance-distance-1
12917 | (_,_,_,distance,_) => maxAdvance - distance - 1
12918
12919(* catList: concatenate results of scanning list *)
12920
12921 fun catList l f = List.foldr (fn(a,r)=> f a @ r) [] l
12922
12923 fun keywordsDelta new = if List.exists (fn(TOKEN(t,_))=>is_keyword t) new
12924 then minDelta else 0
12925
12926 fun tryChange{lex,stack,pos,leftPos,rightPos,orig,new} =
12927 let val lex' = List.foldr (fn (t',p)=>(t',Stream.cons p)) lex new
12928 val distance = parse(lex',stack,pos+length new-length orig)
12929 in if distance >= minAdvance + keywordsDelta new
12930 then [CHANGE{pos=pos,leftPos=leftPos,rightPos=rightPos,
12931 distance=distance,orig=orig,new=new}]
12932 else []
12933 end
12934
12935
12936(* tryDelete: Try to delete n terminals.
12937 Return single-element [success] or nil.
12938 Do not delete unshiftable terminals. *)
12939
12940
12941 fun tryDelete n ((stack,lexPair as (TOKEN(term,(_,l,r)),_)),qPos) =
12942 let fun del(0,accum,left,right,lexPair) =
12943 tryChange{lex=lexPair,stack=stack,
12944 pos=qPos,leftPos=left,rightPos=right,
12945 orig=rev accum, new=[]}
12946 | del(n,accum,left,right,(tok as TOKEN(term,(_,_,r)),lexer)) =
12947 if noShift term then []
12948 else del(n-1,tok::accum,left,r,Stream.get lexer)
12949 in del(n,[],l,r,lexPair)
12950 end
12951
12952(* tryInsert: try to insert tokens before the current terminal;
12953 return a list of the successes *)
12954
12955 fun tryInsert((stack,lexPair as (TOKEN(_,(_,l,_)),_)),queuePos) =
12956 catList terms (fn t =>
12957 tryChange{lex=lexPair,stack=stack,
12958 pos=queuePos,orig=[],new=[tokAt(t,l)],
12959 leftPos=l,rightPos=l})
12960
12961(* trySubst: try to substitute tokens for the current terminal;
12962 return a list of the successes *)
12963
12964 fun trySubst ((stack,lexPair as (orig as TOKEN (term,(_,l,r)),lexer)),
12965 queuePos) =
12966 if noShift term then []
12967 else
12968 catList terms (fn t =>
12969 tryChange{lex=Stream.get lexer,stack=stack,
12970 pos=queuePos,
12971 leftPos=l,rightPos=r,orig=[orig],
12972 new=[tokAt(t,r)]})
12973
12974 (* do_delete(toks,lexPair) tries to delete tokens "toks" from "lexPair".
12975 If it succeeds, returns SOME(toks',l,r,lp), where
12976 toks' is the actual tokens (with positions and values) deleted,
12977 (l,r) are the (leftmost,rightmost) position of toks',
12978 lp is what remains of the stream after deletion
12979 *)
12980 fun do_delete(nil,lp as (TOKEN(_,(_,l,_)),_)) = SOME(nil,l,l,lp)
12981 | do_delete([t],(tok as TOKEN(t',(_,l,r)),lp')) =
12982 if t=t'
12983 then SOME([tok],l,r,Stream.get lp')
12984 else NONE
12985 | do_delete(t::rest,(tok as TOKEN(t',(_,l,r)),lp')) =
12986 if t=t'
12987 then case do_delete(rest,Stream.get lp')
12988 of SOME(deleted,l',r',lp'') =>
12989 SOME(tok::deleted,l,r',lp'')
12990 | NONE => NONE
12991 else NONE
12992
12993 fun tryPreferred((stack,lexPair),queuePos) =
12994 catList preferred_change (fn (delete,insert) =>
12995 if List.exists noShift delete then [] (* should give warning at
12996 parser-generation time *)
12997 else case do_delete(delete,lexPair)
12998 of SOME(deleted,l,r,lp) =>
12999 tryChange{lex=lp,stack=stack,pos=queuePos,
13000 leftPos=l,rightPos=r,orig=deleted,
13001 new=map (fn t=>(tokAt(t,r))) insert}
13002 | NONE => [])
13003
13004 val changes = catList numStateList tryPreferred @
13005 catList numStateList tryInsert @
13006 catList numStateList trySubst @
13007 catList numStateList (tryDelete 1) @
13008 catList numStateList (tryDelete 2) @
13009 catList numStateList (tryDelete 3)
13010
13011 val findMaxDist = fn l =>
13012 foldr (fn (CHANGE {distance,...},high) => Int.max(distance,high)) 0 l
13013
13014(* maxDist: max distance past error taken that we could parse *)
13015
13016 val maxDist = findMaxDist changes
13017
13018(* remove changes which did not parse maxDist tokens past the error token *)
13019
13020 val changes = catList changes
13021 (fn(c as CHANGE{distance,...}) =>
13022 if distance=maxDist then [c] else [])
13023
13024 in case changes
13025 of (l as change :: _) =>
13026 let fun print_msg (CHANGE {new,orig,leftPos,rightPos,...}) =
13027 let val s =
13028 case (orig,new)
13029 of (_::_,[]) => "deleting " ^ (showTerms orig)
13030 | ([],_::_) => "inserting " ^ (showTerms new)
13031 | _ => "replacing " ^ (showTerms orig) ^
13032 " with " ^ (showTerms new)
13033 in error ("syntax error: " ^ s,leftPos,rightPos)
13034 end
13035
13036 val _ =
13037 (if length l > 1 andalso DEBUG2 then
13038 (print "multiple fixes possible; could fix it by:\n";
13039 app print_msg l;
13040 print "chosen correction:\n")
13041 else ();
13042 print_msg change)
13043
13044 (* findNth: find nth queue entry from the error
13045 entry. Returns the Nth queue entry and the portion of
13046 the queue from the beginning to the nth-1 entry. The
13047 error entry is at the end of the queue.
13048
13049 Examples:
13050
13051 queue = a b c d e
13052 findNth 0 = (e,a b c d)
13053 findNth 1 = (d,a b c)
13054 *)
13055
13056 val findNth = fn n =>
13057 let fun f (h::t,0) = (h,rev t)
13058 | f (h::t,n) = f(t,n-1)
13059 | f (nil,_) = let exception FindNth
13060 in raise FindNth
13061 end
13062 in f (rev stateList,n)
13063 end
13064
13065 val CHANGE {pos,orig,new,...} = change
13066 val (last,queueFront) = findNth pos
13067 val (stack,lexPair) = last
13068
13069 val lp1 = foldl(fn (_,(_,r)) => Stream.get r) lexPair orig
13070 val lp2 = foldr(fn(t,r)=>(t,Stream.cons r)) lp1 new
13071
13072 val restQueue =
13073 Fifo.put((stack,lp2),
13074 foldl Fifo.put Fifo.empty queueFront)
13075
13076 val (lexPair,stack,queue,_,_) =
13077 distanceParse(lp2,stack,restQueue,pos)
13078
13079 in (lexPair,stack,queue)
13080 end
13081 | nil => (error("syntax error found at " ^ (showTerminal term),
13082 leftPos,leftPos); raise ParseError)
13083 end
13084
13085 val parse = fn {arg,table,lexer,saction,void,lookahead,
13086 ec=ec as {showTerminal,...} : ('_a,'_b) ecRecord} =>
13087 let val distance = 15 (* defer distance tokens *)
13088 val minAdvance = 1 (* must parse at least 1 token past error *)
13089 val maxAdvance = Int.max(lookahead,0)(* max distance for parse check *)
13090 val lexPair = Stream.get lexer
13091 val (TOKEN (_,(_,leftPos,_)),_) = lexPair
13092 val startStack = [(initialState table,(void,leftPos,leftPos))]
13093 val startQueue = Fifo.put((startStack,lexPair),Fifo.empty)
13094 val distanceParse = distanceParse(table,showTerminal,saction,arg)
13095 val fixError = mkFixError(ec,distanceParse,minAdvance,maxAdvance)
13096 val ssParse = ssParse(table,showTerminal,saction,fixError,arg)
13097 fun loop (lexPair,stack,queue,_,SOME ACCEPT) =
13098 ssParse(lexPair,stack,queue)
13099 | loop (lexPair,stack,queue,0,_) = ssParse(lexPair,stack,queue)
13100 | loop (lexPair,stack,queue,distance,SOME ERROR) =
13101 let val (lexPair,stack,queue) = fixError(lexPair,stack,queue)
13102 in loop (distanceParse(lexPair,stack,queue,distance))
13103 end
13104 | loop _ = let exception ParseInternal
13105 in raise ParseInternal
13106 end
13107 in loop (distanceParse(lexPair,startStack,startQueue,distance))
13108 end
13109 end;
13110
13111(* stop of ml-yacc/lib/parser2.sml *)
13112(* start of DERIVED_FORMS_CORE.sml *)
13113(*
13114 * Standard ML core derived forms
13115 *
13116 * Definition, Section 2.7 and appendix A
13117 *
13118 * Note:
13119 * Two phrases named Fmatch and Fmrule have been added to factorize FvalBind.
13120 *)
13121
13122
13123signature DERIVED_FORMS_CORE =
13124 sig
13125
13126 (* Import *)
13127
13128 type Info = GrammarCore.Info
13129
13130 type Lab = GrammarCore.Lab
13131 type VId = GrammarCore.VId
13132
13133 type Op = GrammarCore.Op
13134 type AtExp = GrammarCore.AtExp
13135 type AppExp = GrammarCore.AtExp list
13136 type InfExp = GrammarCore.Exp
13137 type Exp = GrammarCore.Exp
13138 type Match = GrammarCore.Match
13139 type Mrule = GrammarCore.Mrule
13140 type Dec = GrammarCore.Dec
13141 type ValBind = GrammarCore.ValBind
13142 type FvalBind = GrammarCore.ValBind
13143 type Fmatch = GrammarCore.Match * VId * int
13144 type Fmrule = GrammarCore.Mrule * VId * int
13145 type TypBind = GrammarCore.TypBind
13146 type DatBind = GrammarCore.DatBind
13147 type AtPat = GrammarCore.AtPat
13148 type PatRow = GrammarCore.PatRow
13149 type Pat = GrammarCore.Pat
13150 type Ty = GrammarCore.Ty
13151 type TyVarseq = GrammarCore.TyVarseq
13152
13153
13154 (* Expressions [Figure 15] *)
13155
13156 val UNITAtExp: Info -> AtExp
13157 val TUPLEAtExp: Info * Exp list -> AtExp
13158 val HASHAtExp: Info * Lab -> AtExp
13159 val CASEExp: Info * Exp * Match -> Exp
13160 val IFExp: Info * Exp * Exp * Exp -> Exp
13161 val ANDALSOExp: Info * Exp * Exp -> Exp
13162 val ORELSEExp: Info * Exp * Exp -> Exp
13163 val SEQAtExp: Info * Exp list -> AtExp
13164 val LETAtExp: Info * Dec * Exp list -> AtExp
13165 val WHILEExp: Info * Exp * Exp -> Exp
13166 val LISTAtExp: Info * Exp list -> AtExp
13167
13168 (* Patterns [Figure 16] *)
13169
13170 val UNITAtPat: Info -> AtPat
13171 val TUPLEAtPat: Info * Pat list -> AtPat
13172 val LISTAtPat: Info * Pat list -> AtPat
13173
13174 val VIDPatRow: Info * VId * Ty option * Pat option * PatRow option
13175 -> PatRow
13176 (* Types [Figure 16] *)
13177
13178 val TUPLETy: Info * Ty list -> Ty
13179
13180 (* Function-value bindings [Figure 17] *)
13181
13182 val FvalBind: Info * Fmatch * FvalBind option -> FvalBind
13183 val Fmatch: Info * Fmrule * Fmatch option -> Fmatch
13184 val Fmrule: Info * Op * VId * AtPat list * Ty option * Exp -> Fmrule
13185
13186 (* Declarations [Figure 17] *)
13187
13188 val FUNDec: Info * TyVarseq * FvalBind -> Dec
13189 val DATATYPEDec: Info * DatBind * TypBind option -> Dec
13190 val ABSTYPEDec: Info * DatBind * TypBind option * Dec -> Dec
13191
13192 end
13193(* stop of DERIVED_FORMS_CORE.sml *)
13194(* start of DerivedFormsCore.sml *)
13195(*
13196 * Standard ML core derived forms
13197 *
13198 * Definition, Section 2.7 and appendix A
13199 *
13200 * Notes:
13201 * - Two phrases named Fmatch and Fmrule have been added to factorize FvalBind.
13202 * - In Fvalbinds we do not enforce that all optional type annotations are
13203 * syntactically identical (as the Definition enforces, although this seems
13204 * to be a mistake).
13205 * - The Definition is somewhat inaccurate about the derived forms of Exp
13206 * [Definition, Appendix A, Figure 15] in that most forms are actually AtExp
13207 * derived forms, as can be seen from the full grammar [Definition,
13208 * Appendix B, Figure 20]. To achieve consistency, the equivalent forms must
13209 * be put in parentheses in some cases.
13210 * - The same goes for pattern derived forms [Definition, Appendix A, Figure 16;
13211 * Appendix B, Figure 22].
13212 *)
13213
13214
13215structure DerivedFormsCore :> DERIVED_FORMS_CORE =
13216 struct
13217
13218 (* Import *)
13219
13220 structure C = GrammarCore
13221
13222 type Info = C.Info
13223
13224 type Lab = C.Lab
13225 type VId = C.VId
13226
13227 type Op = C.Op
13228 type AtExp = C.AtExp
13229 type AppExp = C.AtExp list
13230 type InfExp = C.Exp
13231 type Exp = C.Exp
13232 type Match = C.Match
13233 type Mrule = C.Mrule
13234 type Dec = C.Dec
13235 type ValBind = C.ValBind
13236 type FvalBind = C.ValBind
13237 type Fmatch = C.Match * C.VId * int
13238 type Fmrule = C.Mrule * C.VId * int
13239 type TypBind = C.TypBind
13240 type DatBind = C.DatBind
13241 type AtPat = C.AtPat
13242 type PatRow = C.PatRow
13243 type Pat = C.Pat
13244 type Ty = C.Ty
13245 type TyVarseq = C.TyVarseq
13246
13247
13248 (* Some helpers *)
13249
13250 val vidFALSE = VId.fromString "false"
13251 val vidTRUE = VId.fromString "true"
13252 val vidNIL = VId.fromString "nil"
13253 val vidCONS = VId.fromString "::"
13254
13255 val longvidCONS = LongVId.fromId vidCONS
13256
13257
13258 fun LONGVIDExp(I, longvid) = C.ATEXPExp(I, C.LONGVIDAtExp(I, C.SANSOp,
13259 longvid))
13260 fun LONGVIDPat(I, longvid) = C.ATPATPat(I, C.LONGVIDAtPat(I, C.SANSOp,
13261 longvid))
13262
13263 fun VIDExp(I, vid) = LONGVIDExp(I, LongVId.fromId vid)
13264 fun VIDPat(I, vid) = LONGVIDPat(I, LongVId.fromId vid)
13265
13266 fun FALSEExp(I) = VIDExp(I, vidFALSE)
13267 fun TRUEExp(I) = VIDExp(I, vidTRUE)
13268 fun NILExp(I) = VIDExp(I, vidNIL)
13269 fun CONSExp(I) = VIDExp(I, vidCONS)
13270
13271 fun FALSEPat(I) = VIDPat(I, vidFALSE)
13272 fun TRUEPat(I) = VIDPat(I, vidTRUE)
13273 fun NILPat(I) = VIDPat(I, vidNIL)
13274
13275
13276 (* Rewriting of withtype declarations [Appendix A, 2nd bullet] *)
13277
13278 fun lookupTyCon(tycon, C.TypBind(_, tyvarseq, tycon', ty, typbind_opt)) =
13279 if tycon' = tycon then
13280 (tyvarseq, ty)
13281 else
13282 lookupTyCon(tycon, Option.valOf typbind_opt)
13283 (* may raise Option *)
13284
13285
13286 fun replaceTy (C.TyVarseq(_,tyvars), C.Tyseq(i',tys)) (C.TYVARTy(i,tyvar)) =
13287 let
13288 fun loop(tyvar'::tyvars', ty'::tys') =
13289 if tyvar' = tyvar then
13290 ty'
13291 else
13292 loop(tyvars', tys')
13293 | loop([],_) =
13294 Error.error(i, "unbound type variable")
13295 | loop(_,[]) =
13296 Error.error(i', "type sequence has wrong arity")
13297 in
13298 loop(tyvars, tys)
13299 end
13300
13301 | replaceTy tyvarseq_tyseq (C.RECORDTy(I, tyrow_opt)) =
13302 C.RECORDTy(I, Option.map (replaceTyRow tyvarseq_tyseq) tyrow_opt)
13303
13304 | replaceTy tyvarseq_tyseq (C.TYCONTy(I, tyseq', tycon)) =
13305 C.TYCONTy(I, replaceTyseq tyvarseq_tyseq tyseq', tycon)
13306
13307 | replaceTy tyvarseq_tyseq (C.ARROWTy(I, ty1, ty2)) =
13308 C.ARROWTy(I, replaceTy tyvarseq_tyseq ty1,
13309 replaceTy tyvarseq_tyseq ty2)
13310
13311 | replaceTy tyvarseq_tyseq (C.PARTy(I, ty)) =
13312 C.PARTy(I, replaceTy tyvarseq_tyseq ty)
13313
13314 and replaceTyRow tyvarseq_tyseq (C.TyRow(I, lab, ty, tyrow_opt)) =
13315 C.TyRow(I, lab, replaceTy tyvarseq_tyseq ty,
13316 Option.map (replaceTyRow tyvarseq_tyseq) tyrow_opt)
13317
13318 and replaceTyseq tyvarseq_tyseq (C.Tyseq(I, tys)) =
13319 C.Tyseq(I, List.map (replaceTy tyvarseq_tyseq) tys)
13320
13321
13322 fun rewriteTy typbind (ty as C.TYVARTy _) = ty
13323
13324 | rewriteTy typbind (C.RECORDTy(I, tyrow_opt)) =
13325 C.RECORDTy(I, Option.map (rewriteTyRow typbind) tyrow_opt)
13326
13327 | rewriteTy typbind (C.TYCONTy(I, tyseq, longtycon)) =
13328 let
13329 val tyseq' = rewriteTyseq typbind tyseq
13330 val (strids, tycon) = LongTyCon.explode longtycon
13331 in
13332 if not(List.null strids) then
13333 C.TYCONTy(I, tyseq', longtycon)
13334 else
13335 let
13336 val (tyvarseq', ty') = lookupTyCon(tycon, typbind)
13337 in
13338 replaceTy (tyvarseq',tyseq') ty'
13339 end
13340 handle Option => C.TYCONTy(I, tyseq', longtycon)
13341 end
13342
13343 | rewriteTy typbind (C.ARROWTy(I, ty1, ty2)) =
13344 C.ARROWTy(I, rewriteTy typbind ty1, rewriteTy typbind ty2)
13345
13346 | rewriteTy typbind (C.PARTy(I, ty)) =
13347 C.PARTy(I, rewriteTy typbind ty)
13348
13349 and rewriteTyRow typbind (C.TyRow(I, lab, ty, tyrow_opt)) =
13350 C.TyRow(I, lab, rewriteTy typbind ty,
13351 Option.map (rewriteTyRow typbind) tyrow_opt)
13352
13353 and rewriteTyseq typbind (C.Tyseq(I, tys)) =
13354 C.Tyseq(I, List.map (rewriteTy typbind) tys)
13355
13356 fun rewriteConBind typbind (C.ConBind(I, op_opt, vid, ty_opt, conbind_opt))=
13357 C.ConBind(I, op_opt, vid,
13358 Option.map (rewriteTy typbind) ty_opt,
13359 Option.map (rewriteConBind typbind) conbind_opt)
13360
13361 fun rewriteDatBind typbind (C.DatBind(I, tyvarseq, tycon, conbind,
13362 datbind_opt)) =
13363 C.DatBind(I, tyvarseq, tycon, rewriteConBind typbind conbind,
13364 Option.map (rewriteDatBind typbind) datbind_opt)
13365
13366
13367 (* Patterns [Figure 16] *)
13368
13369 fun UNITAtPat(I) = C.RECORDAtPat(I, NONE)
13370
13371 fun TUPLEAtPat(I, [pat]) = C.PARAtPat(I, pat)
13372 | TUPLEAtPat(I, pats) =
13373 let
13374 fun toPatRow(n, [] ) = NONE
13375 | toPatRow(n, pat::pats') =
13376 SOME(C.ROWPatRow(I, Lab.fromInt n, pat, toPatRow(n+1,pats')))
13377 in
13378 C.RECORDAtPat(I, toPatRow(1, pats))
13379 end
13380
13381 fun LISTAtPat(I, pats) =
13382 let
13383 fun toPatList [] = NILPat(I)
13384 | toPatList(pat::pats') =
13385 C.CONPat(I, C.SANSOp, longvidCONS,
13386 TUPLEAtPat(I, [pat,toPatList pats']))
13387 in
13388 C.PARAtPat(I, toPatList pats)
13389 end
13390
13391
13392 (* Pattern Rows [Figure 16] *)
13393
13394 fun VIDPatRow(I, vid, ty_opt, pat_opt, patrow_opt) =
13395 let
13396 val lab = Lab.fromString(VId.toString vid)
13397 val vidPat = VIDPat(I, vid)
13398 val pat =
13399 case (ty_opt, pat_opt)
13400 of (NONE, NONE) => vidPat
13401 | (SOME ty, NONE) => C.TYPEDPat(I, vidPat, ty)
13402 | ( _ , SOME pat) => C.ASPat(I, C.SANSOp,vid,ty_opt,pat)
13403 in
13404 C.ROWPatRow(I, lab, pat, patrow_opt)
13405 end
13406
13407
13408 (* Expressions [Figure 15] *)
13409
13410 fun UNITAtExp(I) = C.RECORDAtExp(I, NONE)
13411
13412 fun TUPLEAtExp(I, [exp]) = C.PARAtExp(I, exp)
13413 | TUPLEAtExp(I, exps) =
13414 let
13415 fun toExpRow(n, [] ) = NONE
13416 | toExpRow(n, exp::exps') =
13417 SOME(C.ExpRow(I, Lab.fromInt n, exp, toExpRow(n+1, exps')))
13418 in
13419 C.RECORDAtExp(I, toExpRow(1, exps))
13420 end
13421
13422 fun HASHAtExp(I, lab) =
13423 let
13424 val vid = VId.invent()
13425 val dots = C.WILDCARDPatRow(I)
13426 val patrow = C.ROWPatRow(I, lab, VIDPat(I, vid), SOME dots)
13427 val pat = C.ATPATPat(I, C.RECORDAtPat(I, SOME patrow))
13428 val mrule = C.Mrule(I, pat, VIDExp(I, vid))
13429 val match = C.Match(I, mrule, NONE)
13430 in
13431 C.PARAtExp(I, C.FNExp(I, match))
13432 end
13433
13434 fun CASEExp(I, exp, match) =
13435 let
13436 val function = C.ATEXPExp(I, C.PARAtExp(I, C.FNExp(I, match)))
13437 in
13438 C.APPExp(I, function, C.PARAtExp(I, exp))
13439 end
13440
13441 fun IFExp(I, exp1, exp2, exp3) =
13442 let
13443 val mruleTrue = C.Mrule(I, TRUEPat(I), exp2)
13444 val mruleFalse = C.Mrule(I, FALSEPat(I), exp3)
13445 val matchFalse = C.Match(I, mruleFalse, NONE)
13446 val matchTrue = C.Match(I, mruleTrue, SOME matchFalse)
13447 in
13448 CASEExp(I, exp1, matchTrue)
13449 end
13450
13451 fun ORELSEExp (I, exp1, exp2) = IFExp(I, exp1, TRUEExp(I), exp2)
13452
13453 fun ANDALSOExp(I, exp1, exp2) = IFExp(I, exp1, exp2, FALSEExp(I))
13454
13455 fun SEQAtExp(I, exps) =
13456 let
13457 val wildcard = C.ATPATPat(I, C.WILDCARDAtPat(I))
13458
13459 fun toExpSeq [] = raise Fail "DerivedFormsCore.SEQAtExp: \
13460 \empty exp list"
13461 | toExpSeq [exp] = exp
13462 | toExpSeq(exp::exps') =
13463 let
13464 val mrule = C.Mrule(I, wildcard, toExpSeq exps')
13465 val match = C.Match(I, mrule, NONE)
13466 in
13467 CASEExp(I, exp, match)
13468 end
13469 in
13470 C.PARAtExp(I, toExpSeq exps)
13471 end
13472
13473 fun LETAtExp(I, dec, [exp]) = C.LETAtExp(I, dec, exp)
13474 | LETAtExp(I, dec, exps) =
13475 C.LETAtExp(I, dec, C.ATEXPExp(I, SEQAtExp(I, exps)))
13476
13477 fun WHILEExp(I, exp1, exp2) =
13478 let
13479 val vid = VId.invent()
13480 val vidExp = VIDExp(I, vid)
13481 val unitAtExp = UNITAtExp(I)
13482 val unitExp = C.ATEXPExp(I, unitAtExp)
13483 val callVid = C.APPExp(I, vidExp, unitAtExp)
13484
13485 val seqExp = C.ATEXPExp(I, SEQAtExp(I, [exp2, callVid]))
13486 val fnBody = IFExp(I, exp1, seqExp, unitExp)
13487 val mrule = C.Mrule(I, C.ATPATPat(I, UNITAtPat(I)), fnBody)
13488 val match = C.Match(I, mrule, NONE)
13489 val fnExp = C.FNExp(I, match)
13490 val fnBind = C.PLAINValBind(I, VIDPat(I, vid), fnExp, NONE)
13491 val valbind = C.RECValBind(I, fnBind)
13492 val dec = C.VALDec(I, C.TyVarseq(I, []), valbind)
13493 in
13494 C.ATEXPExp(I, C.LETAtExp(I, dec, callVid))
13495 end
13496
13497 fun LISTAtExp(I, exps) =
13498 let
13499 fun toExpList [] = NILExp(I)
13500 | toExpList(exp::exps') =
13501 C.APPExp(I, CONSExp(I), TUPLEAtExp(I, [exp, toExpList exps']))
13502 in
13503 C.PARAtExp(I, toExpList exps)
13504 end
13505
13506
13507 (* Type Expressions [Figure 16] *)
13508
13509 fun TUPLETy(I, [ty]) = ty
13510 | TUPLETy(I, tys) =
13511 let
13512 fun toTyRow(n, [] ) = NONE
13513 | toTyRow(n, ty::tys') =
13514 SOME(C.TyRow(I, Lab.fromInt n, ty, toTyRow(n+1, tys')))
13515 in
13516 C.RECORDTy(I, toTyRow(1, tys))
13517 end
13518
13519
13520 (* Function-value Bindings [Figure 17] *)
13521
13522 fun FvalBind(I, (match, vid, arity), fvalbind_opt) =
13523 let
13524 fun abstract(0, vidExps) =
13525 let
13526 val exp = C.ATEXPExp(I, TUPLEAtExp(I, List.rev vidExps))
13527 in
13528 CASEExp(I, exp, match)
13529 end
13530
13531 | abstract(n, vidExps) =
13532 let
13533 val vid = VId.invent()
13534 val exp = VIDExp(I, vid)
13535 val pat = VIDPat(I, vid)
13536 val mrule = C.Mrule(I, pat, abstract(n-1, exp::vidExps))
13537 in
13538 C.FNExp(I, C.Match(I, mrule, NONE))
13539 end
13540
13541 val exp = abstract(arity, [])
13542 val pat = VIDPat(I, vid)
13543 in
13544 C.PLAINValBind(I, pat, exp, fvalbind_opt)
13545 end
13546
13547
13548 fun Fmatch(I, (mrule, vid, arity), NONE) =
13549 ( C.Match(I, mrule, NONE), vid, arity )
13550
13551 | Fmatch(I, (mrule, vid, arity), SOME(match, vid', arity')) =
13552 if vid <> vid' then
13553 Error.error(I, "inconsistent function identifier")
13554 else if arity <> arity' then
13555 Error.error(I, "inconsistent function arity")
13556 else
13557 ( C.Match(I, mrule, SOME match), vid, arity )
13558
13559
13560 fun Fmrule(I, _, vid, atpats, ty_opt, exp) =
13561 let
13562 val pats = List.map (fn atpat => C.ATPATPat(I, atpat)) atpats
13563 val pat' = C.ATPATPat(I, TUPLEAtPat(I, pats))
13564 val exp' = case ty_opt
13565 of NONE => exp
13566 | SOME ty => C.TYPEDExp(I, exp, ty)
13567 val arity = List.length atpats
13568 in
13569 ( C.Mrule(I, pat', exp'), vid, arity )
13570 end
13571
13572
13573 (* Declarations [Figure 17] *)
13574
13575 fun FUNDec(I, tyvarseq, fvalbind) =
13576 C.VALDec(I, tyvarseq, C.RECValBind(I, fvalbind))
13577
13578 fun DATATYPEDec(I, datbind, NONE) = C.DATATYPEDec(I, datbind)
13579 | DATATYPEDec(I, datbind, SOME typbind) =
13580 let
13581 val datbind' = rewriteDatBind typbind datbind
13582 in
13583 C.SEQDec(I, C.DATATYPEDec(C.infoDatBind datbind, datbind'),
13584 C.TYPEDec(C.infoTypBind typbind, typbind))
13585 end
13586
13587 fun ABSTYPEDec(I, datbind, NONE, dec) = C.ABSTYPEDec(I, datbind,dec)
13588 | ABSTYPEDec(I, datbind, SOME typbind, dec) =
13589 let
13590 val I' = C.infoTypBind typbind
13591 val datbind' = rewriteDatBind typbind datbind
13592 in
13593 C.ABSTYPEDec(I, datbind', C.SEQDec(I, C.TYPEDec(I', typbind), dec))
13594 end
13595
13596 end
13597(* stop of DerivedFormsCore.sml *)
13598(* start of DERIVED_FORMS_MODULE.sml *)
13599(*
13600 * Standard ML modules derived forms
13601 *
13602 * Definition, Appendix A
13603 *
13604 * Notes:
13605 * - A phrase named SynDesc has been added to factorize type synonym
13606 * specifications.
13607 * - Similarly, a phrase named TyReaDesc has been added to factorize type
13608 * realisation signature expressions.
13609 * - The structure sharing derived form is missing since it cannot be resolved
13610 * syntactically. It has been moved to the bare grammar.
13611 *)
13612
13613
13614signature DERIVED_FORMS_MODULE =
13615 sig
13616
13617 (* Import *)
13618
13619 type Info = GrammarModule.Info
13620
13621 type VId = GrammarCore.VId
13622 type TyCon = GrammarCore.TyCon
13623 type StrId = GrammarCore.StrId
13624 type SigId = GrammarModule.SigId
13625 type FunId = GrammarModule.FunId
13626 type longTyCon = GrammarCore.longTyCon
13627
13628 type Ty = GrammarCore.Ty
13629 type TyVarseq = GrammarCore.TyVarseq
13630
13631 type StrExp = GrammarModule.StrExp
13632 type StrDec = GrammarModule.StrDec
13633 type StrBind = GrammarModule.StrBind
13634 type SigExp = GrammarModule.SigExp
13635 type TyReaDesc = (Info * TyVarseq * longTyCon * Ty) list
13636 type Spec = GrammarModule.Spec
13637 type SynDesc = (Info * TyVarseq * TyCon * Ty) list
13638 type FunBind = GrammarModule.FunBind
13639
13640
13641 (* Structure Bindings [Figure 18] *)
13642
13643 val TRANSStrBind: Info * StrId * SigExp option * StrExp
13644 * StrBind option -> StrBind
13645 val OPAQStrBind: Info * StrId * SigExp * StrExp
13646 * StrBind option -> StrBind
13647
13648 (* Structure Expressions [Figure 18] *)
13649
13650 val APPDECStrExp: Info * FunId * StrDec -> StrExp
13651
13652 (* Functor Bindings [Figure 18] *)
13653
13654 val TRANSFunBind: Info * FunId * StrId * SigExp * SigExp option
13655 * StrExp * FunBind option -> FunBind
13656 val OPAQFunBind: Info * FunId * StrId * SigExp * SigExp
13657 * StrExp * FunBind option -> FunBind
13658 val TRANSSPECFunBind: Info * FunId * Spec * SigExp option
13659 * StrExp * FunBind option -> FunBind
13660 val OPAQSPECFunBind: Info * FunId * Spec * SigExp
13661 * StrExp * FunBind option -> FunBind
13662
13663 (* Specifications [Figure 19] *)
13664
13665 val SYNSpec: Info * SynDesc -> Spec
13666 val INCLUDEMULTISpec: Info * SigId list -> Spec
13667
13668 val SynDesc: Info * TyVarseq * TyCon * Ty
13669 * SynDesc option -> SynDesc
13670
13671 (* Signature Expressions [Figure 19] *)
13672
13673 val WHERETYPESigExp: Info * SigExp * TyReaDesc -> SigExp
13674
13675 val TyReaDesc: Info * TyVarseq * longTyCon * Ty
13676 * TyReaDesc option -> TyReaDesc
13677 end
13678(* stop of DERIVED_FORMS_MODULE.sml *)
13679(* start of DerivedFormsModule.sml *)
13680(*
13681 * Standard ML modules derived forms
13682 *
13683 * Definition, Appendix A
13684 *
13685 * Notes:
13686 * - A phrase named SynDesc has been added to factorize type synonym
13687 * specifications.
13688 * - Similarly, a phrase named TyReaDesc has been added to factorize type
13689 * realisation signature expressions.
13690 * - The structure sharing derived form is missing since it cannot be resolved
13691 * syntactically. It has been moved to the bare grammar.
13692 *)
13693
13694
13695structure DerivedFormsModule :> DERIVED_FORMS_MODULE =
13696 struct
13697
13698 (* Import *)
13699
13700 structure C = GrammarCore
13701 structure M = GrammarModule
13702
13703 type Info = M.Info
13704
13705 type VId = M.VId
13706 type TyCon = M.TyCon
13707 type StrId = M.StrId
13708 type SigId = M.SigId
13709 type FunId = M.FunId
13710 type longTyCon = M.longTyCon
13711
13712 type Ty = M.Ty
13713 type TyVarseq = M.TyVarseq
13714
13715 type StrExp = M.StrExp
13716 type StrDec = M.StrDec
13717 type StrBind = M.StrBind
13718 type SigExp = M.SigExp
13719 type TyReaDesc = (M.Info * M.TyVarseq * M.longTyCon * M.Ty) list
13720 type Spec = M.Spec
13721 type SynDesc = (M.Info * M.TyVarseq * M.TyCon * M.Ty) list
13722 type FunBind = M.FunBind
13723
13724
13725 (* Structure Bindings [Figure 18] *)
13726
13727 fun TRANSStrBind(I, strid, NONE, strexp, strbind_opt) =
13728 M.StrBind(I, strid, strexp, strbind_opt)
13729
13730 | TRANSStrBind(I, strid, SOME sigexp, strexp, strbind_opt) =
13731 M.StrBind(I, strid, M.TRANSStrExp(I, strexp, sigexp), strbind_opt)
13732
13733 fun OPAQStrBind(I, strid, sigexp, strexp, strbind_opt) =
13734 M.StrBind(I, strid, M.OPAQStrExp(I, strexp, sigexp), strbind_opt)
13735
13736
13737 (* Structure Expressions [Figure 18] *)
13738
13739 fun APPDECStrExp(I, funid, strdec) =
13740 M.APPStrExp(I, funid, M.STRUCTStrExp(M.infoStrDec strdec, strdec))
13741
13742
13743 (* Functor Bindings [Figure 18] *)
13744
13745 fun TRANSFunBind(I, funid, strid, sigexp, NONE, strexp, funbind_opt) =
13746 M.FunBind(I, funid, strid, sigexp, strexp, funbind_opt)
13747
13748 | TRANSFunBind(I, funid, strid,sigexp, SOME sigexp', strexp, funbind_opt)=
13749 M.FunBind(I, funid, strid, sigexp, M.TRANSStrExp(I, strexp,sigexp'),
13750 funbind_opt)
13751
13752 fun OPAQFunBind(I, funid, strid, sigexp, sigexp', strexp, funbind_opt) =
13753 M.FunBind(I, funid, strid, sigexp, M.OPAQStrExp(I, strexp, sigexp'),
13754 funbind_opt)
13755
13756
13757 fun TRANSSPECFunBind(I, funid, spec, sigexp_opt, strexp, funbind_opt) =
13758 let
13759 val I' = M.infoStrExp strexp
13760 val strid = StrId.invent()
13761 val sigexp = M.SIGSigExp(M.infoSpec spec, spec)
13762
13763 val strdec = M.DECStrDec(I', C.OPENDec(I',[LongStrId.fromId strid]))
13764 val strexp'= case sigexp_opt
13765 of NONE => strexp
13766 | SOME sigexp' => M.TRANSStrExp(I', strexp, sigexp')
13767 val letexp = M.LETStrExp(I', strdec, strexp')
13768 in
13769 M.FunBind(I, funid, strid, sigexp, letexp, funbind_opt)
13770 end
13771
13772 fun OPAQSPECFunBind(I, funid, spec, sigexp', strexp, funbind_opt) =
13773 let
13774 val I' = M.infoStrExp strexp
13775 val strid = StrId.invent()
13776 val sigexp = M.SIGSigExp(M.infoSpec spec, spec)
13777
13778 val strdec = M.DECStrDec(I', C.OPENDec(I',[LongStrId.fromId strid]))
13779 val strexp'= M.TRANSStrExp(I', strexp, sigexp')
13780 val letexp = M.LETStrExp(I', strdec, strexp')
13781 in
13782 M.FunBind(I, funid, strid, sigexp, letexp, funbind_opt)
13783 end
13784
13785
13786 (* Specifications [Figure 19] *)
13787
13788 fun SYNSpec(I, []) = M.EMPTYSpec(I)
13789 | SYNSpec(I, (I',tyvarseq,tycon,ty)::syns') =
13790 let
13791 val longtycon = LongTyCon.fromId tycon
13792 val typdesc = M.TypDesc(I', tyvarseq, tycon, NONE)
13793 val sigexp = M.SIGSigExp(I', M.TYPESpec(I', typdesc))
13794 val sigexp' = M.WHERETYPESigExp(I', sigexp, tyvarseq, longtycon, ty)
13795 val spec1 = M.INCLUDESpec(I', sigexp')
13796 in
13797 M.SEQSpec(I, spec1, SYNSpec(I, syns'))
13798 end
13799
13800 fun INCLUDEMULTISpec(I, [] ) = M.EMPTYSpec(I)
13801 | INCLUDEMULTISpec(I, sigid::sigids') =
13802 let
13803 val spec1 = M.INCLUDESpec(I, M.SIGIDSigExp(I, sigid))
13804 in
13805 M.SEQSpec(I, spec1, INCLUDEMULTISpec(I, sigids'))
13806 end
13807
13808
13809 fun SynDesc(I, tyvarseq, tycon, ty, NONE) =
13810 (I, tyvarseq, tycon, ty) :: []
13811
13812 | SynDesc(I, tyvarseq, tycon, ty, SOME syndesc) =
13813 (I, tyvarseq, tycon, ty) :: syndesc
13814
13815
13816 (* Signature Expressions [Figure 19] *)
13817
13818 fun WHERETYPESigExp(I, sigexp, [] ) = sigexp
13819 | WHERETYPESigExp(I, sigexp, (I',tyvarseq,longtycon,ty)::reas') =
13820 let
13821 val sigexp' = M.WHERETYPESigExp(I', sigexp, tyvarseq, longtycon, ty)
13822 in
13823 WHERETYPESigExp(I, sigexp', reas')
13824 end
13825
13826
13827 fun TyReaDesc(I, tyvarseq, longtycon, ty, NONE) =
13828 (I, tyvarseq, longtycon, ty) :: []
13829
13830 | TyReaDesc(I, tyvarseq, longtycon, ty, SOME tyreadesc) =
13831 (I, tyvarseq, longtycon, ty) :: tyreadesc
13832
13833 end
13834(* stop of DerivedFormsModule.sml *)
13835(* start of DERIVED_FORMS_PROGRAM.sml *)
13836(*
13837 * Standard ML program derived forms
13838 *
13839 * Definition, Appendix A
13840 *)
13841
13842
13843signature DERIVED_FORMS_PROGRAM =
13844 sig
13845
13846 (* Import *)
13847
13848 type Info = GrammarProgram.Info
13849
13850 type Exp = GrammarCore.Exp
13851 type TopDec = GrammarModule.TopDec
13852 type Program = GrammarProgram.Program
13853
13854
13855 (* Programs [Figure 18] *)
13856
13857 val TOPDECProgram: Info * TopDec * Program option -> Program
13858 val EXPProgram: Info * Exp * Program option -> Program
13859
13860 end
13861(* stop of DERIVED_FORMS_PROGRAM.sml *)
13862(* start of DerivedFormsProgram.sml *)
13863(*
13864 * Standard ML program derived forms
13865 *
13866 * Definition, Appendix A
13867 *)
13868
13869
13870structure DerivedFormsProgram :> DERIVED_FORMS_PROGRAM =
13871 struct
13872
13873 (* Import *)
13874
13875 structure C = GrammarCore
13876 structure M = GrammarModule
13877 structure P = GrammarProgram
13878
13879 type Info = GrammarProgram.Info
13880
13881 type Exp = GrammarCore.Exp
13882 type TopDec = GrammarModule.TopDec
13883 type Program = GrammarProgram.Program
13884
13885
13886 (* Programs [Figure 18] *)
13887
13888 fun TOPDECProgram(I, topdec, program_opt) =
13889 P.Program(I, topdec, program_opt)
13890
13891 fun EXPProgram(I, exp, program_opt) =
13892 let
13893 val longvid = LongVId.fromId(VId.fromString "it")
13894 val pat = C.ATPATPat(I, C.LONGVIDAtPat(I, C.SANSOp, longvid))
13895 val valbind = C.PLAINValBind(I, pat, exp, NONE)
13896 val dec = C.VALDec(I, C.TyVarseq(I, []), valbind)
13897 val topdec = M.STRDECTopDec(I, M.DECStrDec(I, dec), NONE)
13898 in
13899 P.Program(I, topdec, program_opt)
13900 end
13901
13902 end
13903(* stop of DerivedFormsProgram.sml *)
13904(* start of Parser.grm.sig *)
13905signature Parser_TOKENS =
13906sig
13907type ('a,'b) token
13908type svalue
13909val LONGID: (string list*string) * 'a * 'a -> (svalue,'a) token
13910val ETYVAR: (string) * 'a * 'a -> (svalue,'a) token
13911val TYVAR: (string) * 'a * 'a -> (svalue,'a) token
13912val STAR: 'a * 'a -> (svalue,'a) token
13913val SYMBOL: (string) * 'a * 'a -> (svalue,'a) token
13914val ALPHA: (string) * 'a * 'a -> (svalue,'a) token
13915val CHAR: (char) * 'a * 'a -> (svalue,'a) token
13916val STRING: (string) * 'a * 'a -> (svalue,'a) token
13917val REAL: (real) * 'a * 'a -> (svalue,'a) token
13918val WORD: (word) * 'a * 'a -> (svalue,'a) token
13919val INT: (int) * 'a * 'a -> (svalue,'a) token
13920val NUMERIC: (int) * 'a * 'a -> (svalue,'a) token
13921val DIGIT: (int) * 'a * 'a -> (svalue,'a) token
13922val ZERO: 'a * 'a -> (svalue,'a) token
13923val COLONGREATER: 'a * 'a -> (svalue,'a) token
13924val WHERE: 'a * 'a -> (svalue,'a) token
13925val STRUCTURE: 'a * 'a -> (svalue,'a) token
13926val STRUCT: 'a * 'a -> (svalue,'a) token
13927val SIGNATURE: 'a * 'a -> (svalue,'a) token
13928val SIG: 'a * 'a -> (svalue,'a) token
13929val SHARING: 'a * 'a -> (svalue,'a) token
13930val INCLUDE: 'a * 'a -> (svalue,'a) token
13931val FUNCTOR: 'a * 'a -> (svalue,'a) token
13932val EQTYPE: 'a * 'a -> (svalue,'a) token
13933val HASH: 'a * 'a -> (svalue,'a) token
13934val ARROW: 'a * 'a -> (svalue,'a) token
13935val DARROW: 'a * 'a -> (svalue,'a) token
13936val EQUALS: 'a * 'a -> (svalue,'a) token
13937val BAR: 'a * 'a -> (svalue,'a) token
13938val UNDERBAR: 'a * 'a -> (svalue,'a) token
13939val DOTS: 'a * 'a -> (svalue,'a) token
13940val SEMICOLON: 'a * 'a -> (svalue,'a) token
13941val COLON: 'a * 'a -> (svalue,'a) token
13942val COMMA: 'a * 'a -> (svalue,'a) token
13943val RBRACE: 'a * 'a -> (svalue,'a) token
13944val LBRACE: 'a * 'a -> (svalue,'a) token
13945val RBRACK: 'a * 'a -> (svalue,'a) token
13946val LBRACK: 'a * 'a -> (svalue,'a) token
13947val RPAR: 'a * 'a -> (svalue,'a) token
13948val LPAR: 'a * 'a -> (svalue,'a) token
13949val WHILE: 'a * 'a -> (svalue,'a) token
13950val WITHTYPE: 'a * 'a -> (svalue,'a) token
13951val WITH: 'a * 'a -> (svalue,'a) token
13952val VAL: 'a * 'a -> (svalue,'a) token
13953val TYPE: 'a * 'a -> (svalue,'a) token
13954val THEN: 'a * 'a -> (svalue,'a) token
13955val REC: 'a * 'a -> (svalue,'a) token
13956val RAISE: 'a * 'a -> (svalue,'a) token
13957val ORELSE: 'a * 'a -> (svalue,'a) token
13958val OPEN: 'a * 'a -> (svalue,'a) token
13959val OP: 'a * 'a -> (svalue,'a) token
13960val OF: 'a * 'a -> (svalue,'a) token
13961val NONFIX: 'a * 'a -> (svalue,'a) token
13962val LOCAL: 'a * 'a -> (svalue,'a) token
13963val LET: 'a * 'a -> (svalue,'a) token
13964val INFIXR: 'a * 'a -> (svalue,'a) token
13965val INFIX: 'a * 'a -> (svalue,'a) token
13966val IN: 'a * 'a -> (svalue,'a) token
13967val IF: 'a * 'a -> (svalue,'a) token
13968val HANDLE: 'a * 'a -> (svalue,'a) token
13969val FUN: 'a * 'a -> (svalue,'a) token
13970val FN: 'a * 'a -> (svalue,'a) token
13971val EXCEPTION: 'a * 'a -> (svalue,'a) token
13972val END: 'a * 'a -> (svalue,'a) token
13973val ELSE: 'a * 'a -> (svalue,'a) token
13974val DATATYPE: 'a * 'a -> (svalue,'a) token
13975val DO: 'a * 'a -> (svalue,'a) token
13976val CASE: 'a * 'a -> (svalue,'a) token
13977val AS: 'a * 'a -> (svalue,'a) token
13978val ANDALSO: 'a * 'a -> (svalue,'a) token
13979val AND: 'a * 'a -> (svalue,'a) token
13980val ABSTYPE: 'a * 'a -> (svalue,'a) token
13981val EOF: 'a * 'a -> (svalue,'a) token
13982end
13983signature Parser_LRVALS=
13984sig
13985structure Tokens : Parser_TOKENS
13986structure ParserData:PARSER_DATA
13987sharing type ParserData.Token.token = Tokens.token
13988sharing type ParserData.svalue = Tokens.svalue
13989end
13990(* stop of Parser.grm.sig *)
13991(* start of Parser.grm.sml *)
13992functor LrValsFn(structure Token: TOKEN) =
13993struct
13994structure ParserData=
13995struct
13996structure Header =
13997struct
13998(* *)
13999(* Standard ML syntactical analysis *)
14000(* *)
14001(* Definition, sections 2, 3, and 8, Appendix A and B *)
14002(* *)
14003(* Notes: *)
14004(* - Two phrases named Fmatch and Fmrule have been added to factorize *)
14005(* Fvalbind. *)
14006(* - A phrase named SynDesc has been added to factorize type synonym *)
14007(* specifications. Similarly, a phrase named TyReaDesc has been added to *)
14008(* factorize type realisation signature expressions. *)
14009(* - Infix expressions [Definition, section 2.6] are resolved externally in *)
14010(* structure Infix. The parser just maintains the infix environment J by *)
14011(* side effect. To achieve correct treatment of scoped fixity directives, *)
14012(* a stack of environments is used. To handle `local' we even need a *)
14013(* second environment J' (together with a a second stack). *)
14014(* - Syntactic restrictions [Definition, sections 2.9 and 3.5] are checked *)
14015(* during elaboration, as well as the Fvalbind derived form. *)
14016(* - The Definition is not clear about whether `=' should also be legal as *)
14017(* a tycon. Since this would result in massive conflicts, and a type named *)
14018(* `=' could only be used legally if an implementation would be mad enough *)
14019(* to predefine it anyway, we simply disallow it. *)
14020(* - The Definition is also vague about what consists a non-infixed occurance *)
14021(* of an infix identifier: we assume any occurances in expressions *)
14022(* or patterns. This implies that uses of the keyword `op' in constructor *)
14023(* and exception bindings are completely redundant. *)
14024(* - Datatype replication requires rules for datatype to be duplicated to *)
14025(* avoid conflicts on empty tyvarseqs. *)
14026(* - Layered patterns require some grammar transformation hack, see pat. *)
14027(* - The messy `sigexp where type ... and type ...' syntax requires some *)
14028(* really ugly transformations (in absence of a lookahead of 2), watch out *)
14029(* for non-terminals of the form xxx__AND_yyybind_opt. *)
14030(* - ML-Yacc does not seem to like comments that stretch over several *)
14031(* lines... Similarly, comments in semantic actions make it puke... *)
14032(* *)
14033(* Bugs: *)
14034(* - We do NOT support declarations like *)
14035(* fun f p1 = case e1 of p2 => e2 *)
14036(* | f p3 = e3 *)
14037(* (without parentheses around the case) because the transformations *)
14038(* required to support this would be even a magnitude uglier than those *)
14039(* above. In fact, no compiler I know of supports this. *)
14040(* *)
14041
14042
14043
14044 (* Import *)
14045
14046 open GrammarCore
14047 open GrammarModule
14048 open GrammarProgram
14049 open DerivedFormsCore
14050 open DerivedFormsModule
14051 open DerivedFormsProgram
14052
14053
14054 (* Helper to build info fields *)
14055
14056 fun I(left, right) = if right = 0 then (left, left) else (left, right)
14057
14058
14059 (* Handling infix environments *)
14060
14061 val J = ref Infix.empty (* context *)
14062 val J' = ref Infix.empty (* local environment (+ enclosing one) *)
14063
14064 val stackJ = ref [] : Infix.InfEnv list ref
14065 val stackJ' = ref [] : Infix.InfEnv list ref
14066
14067 fun initJandJ'(J0) =
14068 (
14069 J := J0;
14070 J' := J0;
14071 stackJ := [];
14072 stackJ' := []
14073 )
14074
14075 fun pushJ() =
14076 (
14077 stackJ := !J :: !stackJ
14078 )
14079
14080 fun popJ() =
14081 (
14082 J := List.hd(!stackJ);
14083 stackJ := List.tl(!stackJ)
14084 )
14085
14086 fun pushJ'shiftJ() =
14087 (
14088 stackJ' := !J' :: !stackJ';
14089 J' := List.hd(!stackJ)
14090 )
14091
14092 fun popJandJ'() =
14093 (
14094 J := !J';
14095 J' := List.hd(!stackJ');
14096 stackJ := List.tl(!stackJ);
14097 stackJ' := List.tl(!stackJ')
14098 )
14099
14100
14101 fun assignInfix(infstatus, vids) =
14102 (
14103 J := Infix.assign(!J, vids, infstatus);
14104 J' := Infix.assign(!J', vids, infstatus)
14105 )
14106
14107 fun cancelInfix(vids) =
14108 (
14109 J := Infix.cancel(!J, vids);
14110 J' := Infix.cancel(!J', vids)
14111 )
14112
14113
14114 (* Helper for long identifiers *)
14115
14116 fun toLongId toId (strids, id) =
14117 ( List.map StrId.fromString strids, toId id )
14118
14119
14120 (* Helper to handle typed patterns (needed because of layered patterns) *)
14121
14122 fun typedPat(pat, [] ) = pat
14123 | typedPat(pat, ty::tys) =
14124 let
14125 val I = Source.over(infoPat pat, infoTy ty)
14126 in
14127 typedPat(TYPEDPat(I, pat, ty), tys)
14128 end
14129
14130
14131
14132
14133end
14134structure LrTable = Token.LrTable
14135structure Token = Token
14136local open LrTable in
14137val table=let val actionRows =
14138"\
14139\\001\000\001\000\000\000\000\000\
14140\\001\000\001\000\184\003\002\000\049\000\006\000\048\000\008\000\047\000\
14141\\011\000\046\000\012\000\045\000\013\000\044\000\015\000\043\000\
14142\\017\000\042\000\018\000\041\000\019\000\040\000\020\000\039\000\
14143\\021\000\038\000\023\000\037\000\024\000\036\000\026\000\035\000\
14144\\029\000\034\000\030\000\033\000\033\000\032\000\034\000\031\000\
14145\\036\000\030\000\038\000\029\000\042\000\174\003\046\000\151\002\
14146\\049\000\028\000\051\000\027\000\055\000\026\000\057\000\025\000\
14147\\060\000\024\000\061\000\023\000\062\000\022\000\063\000\021\000\
14148\\064\000\020\000\065\000\019\000\066\000\018\000\067\000\017\000\
14149\\068\000\151\002\069\000\151\002\070\000\151\002\073\000\151\002\000\000\
14150\\001\000\002\000\139\002\003\000\139\002\008\000\139\002\010\000\139\002\
14151\\011\000\139\002\013\000\139\002\016\000\139\002\017\000\139\002\
14152\\018\000\139\002\020\000\139\002\021\000\139\002\024\000\139\002\
14153\\029\000\139\002\030\000\139\002\034\000\141\002\035\000\139\002\
14154\\041\000\139\002\042\000\139\002\051\000\139\002\055\000\139\002\
14155\\057\000\139\002\059\000\139\002\000\000\
14156\\001\000\002\000\178\002\003\000\178\002\004\000\178\002\007\000\178\002\
14157\\008\000\178\002\009\000\178\002\010\000\178\002\011\000\178\002\
14158\\013\000\178\002\014\000\178\002\016\000\178\002\017\000\178\002\
14159\\018\000\178\002\019\000\040\000\020\000\178\002\021\000\178\002\
14160\\022\000\178\002\023\000\037\000\024\000\178\002\025\000\178\002\
14161\\028\000\178\002\029\000\178\002\030\000\178\002\034\000\031\000\
14162\\035\000\178\002\036\000\030\000\037\000\178\002\038\000\029\000\
14163\\039\000\178\002\040\000\178\002\041\000\178\002\042\000\178\002\
14164\\045\000\178\002\046\000\151\002\049\000\028\000\051\000\178\002\
14165\\055\000\178\002\057\000\178\002\060\000\024\000\061\000\023\000\
14166\\062\000\022\000\063\000\021\000\064\000\020\000\065\000\019\000\
14167\\066\000\018\000\067\000\017\000\068\000\151\002\069\000\151\002\
14168\\070\000\151\002\073\000\151\002\000\000\
14169\\001\000\002\000\034\003\003\000\034\003\004\000\034\003\005\000\034\003\
14170\\007\000\034\003\008\000\034\003\009\000\034\003\010\000\034\003\
14171\\011\000\034\003\013\000\034\003\014\000\034\003\016\000\034\003\
14172\\017\000\034\003\018\000\034\003\020\000\034\003\021\000\034\003\
14173\\022\000\034\003\024\000\034\003\025\000\034\003\028\000\034\003\
14174\\029\000\034\003\030\000\034\003\031\000\034\003\032\000\034\003\
14175\\035\000\034\003\037\000\034\003\039\000\034\003\040\000\034\003\
14176\\041\000\034\003\042\000\034\003\045\000\034\003\046\000\034\003\
14177\\047\000\034\003\048\000\034\003\050\000\034\003\051\000\034\003\
14178\\052\000\034\003\053\000\034\003\055\000\034\003\057\000\034\003\
14179\\058\000\034\003\059\000\034\003\068\000\045\003\069\000\045\003\
14180\\070\000\248\000\073\000\045\003\000\000\
14181\\001\000\002\000\075\003\003\000\148\001\008\000\075\003\010\000\075\003\
14182\\011\000\075\003\013\000\075\003\016\000\075\003\017\000\075\003\
14183\\018\000\075\003\020\000\075\003\021\000\075\003\024\000\075\003\
14184\\029\000\075\003\030\000\075\003\035\000\075\003\041\000\056\003\
14185\\042\000\075\003\051\000\075\003\055\000\075\003\057\000\075\003\
14186\\059\000\056\003\000\000\
14187\\001\000\002\000\075\003\003\000\148\001\008\000\075\003\010\000\075\003\
14188\\011\000\075\003\013\000\075\003\016\000\075\003\017\000\075\003\
14189\\018\000\075\003\020\000\075\003\021\000\075\003\024\000\075\003\
14190\\029\000\075\003\030\000\075\003\035\000\075\003\041\000\086\003\
14191\\042\000\075\003\051\000\075\003\055\000\075\003\057\000\075\003\
14192\\058\000\086\003\059\000\086\003\000\000\
14193\\001\000\002\000\075\003\003\000\097\002\008\000\075\003\010\000\075\003\
14194\\011\000\075\003\013\000\075\003\016\000\075\003\017\000\075\003\
14195\\018\000\075\003\020\000\075\003\021\000\075\003\024\000\075\003\
14196\\029\000\075\003\030\000\075\003\035\000\075\003\041\000\101\003\
14197\\042\000\075\003\051\000\075\003\055\000\075\003\057\000\075\003\
14198\\058\000\101\003\059\000\101\003\000\000\
14199\\001\000\002\000\093\003\003\000\086\001\008\000\093\003\011\000\093\003\
14200\\013\000\093\003\017\000\093\003\018\000\093\003\020\000\093\003\
14201\\021\000\093\003\024\000\093\003\029\000\093\003\030\000\093\003\
14202\\042\000\093\003\051\000\093\003\055\000\093\003\057\000\093\003\
14203\\058\000\086\003\000\000\
14204\\001\000\002\000\093\003\003\000\077\002\008\000\093\003\011\000\093\003\
14205\\013\000\093\003\017\000\093\003\018\000\093\003\020\000\093\003\
14206\\021\000\093\003\024\000\093\003\029\000\093\003\030\000\093\003\
14207\\042\000\093\003\051\000\093\003\055\000\093\003\057\000\093\003\
14208\\058\000\101\003\000\000\
14209\\001\000\002\000\164\003\003\000\032\002\008\000\164\003\011\000\164\003\
14210\\013\000\164\003\017\000\164\003\018\000\164\003\020\000\164\003\
14211\\021\000\164\003\024\000\164\003\029\000\164\003\030\000\164\003\
14212\\041\000\056\003\042\000\164\003\051\000\164\003\055\000\164\003\
14213\\057\000\164\003\059\000\056\003\000\000\
14214\\001\000\002\000\164\003\003\000\032\002\008\000\164\003\011\000\164\003\
14215\\013\000\164\003\017\000\164\003\018\000\164\003\020\000\164\003\
14216\\021\000\164\003\024\000\164\003\029\000\164\003\030\000\164\003\
14217\\041\000\086\003\042\000\164\003\051\000\164\003\055\000\164\003\
14218\\057\000\164\003\058\000\086\003\059\000\086\003\000\000\
14219\\001\000\002\000\164\003\003\000\108\002\008\000\164\003\011\000\164\003\
14220\\013\000\164\003\017\000\164\003\018\000\164\003\020\000\164\003\
14221\\021\000\164\003\024\000\164\003\029\000\164\003\030\000\164\003\
14222\\041\000\101\003\042\000\164\003\051\000\164\003\055\000\164\003\
14223\\057\000\164\003\058\000\101\003\059\000\101\003\000\000\
14224\\001\000\002\000\049\000\006\000\048\000\008\000\047\000\011\000\046\000\
14225\\012\000\045\000\013\000\044\000\015\000\043\000\017\000\042\000\
14226\\018\000\041\000\019\000\040\000\020\000\039\000\021\000\038\000\
14227\\023\000\037\000\024\000\036\000\026\000\035\000\029\000\034\000\
14228\\030\000\033\000\033\000\032\000\034\000\031\000\036\000\030\000\
14229\\038\000\029\000\042\000\174\003\046\000\151\002\049\000\028\000\
14230\\051\000\027\000\055\000\026\000\057\000\025\000\060\000\024\000\
14231\\061\000\023\000\062\000\022\000\063\000\021\000\064\000\020\000\
14232\\065\000\019\000\066\000\018\000\067\000\017\000\068\000\151\002\
14233\\069\000\151\002\070\000\151\002\073\000\151\002\000\000\
14234\\001\000\003\000\005\002\008\000\152\003\010\000\152\003\011\000\152\003\
14235\\029\000\152\003\030\000\152\003\035\000\152\003\050\000\152\003\
14236\\052\000\152\003\053\000\152\003\057\000\152\003\058\000\086\003\000\000\
14237\\001\000\003\000\101\002\008\000\152\003\010\000\152\003\011\000\152\003\
14238\\029\000\152\003\030\000\152\003\035\000\152\003\050\000\152\003\
14239\\052\000\152\003\053\000\152\003\057\000\152\003\058\000\101\003\000\000\
14240\\001\000\004\000\059\000\007\000\183\000\014\000\058\000\025\000\057\000\
14241\\041\000\056\000\000\000\
14242\\001\000\004\000\059\000\009\000\131\001\014\000\058\000\025\000\057\000\
14243\\041\000\056\000\000\000\
14244\\001\000\004\000\059\000\014\000\058\000\022\000\242\000\025\000\057\000\
14245\\041\000\056\000\000\000\
14246\\001\000\004\000\059\000\014\000\058\000\025\000\057\000\028\000\224\000\
14247\\041\000\056\000\000\000\
14248\\001\000\004\000\059\000\014\000\058\000\025\000\057\000\035\000\180\000\
14249\\040\000\179\000\041\000\056\000\042\000\178\000\000\000\
14250\\001\000\004\000\059\000\014\000\058\000\025\000\057\000\041\000\056\000\
14251\\042\000\055\000\000\000\
14252\\001\000\005\000\133\002\039\000\133\002\040\000\133\002\041\000\133\002\
14253\\046\000\126\002\000\000\
14254\\001\000\005\000\134\002\039\000\134\002\040\000\134\002\041\000\134\002\
14255\\046\000\127\002\000\000\
14256\\001\000\005\000\135\002\039\000\135\002\040\000\135\002\041\000\135\002\
14257\\046\000\128\002\000\000\
14258\\001\000\005\000\012\003\035\000\029\003\037\000\029\003\039\000\029\003\
14259\\040\000\029\003\041\000\186\000\046\000\029\003\047\000\029\003\000\000\
14260\\001\000\005\000\013\003\023\000\144\002\034\000\144\002\035\000\144\002\
14261\\036\000\144\002\037\000\144\002\038\000\144\002\039\000\144\002\
14262\\040\000\144\002\041\000\031\001\044\000\144\002\046\000\144\002\
14263\\047\000\144\002\060\000\144\002\061\000\144\002\062\000\144\002\
14264\\063\000\144\002\064\000\144\002\065\000\144\002\066\000\144\002\
14265\\067\000\144\002\068\000\144\002\069\000\144\002\070\000\144\002\
14266\\073\000\144\002\000\000\
14267\\001\000\005\000\118\001\000\000\
14268\\001\000\006\000\048\000\012\000\045\000\015\000\043\000\019\000\040\000\
14269\\023\000\037\000\026\000\035\000\033\000\032\000\034\000\031\000\
14270\\036\000\030\000\037\000\163\002\038\000\029\000\046\000\151\002\
14271\\049\000\028\000\060\000\024\000\061\000\023\000\062\000\022\000\
14272\\063\000\021\000\064\000\020\000\065\000\019\000\066\000\018\000\
14273\\067\000\017\000\068\000\151\002\069\000\151\002\070\000\151\002\
14274\\073\000\151\002\000\000\
14275\\001\000\008\000\233\001\068\000\067\000\069\000\066\000\070\000\065\000\000\000\
14276\\001\000\010\000\157\001\000\000\
14277\\001\000\010\000\198\001\000\000\
14278\\001\000\010\000\238\001\000\000\
14279\\001\000\010\000\020\002\000\000\
14280\\001\000\010\000\027\002\000\000\
14281\\001\000\010\000\070\002\000\000\
14282\\001\000\010\000\072\002\000\000\
14283\\001\000\016\000\045\001\000\000\
14284\\001\000\016\000\047\001\000\000\
14285\\001\000\016\000\190\001\000\000\
14286\\001\000\016\000\251\001\000\000\
14287\\001\000\019\000\081\001\056\000\080\001\068\000\079\001\073\000\118\000\000\000\
14288\\001\000\023\000\037\000\034\000\142\000\035\000\018\003\036\000\107\000\
14289\\037\000\018\003\038\000\106\000\039\000\018\003\040\000\018\003\
14290\\044\000\105\000\046\000\018\003\047\000\018\003\060\000\024\000\
14291\\061\000\023\000\062\000\022\000\063\000\021\000\064\000\020\000\
14292\\065\000\019\000\066\000\018\000\067\000\017\000\068\000\151\002\
14293\\069\000\151\002\070\000\151\002\073\000\151\002\000\000\
14294\\001\000\023\000\037\000\034\000\142\000\035\000\026\003\036\000\107\000\
14295\\037\000\026\003\038\000\106\000\039\000\026\003\040\000\026\003\
14296\\041\000\026\003\044\000\105\000\046\000\026\003\047\000\026\003\
14297\\060\000\024\000\061\000\023\000\062\000\022\000\063\000\021\000\
14298\\064\000\020\000\065\000\019\000\066\000\018\000\067\000\017\000\
14299\\068\000\151\002\069\000\151\002\070\000\151\002\073\000\151\002\000\000\
14300\\001\000\023\000\037\000\034\000\142\000\036\000\107\000\037\000\003\003\
14301\\038\000\106\000\044\000\105\000\060\000\024\000\061\000\023\000\
14302\\062\000\022\000\063\000\021\000\064\000\020\000\065\000\019\000\
14303\\066\000\018\000\067\000\017\000\068\000\151\002\069\000\151\002\
14304\\070\000\151\002\073\000\151\002\000\000\
14305\\001\000\029\000\096\001\068\000\071\000\073\000\118\000\000\000\
14306\\001\000\029\000\155\001\000\000\
14307\\001\000\029\000\160\001\000\000\
14308\\001\000\029\000\160\001\068\000\074\000\000\000\
14309\\001\000\029\000\162\001\068\000\071\000\073\000\118\000\000\000\
14310\\001\000\029\000\024\002\000\000\
14311\\001\000\029\000\024\002\068\000\071\000\000\000\
14312\\001\000\029\000\040\002\000\000\
14313\\001\000\029\000\040\002\068\000\071\000\000\000\
14314\\001\000\029\000\088\002\000\000\
14315\\001\000\029\000\088\002\068\000\077\000\000\000\
14316\\001\000\031\000\066\001\000\000\
14317\\001\000\034\000\113\000\068\000\150\000\069\000\149\000\071\000\104\000\000\000\
14318\\001\000\034\000\173\000\000\000\
14319\\001\000\034\000\151\001\000\000\
14320\\001\000\035\000\181\000\000\000\
14321\\001\000\035\000\182\000\000\000\
14322\\001\000\035\000\038\001\000\000\
14323\\001\000\035\000\040\001\040\000\039\001\000\000\
14324\\001\000\035\000\041\001\000\000\
14325\\001\000\035\000\071\001\000\000\
14326\\001\000\035\000\073\001\040\000\072\001\000\000\
14327\\001\000\035\000\090\001\000\000\
14328\\001\000\035\000\217\001\058\000\082\001\000\000\
14329\\001\000\035\000\246\001\000\000\
14330\\001\000\035\000\249\001\041\000\248\001\059\000\247\001\000\000\
14331\\001\000\037\000\177\000\000\000\
14332\\001\000\037\000\037\001\000\000\
14333\\001\000\039\000\174\000\000\000\
14334\\001\000\039\000\033\001\000\000\
14335\\001\000\039\000\069\001\000\000\
14336\\001\000\041\000\070\001\000\000\
14337\\001\000\041\000\091\001\000\000\
14338\\001\000\041\000\150\001\059\000\149\001\000\000\
14339\\001\000\041\000\166\001\000\000\
14340\\001\000\041\000\173\001\000\000\
14341\\001\000\041\000\034\002\059\000\033\002\000\000\
14342\\001\000\042\000\050\000\000\000\
14343\\001\000\043\000\200\000\061\000\083\000\062\000\082\000\068\000\199\000\
14344\\069\000\198\000\070\000\197\000\000\000\
14345\\001\000\046\000\068\000\068\000\067\000\069\000\066\000\070\000\065\000\
14346\\073\000\064\000\000\000\
14347\\001\000\046\000\122\000\068\000\067\000\069\000\066\000\070\000\065\000\000\000\
14348\\001\000\046\000\172\000\000\000\
14349\\001\000\046\000\175\000\000\000\
14350\\001\000\046\000\187\000\000\000\
14351\\001\000\046\000\241\000\000\000\
14352\\001\000\046\000\255\000\000\000\
14353\\001\000\046\000\035\001\000\000\
14354\\001\000\046\000\043\001\000\000\
14355\\001\000\046\000\050\001\000\000\
14356\\001\000\046\000\059\001\000\000\
14357\\001\000\046\000\065\001\000\000\
14358\\001\000\046\000\083\001\058\000\082\001\000\000\
14359\\001\000\046\000\167\001\000\000\
14360\\001\000\046\000\177\001\000\000\
14361\\001\000\046\000\215\001\000\000\
14362\\001\000\046\000\223\001\000\000\
14363\\001\000\046\000\227\001\000\000\
14364\\001\000\046\000\230\001\000\000\
14365\\001\000\046\000\001\002\058\000\082\001\000\000\
14366\\001\000\046\000\029\002\000\000\
14367\\001\000\046\000\030\002\000\000\
14368\\001\000\046\000\036\002\000\000\
14369\\001\000\046\000\063\002\058\000\082\001\000\000\
14370\\001\000\046\000\083\002\000\000\
14371\\001\000\046\000\084\002\000\000\
14372\\001\000\046\000\089\002\000\000\
14373\\001\000\046\000\103\002\000\000\
14374\\001\000\047\000\233\000\000\000\
14375\\001\000\054\000\003\001\068\000\074\000\000\000\
14376\\001\000\058\000\087\001\000\000\
14377\\001\000\058\000\006\002\000\000\
14378\\001\000\061\000\083\000\062\000\082\000\068\000\081\000\069\000\080\000\
14379\\070\000\079\000\000\000\
14380\\001\000\068\000\067\000\069\000\066\000\070\000\065\000\000\000\
14381\\001\000\068\000\067\000\069\000\066\000\070\000\065\000\073\000\064\000\000\000\
14382\\001\000\068\000\067\000\069\000\066\000\070\000\065\000\073\000\192\000\000\000\
14383\\001\000\068\000\071\000\000\000\
14384\\001\000\068\000\071\000\073\000\118\000\000\000\
14385\\001\000\068\000\074\000\000\000\
14386\\001\000\068\000\077\000\000\000\
14387\\001\000\068\000\150\000\069\000\149\000\000\000\
14388\\001\000\068\000\150\000\069\000\149\000\073\000\247\000\000\000\
14389\\001\000\071\000\104\000\000\000\
14390\\111\002\000\000\
14391\\112\002\000\000\
14392\\113\002\000\000\
14393\\113\002\041\000\248\001\059\000\247\001\000\000\
14394\\114\002\000\000\
14395\\115\002\000\000\
14396\\116\002\000\000\
14397\\117\002\000\000\
14398\\118\002\000\000\
14399\\119\002\000\000\
14400\\120\002\000\000\
14401\\121\002\000\000\
14402\\122\002\000\000\
14403\\123\002\000\000\
14404\\124\002\000\000\
14405\\125\002\000\000\
14406\\126\002\000\000\
14407\\127\002\000\000\
14408\\128\002\000\000\
14409\\129\002\000\000\
14410\\130\002\000\000\
14411\\131\002\000\000\
14412\\132\002\000\000\
14413\\133\002\000\000\
14414\\134\002\000\000\
14415\\135\002\000\000\
14416\\136\002\000\000\
14417\\137\002\000\000\
14418\\138\002\000\000\
14419\\139\002\000\000\
14420\\140\002\000\000\
14421\\141\002\000\000\
14422\\142\002\000\000\
14423\\143\002\000\000\
14424\\144\002\000\000\
14425\\145\002\000\000\
14426\\145\002\041\000\186\000\000\000\
14427\\146\002\000\000\
14428\\147\002\000\000\
14429\\148\002\000\000\
14430\\149\002\000\000\
14431\\150\002\000\000\
14432\\151\002\006\000\048\000\012\000\045\000\015\000\043\000\019\000\040\000\
14433\\023\000\037\000\026\000\035\000\033\000\032\000\034\000\031\000\
14434\\035\000\093\000\036\000\030\000\038\000\029\000\049\000\028\000\
14435\\060\000\024\000\061\000\023\000\062\000\022\000\063\000\021\000\
14436\\064\000\020\000\065\000\019\000\066\000\018\000\067\000\017\000\000\000\
14437\\151\002\006\000\048\000\012\000\045\000\015\000\043\000\019\000\040\000\
14438\\023\000\037\000\026\000\035\000\033\000\032\000\034\000\031\000\
14439\\036\000\030\000\038\000\029\000\049\000\028\000\060\000\024\000\
14440\\061\000\023\000\062\000\022\000\063\000\021\000\064\000\020\000\
14441\\065\000\019\000\066\000\018\000\067\000\017\000\000\000\
14442\\151\002\008\000\063\001\023\000\037\000\000\000\
14443\\151\002\023\000\037\000\000\000\
14444\\151\002\023\000\037\000\027\000\109\000\034\000\108\000\036\000\107\000\
14445\\038\000\106\000\044\000\105\000\060\000\024\000\061\000\023\000\
14446\\062\000\022\000\063\000\021\000\064\000\020\000\065\000\019\000\
14447\\066\000\018\000\067\000\017\000\071\000\104\000\000\000\
14448\\151\002\023\000\037\000\027\000\109\000\034\000\142\000\036\000\107\000\
14449\\038\000\106\000\044\000\105\000\060\000\024\000\061\000\023\000\
14450\\062\000\022\000\063\000\021\000\064\000\020\000\065\000\019\000\
14451\\066\000\018\000\067\000\017\000\000\000\
14452\\151\002\023\000\037\000\034\000\108\000\036\000\107\000\038\000\106\000\
14453\\044\000\105\000\060\000\024\000\061\000\023\000\062\000\022\000\
14454\\063\000\021\000\064\000\020\000\065\000\019\000\066\000\018\000\
14455\\067\000\017\000\071\000\104\000\000\000\
14456\\151\002\023\000\037\000\034\000\142\000\035\000\208\000\036\000\107\000\
14457\\038\000\106\000\044\000\105\000\060\000\024\000\061\000\023\000\
14458\\062\000\022\000\063\000\021\000\064\000\020\000\065\000\019\000\
14459\\066\000\018\000\067\000\017\000\000\000\
14460\\151\002\023\000\037\000\034\000\142\000\035\000\208\000\036\000\107\000\
14461\\038\000\106\000\044\000\105\000\060\000\024\000\061\000\023\000\
14462\\062\000\022\000\063\000\021\000\064\000\020\000\065\000\019\000\
14463\\066\000\018\000\067\000\017\000\071\000\104\000\000\000\
14464\\151\002\023\000\037\000\034\000\142\000\036\000\107\000\038\000\106\000\
14465\\044\000\105\000\060\000\024\000\061\000\023\000\062\000\022\000\
14466\\063\000\021\000\064\000\020\000\065\000\019\000\066\000\018\000\
14467\\067\000\017\000\000\000\
14468\\152\002\000\000\
14469\\153\002\000\000\
14470\\154\002\000\000\
14471\\155\002\000\000\
14472\\156\002\000\000\
14473\\157\002\000\000\
14474\\158\002\000\000\
14475\\159\002\000\000\
14476\\160\002\000\000\
14477\\161\002\000\000\
14478\\162\002\000\000\
14479\\164\002\000\000\
14480\\165\002\004\000\059\000\014\000\058\000\025\000\057\000\040\000\176\000\
14481\\041\000\056\000\000\000\
14482\\166\002\000\000\
14483\\167\002\000\000\
14484\\168\002\004\000\059\000\014\000\058\000\025\000\057\000\041\000\056\000\
14485\\042\000\188\001\000\000\
14486\\169\002\000\000\
14487\\170\002\004\000\059\000\014\000\058\000\025\000\057\000\041\000\056\000\
14488\\042\000\178\000\000\000\
14489\\171\002\000\000\
14490\\172\002\000\000\
14491\\173\002\004\000\059\000\014\000\058\000\025\000\057\000\040\000\114\001\
14492\\041\000\056\000\000\000\
14493\\174\002\000\000\
14494\\175\002\061\000\083\000\062\000\082\000\068\000\081\000\069\000\080\000\
14495\\070\000\079\000\000\000\
14496\\176\002\000\000\
14497\\177\002\000\000\
14498\\179\002\000\000\
14499\\180\002\000\000\
14500\\181\002\004\000\059\000\041\000\056\000\000\000\
14501\\182\002\004\000\059\000\025\000\057\000\041\000\056\000\000\000\
14502\\183\002\000\000\
14503\\184\002\004\000\059\000\014\000\058\000\025\000\057\000\041\000\056\000\000\000\
14504\\185\002\004\000\059\000\014\000\058\000\025\000\057\000\041\000\056\000\000\000\
14505\\186\002\004\000\059\000\014\000\058\000\025\000\057\000\041\000\056\000\000\000\
14506\\187\002\000\000\
14507\\188\002\000\000\
14508\\189\002\000\000\
14509\\190\002\000\000\
14510\\191\002\045\000\235\000\000\000\
14511\\192\002\004\000\059\000\014\000\058\000\025\000\057\000\041\000\056\000\000\000\
14512\\193\002\002\000\049\000\008\000\047\000\011\000\046\000\013\000\044\000\
14513\\017\000\042\000\018\000\041\000\020\000\221\000\021\000\038\000\
14514\\024\000\036\000\029\000\034\000\030\000\033\000\042\000\220\000\000\000\
14515\\194\002\002\000\049\000\008\000\047\000\011\000\046\000\013\000\044\000\
14516\\017\000\042\000\018\000\041\000\020\000\221\000\021\000\038\000\
14517\\024\000\036\000\029\000\034\000\030\000\033\000\042\000\220\000\000\000\
14518\\195\002\000\000\
14519\\196\002\000\000\
14520\\197\002\002\000\049\000\008\000\047\000\011\000\046\000\013\000\044\000\
14521\\017\000\042\000\018\000\041\000\020\000\221\000\021\000\038\000\
14522\\024\000\036\000\029\000\034\000\030\000\033\000\000\000\
14523\\198\002\000\000\
14524\\199\002\000\000\
14525\\200\002\000\000\
14526\\201\002\000\000\
14527\\202\002\000\000\
14528\\203\002\000\000\
14529\\204\002\000\000\
14530\\205\002\000\000\
14531\\206\002\000\000\
14532\\207\002\000\000\
14533\\208\002\000\000\
14534\\209\002\000\000\
14535\\210\002\000\000\
14536\\211\002\000\000\
14537\\212\002\000\000\
14538\\213\002\000\000\
14539\\214\002\032\000\239\000\000\000\
14540\\215\002\000\000\
14541\\216\002\046\000\122\000\068\000\067\000\069\000\066\000\070\000\065\000\000\000\
14542\\217\002\000\000\
14543\\218\002\068\000\071\000\073\000\118\000\000\000\
14544\\219\002\000\000\
14545\\220\002\060\000\128\000\061\000\127\000\000\000\
14546\\221\002\000\000\
14547\\222\002\000\000\
14548\\223\002\000\000\
14549\\224\002\003\000\117\001\004\000\059\000\014\000\058\000\025\000\057\000\
14550\\041\000\056\000\000\000\
14551\\225\002\000\000\
14552\\226\002\000\000\
14553\\227\002\003\000\232\000\000\000\
14554\\228\002\000\000\
14555\\229\002\000\000\
14556\\230\002\045\000\230\000\000\000\
14557\\231\002\004\000\059\000\014\000\058\000\025\000\057\000\041\000\056\000\000\000\
14558\\232\002\000\000\
14559\\233\002\000\000\
14560\\234\002\003\000\186\001\000\000\
14561\\235\002\000\000\
14562\\236\002\000\000\
14563\\237\002\000\000\
14564\\238\002\000\000\
14565\\239\002\003\000\139\001\000\000\
14566\\240\002\000\000\
14567\\241\002\000\000\
14568\\242\002\045\000\242\001\000\000\
14569\\243\002\000\000\
14570\\244\002\022\000\058\001\000\000\
14571\\244\002\022\000\058\001\046\000\057\001\000\000\
14572\\245\002\000\000\
14573\\246\002\000\000\
14574\\247\002\000\000\
14575\\248\002\003\000\134\001\000\000\
14576\\249\002\000\000\
14577\\249\002\041\000\186\000\000\000\
14578\\250\002\000\000\
14579\\251\002\000\000\
14580\\252\002\000\000\
14581\\253\002\000\000\
14582\\254\002\000\000\
14583\\255\002\000\000\
14584\\000\003\000\000\
14585\\001\003\000\000\
14586\\002\003\000\000\
14587\\004\003\000\000\
14588\\005\003\040\000\036\001\000\000\
14589\\006\003\000\000\
14590\\007\003\000\000\
14591\\008\003\000\000\
14592\\009\003\000\000\
14593\\010\003\000\000\
14594\\011\003\040\000\182\001\000\000\
14595\\012\003\000\000\
14596\\013\003\041\000\227\000\000\000\
14597\\014\003\000\000\
14598\\015\003\005\000\121\001\000\000\
14599\\016\003\000\000\
14600\\017\003\043\000\200\000\061\000\083\000\062\000\082\000\068\000\199\000\
14601\\069\000\198\000\070\000\197\000\000\000\
14602\\019\003\041\000\186\000\000\000\
14603\\020\003\000\000\
14604\\021\003\000\000\
14605\\022\003\000\000\
14606\\023\003\000\000\
14607\\024\003\000\000\
14608\\025\003\000\000\
14609\\027\003\000\000\
14610\\028\003\000\000\
14611\\029\003\041\000\186\000\000\000\
14612\\030\003\048\000\249\000\000\000\
14613\\031\003\000\000\
14614\\032\003\000\000\
14615\\033\003\000\000\
14616\\035\003\000\000\
14617\\036\003\000\000\
14618\\037\003\000\000\
14619\\038\003\000\000\
14620\\039\003\000\000\
14621\\040\003\000\000\
14622\\041\003\000\000\
14623\\042\003\040\000\200\001\000\000\
14624\\043\003\000\000\
14625\\044\003\061\000\083\000\062\000\082\000\068\000\081\000\069\000\080\000\
14626\\070\000\079\000\000\000\
14627\\046\003\034\000\165\000\038\000\164\000\071\000\104\000\000\000\
14628\\047\003\000\000\
14629\\048\003\000\000\
14630\\049\003\040\000\072\001\000\000\
14631\\050\003\000\000\
14632\\051\003\034\000\113\000\071\000\104\000\000\000\
14633\\052\003\000\000\
14634\\053\003\000\000\
14635\\054\003\000\000\
14636\\055\003\040\000\042\001\000\000\
14637\\056\003\000\000\
14638\\057\003\058\000\082\001\000\000\
14639\\057\003\058\000\245\001\000\000\
14640\\057\003\058\000\079\002\000\000\
14641\\058\003\058\000\082\001\000\000\
14642\\058\003\058\000\245\001\000\000\
14643\\058\003\058\000\079\002\000\000\
14644\\059\003\000\000\
14645\\060\003\000\000\
14646\\061\003\000\000\
14647\\062\003\000\000\
14648\\063\003\000\000\
14649\\064\003\002\000\049\000\008\000\047\000\011\000\046\000\013\000\044\000\
14650\\017\000\042\000\018\000\041\000\020\000\039\000\021\000\038\000\
14651\\024\000\036\000\029\000\034\000\030\000\033\000\042\000\216\000\
14652\\057\000\025\000\000\000\
14653\\065\003\002\000\049\000\008\000\047\000\011\000\046\000\013\000\044\000\
14654\\017\000\042\000\018\000\041\000\019\000\081\001\020\000\039\000\
14655\\021\000\038\000\024\000\036\000\029\000\034\000\030\000\033\000\
14656\\042\000\216\000\056\000\080\001\057\000\025\000\068\000\079\001\
14657\\073\000\118\000\000\000\
14658\\065\003\002\000\049\000\008\000\047\000\011\000\046\000\013\000\044\000\
14659\\017\000\042\000\018\000\041\000\020\000\039\000\021\000\038\000\
14660\\024\000\036\000\029\000\034\000\030\000\033\000\042\000\216\000\
14661\\057\000\025\000\000\000\
14662\\066\003\000\000\
14663\\067\003\002\000\049\000\008\000\047\000\011\000\046\000\013\000\044\000\
14664\\017\000\042\000\018\000\041\000\020\000\039\000\021\000\038\000\
14665\\024\000\036\000\029\000\034\000\030\000\033\000\057\000\025\000\000\000\
14666\\068\003\000\000\
14667\\069\003\000\000\
14668\\070\003\000\000\
14669\\071\003\000\000\
14670\\072\003\000\000\
14671\\073\003\000\000\
14672\\074\003\000\000\
14673\\076\003\000\000\
14674\\077\003\000\000\
14675\\078\003\000\000\
14676\\079\003\000\000\
14677\\080\003\000\000\
14678\\081\003\000\000\
14679\\082\003\000\000\
14680\\083\003\000\000\
14681\\084\003\058\000\082\001\000\000\
14682\\085\003\041\000\171\000\059\000\170\000\000\000\
14683\\085\003\041\000\171\000\059\000\164\001\000\000\
14684\\085\003\041\000\171\000\059\000\003\002\000\000\
14685\\086\003\000\000\
14686\\087\003\000\000\
14687\\088\003\000\000\
14688\\089\003\000\000\
14689\\089\003\068\000\074\000\000\000\
14690\\090\003\000\000\
14691\\091\003\000\000\
14692\\092\003\000\000\
14693\\094\003\000\000\
14694\\095\003\000\000\
14695\\096\003\000\000\
14696\\097\003\000\000\
14697\\098\003\000\000\
14698\\099\003\000\000\
14699\\100\003\000\000\
14700\\101\003\003\000\074\002\000\000\
14701\\102\003\008\000\020\001\011\000\019\001\029\000\018\001\030\000\017\001\
14702\\050\000\015\001\052\000\014\001\053\000\089\001\057\000\012\001\000\000\
14703\\103\003\008\000\020\001\011\000\019\001\029\000\018\001\030\000\017\001\
14704\\042\000\016\001\050\000\015\001\052\000\014\001\053\000\013\001\
14705\\057\000\012\001\000\000\
14706\\103\003\008\000\020\001\011\000\019\001\029\000\018\001\030\000\017\001\
14707\\042\000\016\001\050\000\015\001\052\000\014\001\053\000\013\001\
14708\\057\000\012\001\068\000\071\000\000\000\
14709\\104\003\000\000\
14710\\105\003\000\000\
14711\\106\003\000\000\
14712\\107\003\000\000\
14713\\108\003\000\000\
14714\\109\003\000\000\
14715\\110\003\000\000\
14716\\111\003\000\000\
14717\\112\003\000\000\
14718\\113\003\000\000\
14719\\114\003\000\000\
14720\\115\003\000\000\
14721\\116\003\000\000\
14722\\117\003\000\000\
14723\\118\003\000\000\
14724\\119\003\000\000\
14725\\120\003\058\000\082\001\000\000\
14726\\121\003\000\000\
14727\\122\003\000\000\
14728\\123\003\068\000\074\000\000\000\
14729\\124\003\000\000\
14730\\125\003\046\000\042\002\000\000\
14731\\126\003\000\000\
14732\\127\003\000\000\
14733\\128\003\046\000\007\002\000\000\
14734\\129\003\000\000\
14735\\130\003\000\000\
14736\\131\003\000\000\
14737\\132\003\003\000\012\002\000\000\
14738\\133\003\000\000\
14739\\134\003\000\000\
14740\\135\003\003\000\225\001\000\000\
14741\\135\003\003\000\225\001\046\000\227\001\000\000\
14742\\136\003\000\000\
14743\\137\003\000\000\
14744\\138\003\003\000\045\002\000\000\
14745\\139\003\000\000\
14746\\140\003\000\000\
14747\\141\003\000\000\
14748\\142\003\000\000\
14749\\143\003\003\000\017\002\000\000\
14750\\144\003\000\000\
14751\\145\003\000\000\
14752\\146\003\045\000\050\002\000\000\
14753\\147\003\000\000\
14754\\148\003\000\000\
14755\\149\003\003\000\229\001\000\000\
14756\\150\003\000\000\
14757\\151\003\000\000\
14758\\153\003\000\000\
14759\\154\003\000\000\
14760\\155\003\000\000\
14761\\156\003\000\000\
14762\\157\003\000\000\
14763\\158\003\000\000\
14764\\159\003\000\000\
14765\\160\003\000\000\
14766\\161\003\000\000\
14767\\162\003\000\000\
14768\\163\003\000\000\
14769\\165\003\000\000\
14770\\166\003\000\000\
14771\\167\003\000\000\
14772\\168\003\000\000\
14773\\169\003\000\000\
14774\\170\003\000\000\
14775\\171\003\000\000\
14776\\172\003\000\000\
14777\\173\003\000\000\
14778\\175\003\000\000\
14779\\176\003\000\000\
14780\\177\003\000\000\
14781\\178\003\000\000\
14782\\179\003\002\000\049\000\008\000\047\000\011\000\046\000\013\000\044\000\
14783\\017\000\042\000\018\000\041\000\020\000\039\000\021\000\038\000\
14784\\024\000\036\000\029\000\034\000\030\000\033\000\051\000\027\000\
14785\\055\000\026\000\057\000\025\000\000\000\
14786\\180\003\000\000\
14787\\181\003\000\000\
14788\\182\003\000\000\
14789\\183\003\000\000\
14790\"
14791val actionRowNumbers =
14792"\127\000\013\000\207\001\201\001\
14793\\082\000\206\001\206\001\206\001\
14794\\096\001\021\000\204\000\003\000\
14795\\202\000\084\000\179\000\139\000\
14796\\138\000\140\000\137\000\136\000\
14797\\135\000\134\000\133\000\120\000\
14798\\122\000\123\000\116\000\201\000\
14799\\028\000\169\000\170\000\173\000\
14800\\073\001\170\000\121\000\168\000\
14801\\085\000\128\000\128\000\245\000\
14802\\245\000\170\000\175\000\178\000\
14803\\172\000\057\000\170\000\073\001\
14804\\001\000\204\001\205\001\203\001\
14805\\202\001\001\000\068\001\170\000\
14806\\178\000\170\000\203\000\159\000\
14807\\180\000\161\000\162\000\152\000\
14808\\151\000\150\000\160\000\097\001\
14809\\111\001\156\000\119\001\086\000\
14810\\157\000\187\001\058\000\158\000\
14811\\182\000\145\000\144\000\143\000\
14812\\147\000\146\000\073\000\200\000\
14813\\087\000\191\000\189\000\071\000\
14814\\020\000\060\000\061\000\183\000\
14815\\016\000\174\000\044\001\088\000\
14816\\020\001\042\000\224\000\119\000\
14817\\074\001\023\001\155\000\022\001\
14818\\043\001\044\000\177\000\174\000\
14819\\072\001\124\000\228\000\126\000\
14820\\209\000\234\000\243\000\166\000\
14821\\167\000\237\000\148\000\241\000\
14822\\149\000\092\001\219\000\085\000\
14823\\244\000\142\000\141\000\085\000\
14824\\019\000\178\000\039\001\019\001\
14825\\043\000\255\000\252\000\226\000\
14826\\118\000\112\000\216\000\213\000\
14827\\176\000\233\000\117\000\124\000\
14828\\239\000\239\000\089\000\154\000\
14829\\153\000\018\000\124\000\239\000\
14830\\208\001\210\001\209\001\125\000\
14831\\058\001\004\000\056\001\054\001\
14832\\205\000\060\001\067\001\068\001\
14833\\207\000\208\000\206\000\090\000\
14834\\113\000\113\000\113\000\132\001\
14835\\181\000\170\000\170\000\185\000\
14836\\170\000\170\000\188\000\186\000\
14837\\184\000\170\000\225\000\046\001\
14838\\068\001\170\000\045\001\051\001\
14839\\021\001\026\000\163\000\074\000\
14840\\042\001\039\001\091\000\024\000\
14841\\023\000\022\000\033\001\031\001\
14842\\029\001\072\000\062\000\063\000\
14843\\064\000\077\001\025\001\247\000\
14844\\092\000\242\000\240\000\093\001\
14845\\090\001\037\000\095\001\220\000\
14846\\218\000\038\000\223\000\128\000\
14847\\236\000\235\000\170\000\227\000\
14848\\093\000\068\001\050\001\253\000\
14849\\178\000\250\000\178\000\170\000\
14850\\214\000\178\000\014\001\094\000\
14851\\230\000\073\001\229\000\171\000\
14852\\178\000\095\000\056\000\059\001\
14853\\164\000\165\000\068\001\068\001\
14854\\075\000\066\001\076\000\065\000\
14855\\066\000\041\000\114\001\096\000\
14856\\117\001\131\001\110\001\120\001\
14857\\008\000\114\000\133\001\130\001\
14858\\067\000\077\000\120\000\045\000\
14859\\113\000\073\001\135\001\117\000\
14860\\073\001\117\000\057\000\199\000\
14861\\190\000\196\000\195\000\192\000\
14862\\211\000\053\001\249\000\047\001\
14863\\027\000\068\001\048\001\024\001\
14864\\041\001\178\000\178\000\027\001\
14865\\075\001\178\000\028\001\026\001\
14866\\126\000\068\001\094\001\131\000\
14867\\222\000\170\000\219\000\017\000\
14868\\170\000\038\001\254\000\251\000\
14869\\217\000\215\000\018\001\172\000\
14870\\068\001\172\000\238\000\008\001\
14871\\117\000\125\000\212\000\172\000\
14872\\219\000\057\001\055\001\061\001\
14873\\068\001\069\001\068\001\062\001\
14874\\099\001\005\000\078\000\086\001\
14875\\059\000\002\000\128\000\128\000\
14876\\046\000\041\000\030\000\122\001\
14877\\122\000\047\000\134\001\049\000\
14878\\112\001\113\000\148\001\079\000\
14879\\138\001\097\000\125\000\150\001\
14880\\149\001\118\001\142\001\124\000\
14881\\140\001\080\000\143\001\141\001\
14882\\124\000\147\001\013\001\145\001\
14883\\144\001\124\000\098\000\197\000\
14884\\116\000\052\001\246\000\174\000\
14885\\178\000\025\000\037\001\178\000\
14886\\037\001\030\001\032\001\076\001\
14887\\003\001\092\001\194\000\129\000\
14888\\039\000\170\000\000\001\015\001\
14889\\172\000\084\000\012\001\008\001\
14890\\005\001\073\001\013\001\231\000\
14891\\008\001\031\000\065\001\070\001\
14892\\071\001\102\001\120\000\113\000\
14893\\113\000\091\001\092\001\092\001\
14894\\115\001\073\001\100\001\116\001\
14895\\121\001\123\001\073\001\139\001\
14896\\125\000\099\000\113\000\068\000\
14897\\113\000\121\000\136\001\100\000\
14898\\151\001\152\001\164\001\068\001\
14899\\165\001\179\001\102\000\029\000\
14900\\198\000\248\000\049\001\035\001\
14901\\083\000\040\001\034\001\001\001\
14902\\073\001\132\000\170\000\032\000\
14903\\131\000\210\000\017\001\018\001\
14904\\006\001\007\001\011\001\004\001\
14905\\232\000\063\001\116\000\101\001\
14906\\006\000\083\001\104\001\080\001\
14907\\103\001\069\000\078\001\070\000\
14908\\129\000\040\000\125\000\125\000\
14909\\137\001\041\000\103\000\113\001\
14910\\180\001\014\000\115\000\158\001\
14911\\157\001\125\000\162\001\073\001\
14912\\161\001\068\001\177\001\117\000\
14913\\117\000\173\001\013\001\125\000\
14914\\036\001\002\001\033\000\193\000\
14915\\187\000\219\000\016\001\009\001\
14916\\172\000\064\001\105\001\050\000\
14917\\088\001\113\000\113\000\087\001\
14918\\034\000\041\000\104\000\105\000\
14919\\190\001\010\000\081\000\041\000\
14920\\106\000\113\000\182\001\120\000\
14921\\052\000\121\000\155\001\154\001\
14922\\163\001\159\001\117\000\168\001\
14923\\178\001\173\001\170\001\073\001\
14924\\176\001\146\001\098\001\132\000\
14925\\010\001\106\001\073\001\082\001\
14926\\079\001\085\001\130\000\068\001\
14927\\068\001\193\001\123\000\113\000\
14928\\113\000\191\001\041\000\107\000\
14929\\181\001\183\001\073\001\156\001\
14930\\125\000\160\001\166\001\073\001\
14931\\171\001\172\001\124\000\174\001\
14932\\117\000\035\000\125\000\036\000\
14933\\129\001\009\000\192\001\195\001\
14934\\011\000\084\001\194\001\081\001\
14935\\188\001\041\000\125\000\153\001\
14936\\167\001\124\000\108\000\175\001\
14937\\221\000\109\000\089\001\127\001\
14938\\046\000\124\001\125\001\048\000\
14939\\196\001\054\000\189\001\110\000\
14940\\101\000\117\000\068\001\128\001\
14941\\126\001\197\001\073\001\068\001\
14942\\173\001\007\000\125\000\015\000\
14943\\169\001\107\001\108\001\051\000\
14944\\111\000\184\001\185\001\053\000\
14945\\109\001\068\001\186\001\012\000\
14946\\198\001\199\001\055\000\200\001\
14947\\000\000"
14948val gotoT =
14949"\
14950\\142\000\108\002\145\000\001\000\000\000\
14951\\001\000\014\000\015\000\013\000\016\000\012\000\025\000\011\000\
14952\\026\000\010\000\027\000\009\000\033\000\008\000\087\000\007\000\
14953\\097\000\006\000\132\000\005\000\139\000\004\000\140\000\003\000\
14954\\143\000\002\000\000\000\
14955\\000\000\
14956\\000\000\
14957\\000\000\
14958\\033\000\008\000\087\000\007\000\097\000\006\000\132\000\005\000\
14959\\140\000\050\000\141\000\049\000\000\000\
14960\\033\000\008\000\087\000\007\000\097\000\006\000\132\000\005\000\
14961\\140\000\050\000\141\000\051\000\000\000\
14962\\033\000\008\000\087\000\007\000\097\000\006\000\132\000\005\000\
14963\\140\000\050\000\141\000\052\000\000\000\
14964\\000\000\
14965\\000\000\
14966\\000\000\
14967\\001\000\014\000\015\000\013\000\016\000\058\000\000\000\
14968\\000\000\
14969\\005\000\061\000\011\000\060\000\012\000\059\000\000\000\
14970\\000\000\
14971\\000\000\
14972\\000\000\
14973\\000\000\
14974\\000\000\
14975\\000\000\
14976\\000\000\
14977\\000\000\
14978\\000\000\
14979\\008\000\068\000\088\000\067\000\000\000\
14980\\009\000\071\000\098\000\070\000\000\000\
14981\\010\000\074\000\133\000\073\000\000\000\
14982\\003\000\076\000\000\000\
14983\\003\000\084\000\022\000\083\000\023\000\082\000\000\000\
14984\\001\000\014\000\015\000\013\000\016\000\012\000\017\000\087\000\
14985\\018\000\086\000\025\000\011\000\026\000\010\000\027\000\085\000\000\000\
14986\\001\000\014\000\015\000\013\000\016\000\012\000\019\000\090\000\
14987\\021\000\089\000\025\000\011\000\026\000\010\000\027\000\088\000\000\000\
14988\\001\000\014\000\015\000\013\000\016\000\012\000\025\000\011\000\
14989\\026\000\010\000\027\000\092\000\000\000\
14990\\001\000\101\000\007\000\100\000\015\000\099\000\038\000\098\000\
14991\\056\000\097\000\057\000\096\000\066\000\095\000\068\000\094\000\
14992\\081\000\093\000\000\000\
14993\\007\000\100\000\045\000\110\000\080\000\109\000\081\000\108\000\000\000\
14994\\001\000\014\000\015\000\013\000\016\000\012\000\025\000\011\000\
14995\\026\000\010\000\027\000\112\000\000\000\
14996\\008\000\115\000\014\000\114\000\036\000\113\000\000\000\
14997\\000\000\
14998\\004\000\119\000\005\000\118\000\035\000\117\000\000\000\
14999\\146\000\121\000\000\000\
15000\\146\000\122\000\000\000\
15001\\002\000\124\000\037\000\123\000\000\000\
15002\\002\000\124\000\037\000\127\000\000\000\
15003\\001\000\014\000\015\000\013\000\016\000\012\000\025\000\011\000\
15004\\026\000\010\000\027\000\128\000\000\000\
15005\\001\000\101\000\007\000\100\000\015\000\136\000\040\000\135\000\
15006\\042\000\134\000\044\000\133\000\056\000\132\000\057\000\131\000\
15007\\067\000\130\000\081\000\129\000\000\000\
15008\\001\000\101\000\015\000\099\000\028\000\139\000\030\000\138\000\
15009\\056\000\097\000\057\000\096\000\066\000\137\000\068\000\094\000\000\000\
15010\\015\000\142\000\054\000\141\000\000\000\
15011\\006\000\146\000\007\000\100\000\048\000\145\000\049\000\144\000\
15012\\081\000\143\000\000\000\
15013\\001\000\014\000\015\000\013\000\016\000\012\000\025\000\011\000\
15014\\026\000\010\000\027\000\149\000\000\000\
15015\\007\000\100\000\047\000\151\000\080\000\150\000\081\000\108\000\000\000\
15016\\001\000\014\000\015\000\013\000\016\000\012\000\025\000\011\000\
15017\\026\000\010\000\027\000\009\000\033\000\008\000\087\000\007\000\
15018\\097\000\006\000\132\000\005\000\139\000\004\000\140\000\003\000\
15019\\143\000\153\000\144\000\152\000\000\000\
15020\\000\000\
15021\\000\000\
15022\\000\000\
15023\\000\000\
15024\\001\000\014\000\015\000\013\000\016\000\012\000\025\000\011\000\
15025\\026\000\010\000\027\000\009\000\033\000\008\000\087\000\007\000\
15026\\097\000\006\000\132\000\005\000\139\000\004\000\140\000\003\000\
15027\\143\000\153\000\144\000\154\000\000\000\
15028\\007\000\161\000\070\000\160\000\071\000\159\000\072\000\158\000\
15029\\073\000\157\000\074\000\156\000\078\000\155\000\000\000\
15030\\001\000\014\000\015\000\013\000\016\000\012\000\025\000\011\000\
15031\\026\000\010\000\027\000\164\000\000\000\
15032\\001\000\101\000\015\000\099\000\028\000\165\000\030\000\138\000\
15033\\056\000\097\000\057\000\096\000\066\000\137\000\068\000\094\000\000\000\
15034\\001\000\014\000\015\000\013\000\016\000\012\000\025\000\011\000\
15035\\026\000\010\000\027\000\166\000\000\000\
15036\\000\000\
15037\\000\000\
15038\\000\000\
15039\\000\000\
15040\\000\000\
15041\\000\000\
15042\\000\000\
15043\\000\000\
15044\\000\000\
15045\\000\000\
15046\\094\000\167\000\000\000\
15047\\000\000\
15048\\000\000\
15049\\000\000\
15050\\000\000\
15051\\000\000\
15052\\000\000\
15053\\000\000\
15054\\000\000\
15055\\000\000\
15056\\000\000\
15057\\000\000\
15058\\000\000\
15059\\000\000\
15060\\000\000\
15061\\000\000\
15062\\000\000\
15063\\000\000\
15064\\000\000\
15065\\000\000\
15066\\000\000\
15067\\000\000\
15068\\000\000\
15069\\000\000\
15070\\000\000\
15071\\001\000\101\000\015\000\099\000\038\000\182\000\056\000\097\000\
15072\\057\000\096\000\066\000\095\000\068\000\094\000\000\000\
15073\\069\000\183\000\000\000\
15074\\000\000\
15075\\069\000\186\000\000\000\
15076\\001\000\101\000\015\000\136\000\056\000\132\000\057\000\131\000\
15077\\067\000\187\000\000\000\
15078\\000\000\
15079\\005\000\189\000\012\000\188\000\000\000\
15080\\000\000\
15081\\000\000\
15082\\000\000\
15083\\000\000\
15084\\003\000\194\000\005\000\193\000\061\000\192\000\062\000\191\000\000\000\
15085\\001\000\101\000\015\000\099\000\056\000\097\000\057\000\096\000\
15086\\058\000\201\000\059\000\200\000\066\000\199\000\068\000\094\000\000\000\
15087\\001\000\101\000\007\000\205\000\015\000\099\000\056\000\097\000\
15088\\057\000\096\000\060\000\204\000\066\000\203\000\068\000\094\000\
15089\\082\000\202\000\000\000\
15090\\001\000\101\000\015\000\099\000\038\000\207\000\056\000\097\000\
15091\\057\000\096\000\066\000\095\000\068\000\094\000\000\000\
15092\\000\000\
15093\\006\000\208\000\000\000\
15094\\000\000\
15095\\007\000\205\000\082\000\202\000\000\000\
15096\\000\000\
15097\\000\000\
15098\\008\000\115\000\014\000\114\000\036\000\209\000\000\000\
15099\\000\000\
15100\\000\000\
15101\\000\000\
15102\\000\000\
15103\\004\000\119\000\005\000\118\000\035\000\210\000\000\000\
15104\\000\000\
15105\\033\000\008\000\085\000\213\000\086\000\212\000\087\000\211\000\000\000\
15106\\031\000\217\000\032\000\216\000\033\000\215\000\000\000\
15107\\004\000\119\000\005\000\118\000\035\000\220\000\000\000\
15108\\000\000\
15109\\000\000\
15110\\000\000\
15111\\004\000\119\000\005\000\118\000\035\000\221\000\000\000\
15112\\000\000\
15113\\001\000\101\000\015\000\136\000\040\000\223\000\042\000\134\000\
15114\\044\000\133\000\056\000\132\000\057\000\131\000\067\000\130\000\000\000\
15115\\064\000\224\000\000\000\
15116\\000\000\
15117\\001\000\101\000\015\000\136\000\056\000\132\000\057\000\131\000\
15118\\067\000\226\000\000\000\
15119\\043\000\227\000\000\000\
15120\\041\000\229\000\000\000\
15121\\000\000\
15122\\005\000\061\000\012\000\188\000\000\000\
15123\\000\000\
15124\\029\000\232\000\000\000\
15125\\000\000\
15126\\001\000\101\000\015\000\099\000\056\000\097\000\057\000\096\000\
15127\\060\000\204\000\066\000\203\000\068\000\094\000\000\000\
15128\\000\000\
15129\\005\000\234\000\000\000\
15130\\006\000\235\000\000\000\
15131\\034\000\236\000\000\000\
15132\\034\000\238\000\000\000\
15133\\000\000\
15134\\000\000\
15135\\000\000\
15136\\000\000\
15137\\006\000\241\000\000\000\
15138\\034\000\242\000\000\000\
15139\\000\000\
15140\\000\000\
15141\\000\000\
15142\\006\000\244\000\013\000\243\000\000\000\
15143\\000\000\
15144\\000\000\
15145\\000\000\
15146\\000\000\
15147\\000\000\
15148\\000\000\
15149\\003\000\250\000\075\000\249\000\076\000\248\000\000\000\
15150\\007\000\161\000\070\000\252\000\071\000\159\000\072\000\158\000\
15151\\073\000\157\000\074\000\156\000\078\000\155\000\079\000\251\000\000\000\
15152\\000\000\
15153\\000\000\
15154\\000\000\
15155\\000\000\
15156\\009\000\000\001\095\000\255\000\096\000\254\000\000\000\
15157\\009\000\000\001\095\000\002\001\096\000\254\000\000\000\
15158\\009\000\000\001\095\000\005\001\096\000\004\001\100\000\003\001\000\000\
15159\\008\000\009\001\105\000\008\001\106\000\007\001\107\000\006\001\000\000\
15160\\000\000\
15161\\001\000\014\000\015\000\013\000\016\000\012\000\025\000\011\000\
15162\\026\000\010\000\027\000\019\001\000\000\
15163\\001\000\014\000\015\000\013\000\016\000\012\000\018\000\020\001\
15164\\025\000\011\000\026\000\010\000\027\000\085\000\000\000\
15165\\000\000\
15166\\001\000\014\000\015\000\013\000\016\000\012\000\021\000\022\001\
15167\\025\000\011\000\026\000\010\000\027\000\021\001\000\000\
15168\\001\000\014\000\015\000\013\000\016\000\012\000\018\000\023\001\
15169\\025\000\011\000\026\000\010\000\027\000\085\000\000\000\
15170\\000\000\
15171\\000\000\
15172\\000\000\
15173\\001\000\014\000\015\000\013\000\016\000\012\000\025\000\011\000\
15174\\026\000\010\000\027\000\024\001\000\000\
15175\\000\000\
15176\\000\000\
15177\\007\000\161\000\070\000\025\001\071\000\159\000\072\000\158\000\
15178\\073\000\157\000\074\000\156\000\078\000\155\000\000\000\
15179\\001\000\014\000\015\000\013\000\016\000\012\000\025\000\011\000\
15180\\026\000\010\000\027\000\026\001\000\000\
15181\\000\000\
15182\\000\000\
15183\\000\000\
15184\\064\000\028\001\069\000\027\001\000\000\
15185\\069\000\030\001\000\000\
15186\\000\000\
15187\\000\000\
15188\\064\000\032\001\000\000\
15189\\000\000\
15190\\000\000\
15191\\000\000\
15192\\000\000\
15193\\000\000\
15194\\000\000\
15195\\000\000\
15196\\000\000\
15197\\000\000\
15198\\000\000\
15199\\000\000\
15200\\000\000\
15201\\000\000\
15202\\000\000\
15203\\000\000\
15204\\000\000\
15205\\000\000\
15206\\000\000\
15207\\033\000\008\000\086\000\042\001\087\000\211\000\000\000\
15208\\000\000\
15209\\000\000\
15210\\000\000\
15211\\032\000\044\001\033\000\215\000\000\000\
15212\\000\000\
15213\\000\000\
15214\\146\000\046\001\000\000\
15215\\000\000\
15216\\000\000\
15217\\001\000\014\000\015\000\013\000\016\000\012\000\025\000\011\000\
15218\\026\000\010\000\027\000\047\001\000\000\
15219\\000\000\
15220\\000\000\
15221\\007\000\161\000\070\000\049\001\071\000\159\000\072\000\158\000\
15222\\073\000\157\000\074\000\156\000\078\000\155\000\000\000\
15223\\000\000\
15224\\000\000\
15225\\001\000\101\000\015\000\136\000\042\000\050\001\044\000\133\000\
15226\\056\000\132\000\057\000\131\000\067\000\130\000\000\000\
15227\\000\000\
15228\\001\000\101\000\015\000\136\000\040\000\051\001\042\000\134\000\
15229\\044\000\133\000\056\000\132\000\057\000\131\000\067\000\130\000\000\000\
15230\\001\000\014\000\015\000\013\000\016\000\012\000\025\000\011\000\
15231\\026\000\010\000\027\000\052\001\000\000\
15232\\000\000\
15233\\001\000\101\000\015\000\099\000\028\000\053\001\030\000\138\000\
15234\\056\000\097\000\057\000\096\000\066\000\137\000\068\000\094\000\000\000\
15235\\053\000\054\001\000\000\
15236\\000\000\
15237\\000\000\
15238\\007\000\100\000\045\000\058\001\080\000\109\000\081\000\108\000\000\000\
15239\\000\000\
15240\\015\000\060\001\051\000\059\001\000\000\
15241\\001\000\101\000\015\000\099\000\028\000\062\001\030\000\138\000\
15242\\056\000\097\000\057\000\096\000\066\000\137\000\068\000\094\000\000\000\
15243\\000\000\
15244\\000\000\
15245\\000\000\
15246\\000\000\
15247\\000\000\
15248\\007\000\161\000\072\000\065\001\073\000\157\000\074\000\156\000\
15249\\078\000\155\000\000\000\
15250\\007\000\161\000\070\000\066\001\071\000\159\000\072\000\158\000\
15251\\073\000\157\000\074\000\156\000\078\000\155\000\000\000\
15252\\000\000\
15253\\000\000\
15254\\000\000\
15255\\000\000\
15256\\000\000\
15257\\008\000\115\000\010\000\076\001\014\000\075\001\083\000\074\001\
15258\\084\000\073\001\090\000\072\001\000\000\
15259\\000\000\
15260\\000\000\
15261\\000\000\
15262\\105\000\082\001\106\000\007\001\107\000\006\001\000\000\
15263\\000\000\
15264\\000\000\
15265\\099\000\083\001\000\000\
15266\\000\000\
15267\\000\000\
15268\\107\000\086\001\000\000\
15269\\000\000\
15270\\000\000\
15271\\008\000\091\001\127\000\090\001\000\000\
15272\\008\000\115\000\014\000\093\001\112\000\092\001\000\000\
15273\\009\000\097\001\095\000\096\001\096\000\254\000\108\000\095\001\000\000\
15274\\007\000\100\000\080\000\099\001\081\000\108\000\115\000\098\001\000\000\
15275\\000\000\
15276\\005\000\101\001\113\000\100\001\000\000\
15277\\007\000\100\000\080\000\104\001\081\000\108\000\115\000\103\001\
15278\\117\000\102\001\000\000\
15279\\005\000\106\001\125\000\105\001\000\000\
15280\\006\000\110\001\007\000\100\000\081\000\109\001\120\000\108\001\
15281\\121\000\107\001\000\000\
15282\\024\000\111\001\000\000\
15283\\000\000\
15284\\000\000\
15285\\000\000\
15286\\000\000\
15287\\000\000\
15288\\069\000\113\001\000\000\
15289\\039\000\114\001\000\000\
15290\\000\000\
15291\\000\000\
15292\\007\000\161\000\070\000\117\001\071\000\159\000\072\000\158\000\
15293\\073\000\157\000\074\000\156\000\078\000\155\000\000\000\
15294\\000\000\
15295\\000\000\
15296\\065\000\118\001\000\000\
15297\\001\000\101\000\015\000\099\000\056\000\097\000\057\000\096\000\
15298\\066\000\120\001\068\000\094\000\000\000\
15299\\001\000\101\000\015\000\099\000\056\000\097\000\057\000\096\000\
15300\\059\000\121\001\066\000\199\000\068\000\094\000\000\000\
15301\\000\000\
15302\\000\000\
15303\\001\000\101\000\015\000\099\000\056\000\097\000\057\000\096\000\
15304\\059\000\122\001\066\000\199\000\068\000\094\000\000\000\
15305\\000\000\
15306\\000\000\
15307\\007\000\205\000\082\000\123\001\000\000\
15308\\007\000\161\000\070\000\124\001\071\000\159\000\072\000\158\000\
15309\\073\000\157\000\074\000\156\000\078\000\155\000\000\000\
15310\\033\000\008\000\086\000\042\001\087\000\211\000\000\000\
15311\\148\000\125\001\000\000\
15312\\032\000\044\001\033\000\215\000\000\000\
15313\\001\000\014\000\015\000\013\000\016\000\012\000\020\000\127\001\
15314\\025\000\011\000\026\000\010\000\027\000\126\001\000\000\
15315\\031\000\128\001\032\000\216\000\033\000\215\000\000\000\
15316\\000\000\
15317\\001\000\014\000\015\000\013\000\016\000\012\000\025\000\011\000\
15318\\026\000\010\000\027\000\130\001\000\000\
15319\\000\000\
15320\\000\000\
15321\\000\000\
15322\\000\000\
15323\\000\000\
15324\\055\000\131\001\000\000\
15325\\015\000\133\001\000\000\
15326\\007\000\161\000\070\000\134\001\071\000\159\000\072\000\158\000\
15327\\073\000\157\000\074\000\156\000\078\000\155\000\000\000\
15328\\015\000\060\001\051\000\135\001\000\000\
15329\\000\000\
15330\\050\000\136\001\000\000\
15331\\005\000\138\001\000\000\
15332\\006\000\244\000\013\000\139\001\000\000\
15333\\000\000\
15334\\015\000\060\001\051\000\140\001\000\000\
15335\\031\000\141\001\032\000\216\000\033\000\215\000\000\000\
15336\\000\000\
15337\\000\000\
15338\\000\000\
15339\\007\000\161\000\070\000\142\001\071\000\159\000\072\000\158\000\
15340\\073\000\157\000\074\000\156\000\078\000\155\000\000\000\
15341\\000\000\
15342\\007\000\161\000\070\000\144\001\071\000\159\000\072\000\158\000\
15343\\073\000\157\000\074\000\156\000\078\000\155\000\079\000\143\001\000\000\
15344\\000\000\
15345\\000\000\
15346\\089\000\145\001\000\000\
15347\\000\000\
15348\\000\000\
15349\\000\000\
15350\\000\000\
15351\\146\000\150\001\000\000\
15352\\146\000\151\001\000\000\
15353\\103\000\152\001\000\000\
15354\\008\000\115\000\010\000\076\001\014\000\075\001\083\000\074\001\
15355\\084\000\073\001\090\000\154\001\000\000\
15356\\000\000\
15357\\000\000\
15358\\009\000\071\000\098\000\156\001\000\000\
15359\\101\000\157\001\103\000\152\001\000\000\
15360\\000\000\
15361\\008\000\115\000\014\000\093\001\112\000\159\001\000\000\
15362\\094\000\161\001\000\000\
15363\\009\000\000\001\095\000\163\001\096\000\254\000\000\000\
15364\\000\000\
15365\\000\000\
15366\\000\000\
15367\\000\000\
15368\\006\000\244\000\013\000\167\001\110\000\166\001\000\000\
15369\\000\000\
15370\\000\000\
15371\\009\000\169\001\108\000\168\001\000\000\
15372\\000\000\
15373\\006\000\170\001\000\000\
15374\\000\000\
15375\\000\000\
15376\\000\000\
15377\\000\000\
15378\\006\000\172\001\000\000\
15379\\000\000\
15380\\053\000\173\001\000\000\
15381\\000\000\
15382\\000\000\
15383\\006\000\174\001\000\000\
15384\\000\000\
15385\\000\000\
15386\\003\000\084\000\022\000\176\001\000\000\
15387\\000\000\
15388\\000\000\
15389\\001\000\101\000\015\000\099\000\038\000\177\001\056\000\097\000\
15390\\057\000\096\000\066\000\095\000\068\000\094\000\000\000\
15391\\001\000\101\000\015\000\099\000\056\000\097\000\057\000\096\000\
15392\\066\000\178\001\068\000\094\000\000\000\
15393\\069\000\113\001\000\000\
15394\\063\000\179\001\000\000\
15395\\001\000\101\000\015\000\099\000\056\000\097\000\057\000\096\000\
15396\\066\000\181\001\068\000\094\000\000\000\
15397\\063\000\182\001\000\000\
15398\\000\000\
15399\\000\000\
15400\\000\000\
15401\\046\000\183\001\000\000\
15402\\033\000\008\000\085\000\185\001\086\000\212\000\087\000\211\000\000\000\
15403\\000\000\
15404\\147\000\187\001\000\000\
15405\\000\000\
15406\\001\000\014\000\015\000\013\000\016\000\012\000\025\000\011\000\
15407\\026\000\010\000\027\000\189\001\000\000\
15408\\000\000\
15409\\000\000\
15410\\015\000\142\000\054\000\190\001\000\000\
15411\\005\000\061\000\011\000\191\001\012\000\059\000\000\000\
15412\\000\000\
15413\\050\000\192\001\000\000\
15414\\000\000\
15415\\007\000\100\000\047\000\193\001\080\000\150\000\081\000\108\000\000\000\
15416\\053\000\194\001\000\000\
15417\\000\000\
15418\\050\000\195\001\000\000\
15419\\000\000\
15420\\077\000\197\001\000\000\
15421\\000\000\
15422\\000\000\
15423\\000\000\
15424\\008\000\068\000\088\000\199\001\000\000\
15425\\009\000\000\001\091\000\202\001\095\000\201\001\096\000\200\001\000\000\
15426\\009\000\000\001\091\000\204\001\095\000\203\001\096\000\200\001\000\000\
15427\\008\000\115\000\010\000\076\001\014\000\075\001\033\000\008\000\
15428\\083\000\207\001\084\000\206\001\085\000\205\001\086\000\212\000\
15429\\087\000\211\000\000\000\
15430\\033\000\008\000\085\000\208\001\086\000\212\000\087\000\211\000\000\000\
15431\\033\000\008\000\085\000\209\001\086\000\212\000\087\000\211\000\000\000\
15432\\000\000\
15433\\007\000\100\000\080\000\210\001\081\000\108\000\000\000\
15434\\000\000\
15435\\000\000\
15436\\000\000\
15437\\000\000\
15438\\007\000\100\000\080\000\211\001\081\000\108\000\000\000\
15439\\000\000\
15440\\006\000\244\000\013\000\167\001\110\000\212\001\000\000\
15441\\000\000\
15442\\009\000\000\001\095\000\214\001\096\000\254\000\000\000\
15443\\000\000\
15444\\009\000\000\001\095\000\218\001\096\000\217\001\129\000\216\001\000\000\
15445\\008\000\115\000\014\000\220\001\111\000\219\001\000\000\
15446\\000\000\
15447\\000\000\
15448\\000\000\
15449\\009\000\169\001\108\000\168\001\000\000\
15450\\116\000\222\001\000\000\
15451\\007\000\161\000\070\000\224\001\071\000\159\000\072\000\158\000\
15452\\073\000\157\000\074\000\156\000\078\000\155\000\000\000\
15453\\116\000\222\001\000\000\
15454\\126\000\226\001\000\000\
15455\\000\000\
15456\\005\000\230\001\123\000\229\001\000\000\
15457\\000\000\
15458\\000\000\
15459\\000\000\
15460\\000\000\
15461\\003\000\194\000\005\000\193\000\061\000\232\001\000\000\
15462\\000\000\
15463\\000\000\
15464\\000\000\
15465\\007\000\100\000\045\000\233\001\080\000\109\000\081\000\108\000\000\000\
15466\\149\000\234\001\000\000\
15467\\001\000\014\000\015\000\013\000\016\000\012\000\020\000\235\001\
15468\\025\000\011\000\026\000\010\000\027\000\126\001\000\000\
15469\\000\000\
15470\\148\000\237\001\000\000\
15471\\000\000\
15472\\000\000\
15473\\055\000\238\001\000\000\
15474\\000\000\
15475\\000\000\
15476\\052\000\239\001\000\000\
15477\\000\000\
15478\\000\000\
15479\\000\000\
15480\\003\000\250\000\075\000\241\001\000\000\
15481\\000\000\
15482\\089\000\242\001\000\000\
15483\\000\000\
15484\\000\000\
15485\\000\000\
15486\\000\000\
15487\\000\000\
15488\\000\000\
15489\\000\000\
15490\\147\000\248\001\000\000\
15491\\000\000\
15492\\006\000\244\000\013\000\250\001\000\000\
15493\\006\000\244\000\013\000\251\001\000\000\
15494\\000\000\
15495\\008\000\115\000\010\000\076\001\014\000\075\001\083\000\254\001\
15496\\084\000\253\001\135\000\252\001\000\000\
15497\\000\000\
15498\\094\000\000\002\000\000\
15499\\000\000\
15500\\128\000\002\002\000\000\
15501\\000\000\
15502\\000\000\
15503\\000\000\
15504\\006\000\244\000\013\000\007\002\109\000\006\002\000\000\
15505\\000\000\
15506\\007\000\100\000\080\000\099\001\081\000\108\000\115\000\008\002\000\000\
15507\\114\000\009\002\000\000\
15508\\007\000\161\000\070\000\011\002\071\000\159\000\072\000\158\000\
15509\\073\000\157\000\074\000\156\000\078\000\155\000\000\000\
15510\\000\000\
15511\\005\000\106\001\125\000\012\002\000\000\
15512\\005\000\230\001\123\000\013\002\000\000\
15513\\122\000\014\002\000\000\
15514\\053\000\016\002\000\000\
15515\\006\000\244\000\013\000\017\002\000\000\
15516\\000\000\
15517\\000\000\
15518\\000\000\
15519\\000\000\
15520\\000\000\
15521\\031\000\019\002\032\000\216\000\033\000\215\000\000\000\
15522\\000\000\
15523\\000\000\
15524\\015\000\060\001\051\000\020\002\000\000\
15525\\000\000\
15526\\000\000\
15527\\092\000\021\002\103\000\152\001\000\000\
15528\\000\000\
15529\\009\000\000\001\095\000\023\002\096\000\254\000\000\000\
15530\\009\000\000\001\095\000\024\002\096\000\254\000\000\000\
15531\\000\000\
15532\\000\000\
15533\\008\000\115\000\010\000\076\001\014\000\075\001\083\000\026\002\
15534\\084\000\206\001\000\000\
15535\\000\000\
15536\\000\000\
15537\\000\000\
15538\\134\000\029\002\000\000\
15539\\000\000\
15540\\008\000\115\000\010\000\076\001\014\000\075\001\083\000\254\001\
15541\\084\000\253\001\135\000\033\002\000\000\
15542\\000\000\
15543\\009\000\000\001\095\000\035\002\096\000\254\000\000\000\
15544\\000\000\
15545\\008\000\091\001\127\000\036\002\000\000\
15546\\103\000\152\001\130\000\037\002\000\000\
15547\\008\000\115\000\014\000\220\001\111\000\039\002\000\000\
15548\\000\000\
15549\\000\000\
15550\\000\000\
15551\\000\000\
15552\\005\000\101\001\113\000\041\002\000\000\
15553\\118\000\042\002\000\000\
15554\\000\000\
15555\\122\000\044\002\000\000\
15556\\000\000\
15557\\007\000\100\000\080\000\046\002\081\000\108\000\119\000\045\002\000\000\
15558\\124\000\047\002\000\000\
15559\\000\000\
15560\\000\000\
15561\\149\000\049\002\000\000\
15562\\000\000\
15563\\000\000\
15564\\007\000\100\000\080\000\050\002\081\000\108\000\000\000\
15565\\000\000\
15566\\000\000\
15567\\000\000\
15568\\147\000\051\002\000\000\
15569\\007\000\161\000\070\000\052\002\071\000\159\000\072\000\158\000\
15570\\073\000\157\000\074\000\156\000\078\000\155\000\000\000\
15571\\007\000\161\000\070\000\053\002\071\000\159\000\072\000\158\000\
15572\\073\000\157\000\074\000\156\000\078\000\155\000\000\000\
15573\\000\000\
15574\\010\000\074\000\133\000\054\002\000\000\
15575\\009\000\000\001\095\000\057\002\096\000\056\002\136\000\055\002\000\000\
15576\\009\000\000\001\095\000\059\002\096\000\056\002\136\000\058\002\000\000\
15577\\000\000\
15578\\008\000\115\000\010\000\076\001\014\000\075\001\083\000\254\001\
15579\\084\000\253\001\135\000\060\002\000\000\
15580\\000\000\
15581\\000\000\
15582\\000\000\
15583\\007\000\100\000\080\000\062\002\081\000\108\000\000\000\
15584\\000\000\
15585\\006\000\244\000\013\000\007\002\109\000\063\002\000\000\
15586\\000\000\
15587\\000\000\
15588\\007\000\100\000\080\000\065\002\081\000\108\000\117\000\064\002\000\000\
15589\\000\000\
15590\\000\000\
15591\\006\000\066\002\000\000\
15592\\000\000\
15593\\005\000\230\001\123\000\067\002\000\000\
15594\\000\000\
15595\\006\000\244\000\013\000\069\002\000\000\
15596\\000\000\
15597\\104\000\071\002\000\000\
15598\\099\000\074\002\102\000\073\002\104\000\071\002\000\000\
15599\\000\000\
15600\\000\000\
15601\\134\000\076\002\000\000\
15602\\000\000\
15603\\000\000\
15604\\000\000\
15605\\000\000\
15606\\008\000\115\000\010\000\076\001\014\000\075\001\083\000\254\001\
15607\\084\000\253\001\135\000\078\002\000\000\
15608\\006\000\244\000\013\000\079\002\000\000\
15609\\000\000\
15610\\000\000\
15611\\006\000\080\002\000\000\
15612\\000\000\
15613\\000\000\
15614\\000\000\
15615\\000\000\
15616\\000\000\
15617\\000\000\
15618\\103\000\083\002\000\000\
15619\\000\000\
15620\\000\000\
15621\\009\000\071\000\098\000\156\001\101\000\084\002\103\000\083\002\000\000\
15622\\000\000\
15623\\103\000\152\001\137\000\085\002\000\000\
15624\\000\000\
15625\\000\000\
15626\\000\000\
15627\\005\000\230\001\123\000\088\002\000\000\
15628\\007\000\161\000\070\000\089\002\071\000\159\000\072\000\158\000\
15629\\073\000\157\000\074\000\156\000\078\000\155\000\000\000\
15630\\000\000\
15631\\000\000\
15632\\000\000\
15633\\007\000\100\000\080\000\090\002\081\000\108\000\000\000\
15634\\007\000\161\000\070\000\091\002\071\000\159\000\072\000\158\000\
15635\\073\000\157\000\074\000\156\000\078\000\155\000\000\000\
15636\\122\000\092\002\000\000\
15637\\089\000\094\002\093\000\093\002\104\000\071\002\000\000\
15638\\006\000\244\000\013\000\096\002\000\000\
15639\\104\000\071\002\128\000\098\002\131\000\097\002\000\000\
15640\\000\000\
15641\\000\000\
15642\\000\000\
15643\\008\000\068\000\088\000\199\001\092\000\100\002\103\000\083\002\000\000\
15644\\000\000\
15645\\000\000\
15646\\000\000\
15647\\008\000\091\001\103\000\083\002\127\000\036\002\130\000\102\002\000\000\
15648\\000\000\
15649\\007\000\161\000\070\000\103\002\071\000\159\000\072\000\158\000\
15650\\073\000\157\000\074\000\156\000\078\000\155\000\000\000\
15651\\000\000\
15652\\104\000\071\002\134\000\105\002\138\000\104\002\000\000\
15653\\000\000\
15654\\000\000\
15655\\010\000\074\000\103\000\083\002\133\000\054\002\137\000\107\002\000\000\
15656\\000\000\
15657\\000\000\
15658\"
15659val numstates = 621
15660val numrules = 330
15661val s = ref "" and index = ref 0
15662val string_to_int = fn () =>
15663let val i = !index
15664in index := i+2; Char.ord(String.sub(!s,i)) + Char.ord(String.sub(!s,i+1)) * 256
15665end
15666val string_to_list = fn s' =>
15667 let val len = String.size s'
15668 fun f () =
15669 if !index < len then string_to_int() :: f()
15670 else nil
15671 in index := 0; s := s'; f ()
15672 end
15673val string_to_pairlist = fn (conv_key,conv_entry) =>
15674 let fun f () =
15675 case string_to_int()
15676 of 0 => EMPTY
15677 | n => PAIR(conv_key (n-1),conv_entry (string_to_int()),f())
15678 in f
15679 end
15680val string_to_pairlist_default = fn (conv_key,conv_entry) =>
15681 let val conv_row = string_to_pairlist(conv_key,conv_entry)
15682 in fn () =>
15683 let val default = conv_entry(string_to_int())
15684 val row = conv_row()
15685 in (row,default)
15686 end
15687 end
15688val string_to_table = fn (convert_row,s') =>
15689 let val len = String.size s'
15690 fun f ()=
15691 if !index < len then convert_row() :: f()
15692 else nil
15693 in (s := s'; index := 0; f ())
15694 end
15695local
15696 val memo = Array.array(numstates+numrules,ERROR)
15697 val _ =let fun g i=(Array.update(memo,i,REDUCE(i-numstates)); g(i+1))
15698 fun f i =
15699 if i=numstates then g i
15700 else (Array.update(memo,i,SHIFT (STATE i)); f (i+1))
15701 in f 0 handle Subscript => ()
15702 end
15703in
15704val entry_to_action = fn 0 => ACCEPT | 1 => ERROR | j => Array.sub(memo,(j-2))
15705end
15706val gotoT=Array.fromList(string_to_table(string_to_pairlist(NT,STATE),gotoT))
15707val actionRows=string_to_table(string_to_pairlist_default(T,entry_to_action),actionRows)
15708val actionRowNumbers = string_to_list actionRowNumbers
15709val actionT = let val actionRowLookUp=
15710let val a=Array.fromList(actionRows) in fn i=>Array.sub(a,i) end
15711in Array.fromList(map actionRowLookUp actionRowNumbers)
15712end
15713in LrTable.mkLrTable {actions=actionT,gotos=gotoT,numRules=numrules,
15714numStates=numstates,initialState=STATE 0}
15715end
15716end
15717local open Header in
15718type pos = int
15719type arg = Infix.InfEnv
15720structure MlyValue =
15721struct
15722datatype svalue = VOID | ntVOID of unit -> unit
15723 | LONGID of unit -> (string list*string)
15724 | ETYVAR of unit -> (string) | TYVAR of unit -> (string)
15725 | SYMBOL of unit -> (string) | ALPHA of unit -> (string)
15726 | CHAR of unit -> (char) | STRING of unit -> (string)
15727 | REAL of unit -> (real) | WORD of unit -> (word)
15728 | INT of unit -> (int) | NUMERIC of unit -> (int)
15729 | DIGIT of unit -> (int) | popLocalInfix of unit -> (unit)
15730 | pushLocalInfix of unit -> (unit) | popInfix of unit -> (unit)
15731 | pushInfix of unit -> (unit) | initInfix of unit -> (unit)
15732 | program_opt of unit -> (Program option)
15733 | program' of unit -> (Program)
15734 | program of unit -> (Program*Infix.InfEnv)
15735 | topdec_opt of unit -> (TopDec option)
15736 | topdec1 of unit -> (TopDec) | topdec of unit -> (TopDec)
15737 | AND_tyreadesc_opt__AND_funbind_opt of unit -> (TyReaDesc option*FunBind option)
15738 | tyreadesc__AND_funbind_opt of unit -> (TyReaDesc*FunBind option)
15739 | sigexp__AND_funbind_opt of unit -> (SigExp*FunBind option)
15740 | strexp__AND_funbind_opt of unit -> (StrExp*FunBind option)
15741 | AND_funbind_opt of unit -> (FunBind option)
15742 | funbind of unit -> (FunBind) | fundec of unit -> (FunDec)
15743 | AND_tyreadesc_opt__AND_strdesc_opt of unit -> (TyReaDesc option*StrDesc option)
15744 | tyreadesc__AND_strdesc_opt of unit -> (TyReaDesc*StrDesc option)
15745 | sigexp__AND_strdesc_opt of unit -> (SigExp*StrDesc option)
15746 | AND_strdesc_opt of unit -> (StrDesc option)
15747 | strdesc of unit -> (StrDesc)
15748 | AND_exdesc_opt of unit -> (ExDesc option)
15749 | exdesc of unit -> (ExDesc)
15750 | BAR_condesc_opt of unit -> (ConDesc option)
15751 | condesc of unit -> (ConDesc)
15752 | AND_datdesc_opt of unit -> (DatDesc option)
15753 | datdesc1 of unit -> (DatDesc) | datdesc0 of unit -> (DatDesc)
15754 | datdesc of unit -> (DatDesc)
15755 | AND_syndesc_opt of unit -> (SynDesc option)
15756 | syndesc of unit -> (SynDesc)
15757 | AND_typdesc_opt of unit -> (TypDesc option)
15758 | typdesc of unit -> (TypDesc)
15759 | AND_valdesc_opt of unit -> (ValDesc option)
15760 | valdesc of unit -> (ValDesc)
15761 | longstrid_EQUALS_list2 of unit -> (longStrId list)
15762 | longstrid_EQUALS_list1 of unit -> (longStrId list)
15763 | longtycon_EQUALS_list2 of unit -> (longTyCon list)
15764 | longtycon_EQUALS_list1 of unit -> (longTyCon list)
15765 | sigid_list2 of unit -> (SigId list) | spec1' of unit -> (Spec)
15766 | spec1 of unit -> (Spec) | spec of unit -> (Spec)
15767 | AND_tyreadesc_opt of unit -> (TyReaDesc option)
15768 | tyreadesc of unit -> (TyReaDesc)
15769 | AND_tyreadesc_opt__AND_sigbind_opt of unit -> (TyReaDesc option*SigBind option)
15770 | tyreadesc__AND_sigbind_opt of unit -> (TyReaDesc*SigBind option)
15771 | sigexp__AND_sigbind_opt of unit -> (SigExp*SigBind option)
15772 | AND_sigbind_opt of unit -> (SigBind option)
15773 | sigbind of unit -> (SigBind) | sigdec of unit -> (SigDec)
15774 | sigexp' of unit -> (SigExp) | sigexp of unit -> (SigExp)
15775 | COLON_sigexp_opt of unit -> (SigExp option)
15776 | AND_tyreadesc_opt__AND_strbind_opt of unit -> (TyReaDesc option*StrBind option)
15777 | tyreadesc__AND_strbind_opt of unit -> (TyReaDesc*StrBind option)
15778 | sigexp__AND_strbind_opt of unit -> (SigExp*StrBind option)
15779 | strexp__AND_strbind_opt of unit -> (StrExp*StrBind option)
15780 | AND_strbind_opt of unit -> (StrBind option)
15781 | strbind of unit -> (StrBind) | strdec1' of unit -> (StrDec)
15782 | strdec1 of unit -> (StrDec) | strdec of unit -> (StrDec)
15783 | strexp' of unit -> (StrExp) | strexp of unit -> (StrExp)
15784 | tyvar_COMMA_list1 of unit -> (TyVar list)
15785 | tyvarseq1 of unit -> (TyVarseq) | tyvarseq of unit -> (TyVarseq)
15786 | ty_COMMA_list2 of unit -> (Ty list) | tyseq of unit -> (Tyseq)
15787 | COMMA_tyrow_opt of unit -> (TyRow option)
15788 | tyrow_opt of unit -> (TyRow option) | tyrow of unit -> (TyRow)
15789 | atty of unit -> (Ty) | consty of unit -> (Ty)
15790 | ty_STAR_list of unit -> (Ty list) | tupty of unit -> (Ty)
15791 | ty of unit -> (Ty) | COLON_ty_list1 of unit -> (Ty list)
15792 | atpat_list2 of unit -> (AtPat list)
15793 | atpat_list1 of unit -> (AtPat list) | pat of unit -> (Pat)
15794 | AS_pat_opt of unit -> (Pat option)
15795 | COLON_ty_opt of unit -> (Ty option)
15796 | COMMA_patrow_opt of unit -> (PatRow option)
15797 | patrow_opt of unit -> (PatRow option)
15798 | patrow of unit -> (PatRow)
15799 | pat_COMMA_list2 of unit -> (Pat list)
15800 | pat_COMMA_list1 of unit -> (Pat list)
15801 | pat_COMMA_list0 of unit -> (Pat list) | atpat' of unit -> (AtPat)
15802 | atpat of unit -> (AtPat)
15803 | AND_exbind_opt of unit -> (ExBind option)
15804 | exbind of unit -> (ExBind) | OF_ty_opt of unit -> (Ty option)
15805 | BAR_conbind_opt of unit -> (ConBind option)
15806 | conbind of unit -> (ConBind)
15807 | AND_datbind_opt of unit -> (DatBind option)
15808 | datbind1 of unit -> (DatBind) | datbind0 of unit -> (DatBind)
15809 | datbind of unit -> (DatBind)
15810 | AND_typbind_opt of unit -> (TypBind option)
15811 | typbind of unit -> (TypBind) | fmrule of unit -> (Fmrule)
15812 | BAR_fmatch_opt of unit -> (Fmatch option)
15813 | fmatch of unit -> (Fmatch)
15814 | AND_fvalbind_opt of unit -> (FvalBind option)
15815 | fvalbind of unit -> (FvalBind)
15816 | AND_valbind_opt of unit -> (ValBind option)
15817 | valbind of unit -> (ValBind) | d_opt of unit -> (int)
15818 | longstrid_list1 of unit -> (longStrId list)
15819 | vid_list1 of unit -> (VId list)
15820 | WITHTYPE_typbind_opt of unit -> (TypBind option)
15821 | dec1' of unit -> (Dec) | dec1 of unit -> (Dec)
15822 | dec of unit -> (Dec) | mrule of unit -> (Mrule)
15823 | BAR_match_opt of unit -> (Match option)
15824 | match of unit -> (Match) | exp of unit -> (Exp)
15825 | infexp of unit -> (InfExp) | appexp of unit -> (AppExp)
15826 | COMMA_exprow_opt of unit -> (ExpRow option)
15827 | exprow_opt of unit -> (ExpRow option)
15828 | exprow of unit -> (ExpRow)
15829 | exp_SEMICOLON_list2 of unit -> (Exp list)
15830 | exp_SEMICOLON_list1 of unit -> (Exp list)
15831 | exp_COMMA_list2 of unit -> (Exp list)
15832 | exp_COMMA_list1 of unit -> (Exp list)
15833 | exp_COMMA_list0 of unit -> (Exp list) | atexp of unit -> (AtExp)
15834 | OP_opt of unit -> (Op) | longstrid of unit -> (longStrId)
15835 | longtycon of unit -> (longTyCon) | longvid' of unit -> (longVId)
15836 | longvid of unit -> (longVId) | funid of unit -> (FunId)
15837 | sigid of unit -> (SigId) | strid of unit -> (StrId)
15838 | tyvar of unit -> (TyVar) | tycon of unit -> (TyCon)
15839 | vid' of unit -> (VId) | vid of unit -> (VId)
15840 | lab of unit -> (Lab) | d of unit -> (int)
15841 | scon of unit -> (SCon)
15842end
15843type svalue = MlyValue.svalue
15844type result = Program*Infix.InfEnv
15845end
15846structure EC=
15847struct
15848open LrTable
15849val is_keyword =
15850fn (T 1) => true | (T 2) => true | (T 3) => true | (T 4) => true | (T
158515) => true | (T 6) => true | (T 7) => true | (T 8) => true | (T 9)
15852 => true | (T 10) => true | (T 11) => true | (T 12) => true | (T 13)
15853 => true | (T 14) => true | (T 15) => true | (T 16) => true | (T 17)
15854 => true | (T 18) => true | (T 19) => true | (T 20) => true | (T 21)
15855 => true | (T 22) => true | (T 23) => true | (T 24) => true | (T 25)
15856 => true | (T 26) => true | (T 27) => true | (T 28) => true | (T 29)
15857 => true | (T 30) => true | (T 31) => true | (T 32) => true | (T 49)
15858 => true | (T 50) => true | (T 51) => true | (T 52) => true | (T 53)
15859 => true | (T 54) => true | (T 55) => true | (T 56) => true | (T 57)
15860 => true | _ => false
15861val preferred_change =
15862nil
15863val noShift =
15864fn (T 0) => true | _ => false
15865val showTerminal =
15866fn (T 0) => "EOF"
15867 | (T 1) => "ABSTYPE"
15868 | (T 2) => "AND"
15869 | (T 3) => "ANDALSO"
15870 | (T 4) => "AS"
15871 | (T 5) => "CASE"
15872 | (T 6) => "DO"
15873 | (T 7) => "DATATYPE"
15874 | (T 8) => "ELSE"
15875 | (T 9) => "END"
15876 | (T 10) => "EXCEPTION"
15877 | (T 11) => "FN"
15878 | (T 12) => "FUN"
15879 | (T 13) => "HANDLE"
15880 | (T 14) => "IF"
15881 | (T 15) => "IN"
15882 | (T 16) => "INFIX"
15883 | (T 17) => "INFIXR"
15884 | (T 18) => "LET"
15885 | (T 19) => "LOCAL"
15886 | (T 20) => "NONFIX"
15887 | (T 21) => "OF"
15888 | (T 22) => "OP"
15889 | (T 23) => "OPEN"
15890 | (T 24) => "ORELSE"
15891 | (T 25) => "RAISE"
15892 | (T 26) => "REC"
15893 | (T 27) => "THEN"
15894 | (T 28) => "TYPE"
15895 | (T 29) => "VAL"
15896 | (T 30) => "WITH"
15897 | (T 31) => "WITHTYPE"
15898 | (T 32) => "WHILE"
15899 | (T 33) => "LPAR"
15900 | (T 34) => "RPAR"
15901 | (T 35) => "LBRACK"
15902 | (T 36) => "RBRACK"
15903 | (T 37) => "LBRACE"
15904 | (T 38) => "RBRACE"
15905 | (T 39) => "COMMA"
15906 | (T 40) => "COLON"
15907 | (T 41) => "SEMICOLON"
15908 | (T 42) => "DOTS"
15909 | (T 43) => "UNDERBAR"
15910 | (T 44) => "BAR"
15911 | (T 45) => "EQUALS"
15912 | (T 46) => "DARROW"
15913 | (T 47) => "ARROW"
15914 | (T 48) => "HASH"
15915 | (T 49) => "EQTYPE"
15916 | (T 50) => "FUNCTOR"
15917 | (T 51) => "INCLUDE"
15918 | (T 52) => "SHARING"
15919 | (T 53) => "SIG"
15920 | (T 54) => "SIGNATURE"
15921 | (T 55) => "STRUCT"
15922 | (T 56) => "STRUCTURE"
15923 | (T 57) => "WHERE"
15924 | (T 58) => "COLONGREATER"
15925 | (T 59) => "ZERO"
15926 | (T 60) => "DIGIT"
15927 | (T 61) => "NUMERIC"
15928 | (T 62) => "INT"
15929 | (T 63) => "WORD"
15930 | (T 64) => "REAL"
15931 | (T 65) => "STRING"
15932 | (T 66) => "CHAR"
15933 | (T 67) => "ALPHA"
15934 | (T 68) => "SYMBOL"
15935 | (T 69) => "STAR"
15936 | (T 70) => "TYVAR"
15937 | (T 71) => "ETYVAR"
15938 | (T 72) => "LONGID"
15939 | _ => "bogus-term"
15940local open Header in
15941val errtermvalue=
15942fn _ => MlyValue.VOID
15943end
15944val terms = (T 0) :: (T 1) :: (T 2) :: (T 3) :: (T 4) :: (T 5) :: (T 6
15945) :: (T 7) :: (T 8) :: (T 9) :: (T 10) :: (T 11) :: (T 12) :: (T 13)
15946 :: (T 14) :: (T 15) :: (T 16) :: (T 17) :: (T 18) :: (T 19) :: (T 20)
15947 :: (T 21) :: (T 22) :: (T 23) :: (T 24) :: (T 25) :: (T 26) :: (T 27)
15948 :: (T 28) :: (T 29) :: (T 30) :: (T 31) :: (T 32) :: (T 33) :: (T 34)
15949 :: (T 35) :: (T 36) :: (T 37) :: (T 38) :: (T 39) :: (T 40) :: (T 41)
15950 :: (T 42) :: (T 43) :: (T 44) :: (T 45) :: (T 46) :: (T 47) :: (T 48)
15951 :: (T 49) :: (T 50) :: (T 51) :: (T 52) :: (T 53) :: (T 54) :: (T 55)
15952 :: (T 56) :: (T 57) :: (T 58) :: (T 59) :: (T 69) :: nil
15953end
15954structure Actions =
15955struct
15956type int = Int.int
15957exception mlyAction of int
15958local open Header in
15959val actions =
15960fn (i392:int,defaultPos,stack,
15961 (J0):arg) =>
15962case (i392,stack)
15963of (0,rest671) => let val result=MlyValue.initInfix(fn _ => (
15964 initJandJ'(J0) ))
15965 in (LrTable.NT 144,(result,defaultPos,defaultPos),rest671) end
15966| (1,rest671) => let val result=MlyValue.pushInfix(fn _ => ( pushJ() )
15967)
15968 in (LrTable.NT 145,(result,defaultPos,defaultPos),rest671) end
15969| (2,rest671) => let val result=MlyValue.popInfix(fn _ => ( popJ() ))
15970 in (LrTable.NT 146,(result,defaultPos,defaultPos),rest671) end
15971| (3,rest671) => let val result=MlyValue.pushLocalInfix(fn _ => (
15972 pushJ'shiftJ() ))
15973 in (LrTable.NT 147,(result,defaultPos,defaultPos),rest671) end
15974| (4,rest671) => let val result=MlyValue.popLocalInfix(fn _ => (
15975 popJandJ'() ))
15976 in (LrTable.NT 148,(result,defaultPos,defaultPos),rest671) end
15977| (5,(_,(_,ZERO1left,ZERO1right))::rest671) => let val result=
15978MlyValue.scon(fn _ => ( SCon.fromInt 0 ))
15979 in (LrTable.NT 0,(result,ZERO1left,ZERO1right),rest671) end
15980| (6,(_,(MlyValue.DIGIT DIGIT1,DIGIT1left,DIGIT1right))::rest671) =>
15981let val result=MlyValue.scon(fn _ => let val DIGIT as DIGIT1=DIGIT1 ()
15982 in ( SCon.fromInt DIGIT ) end
15983)
15984 in (LrTable.NT 0,(result,DIGIT1left,DIGIT1right),rest671) end
15985| (7,(_,(MlyValue.NUMERIC NUMERIC1,NUMERIC1left,NUMERIC1right))::
15986rest671) => let val result=MlyValue.scon(fn _ => let val NUMERIC as
15987NUMERIC1=NUMERIC1 ()
15988 in ( SCon.fromInt NUMERIC ) end
15989)
15990 in (LrTable.NT 0,(result,NUMERIC1left,NUMERIC1right),rest671) end
15991| (8,(_,(MlyValue.INT INT1,INT1left,INT1right))::rest671) => let val
15992result=MlyValue.scon(fn _ => let val INT as INT1=INT1 ()
15993 in ( SCon.fromInt INT ) end
15994)
15995 in (LrTable.NT 0,(result,INT1left,INT1right),rest671) end
15996| (9,(_,(MlyValue.WORD WORD1,WORD1left,WORD1right))::rest671) => let
15997val result=MlyValue.scon(fn _ => let val WORD as WORD1=WORD1 ()
15998 in ( SCon.fromWord WORD ) end
15999)
16000 in (LrTable.NT 0,(result,WORD1left,WORD1right),rest671) end
16001| (10,(_,(MlyValue.STRING STRING1,STRING1left,STRING1right))::rest671)
16002 => let val result=MlyValue.scon(fn _ => let val STRING as STRING1=
16003STRING1 ()
16004 in ( SCon.fromString STRING ) end
16005)
16006 in (LrTable.NT 0,(result,STRING1left,STRING1right),rest671) end
16007| (11,(_,(MlyValue.CHAR CHAR1,CHAR1left,CHAR1right))::rest671) => let
16008val result=MlyValue.scon(fn _ => let val CHAR as CHAR1=CHAR1 ()
16009 in ( SCon.fromChar CHAR ) end
16010)
16011 in (LrTable.NT 0,(result,CHAR1left,CHAR1right),rest671) end
16012| (12,(_,(MlyValue.REAL REAL1,REAL1left,REAL1right))::rest671) => let
16013val result=MlyValue.scon(fn _ => let val REAL as REAL1=REAL1 ()
16014 in ( SCon.fromReal REAL ) end
16015)
16016 in (LrTable.NT 0,(result,REAL1left,REAL1right),rest671) end
16017| (13,(_,(_,ZERO1left,ZERO1right))::rest671) => let val result=
16018MlyValue.d(fn _ => ( 0 ))
16019 in (LrTable.NT 1,(result,ZERO1left,ZERO1right),rest671) end
16020| (14,(_,(MlyValue.DIGIT DIGIT1,DIGIT1left,DIGIT1right))::rest671) =>
16021let val result=MlyValue.d(fn _ => let val DIGIT as DIGIT1=DIGIT1 ()
16022 in ( DIGIT ) end
16023)
16024 in (LrTable.NT 1,(result,DIGIT1left,DIGIT1right),rest671) end
16025| (15,(_,(MlyValue.ALPHA ALPHA1,ALPHA1left,ALPHA1right))::rest671) =>
16026let val result=MlyValue.lab(fn _ => let val ALPHA as ALPHA1=ALPHA1 ()
16027 in ( Lab.fromString ALPHA ) end
16028)
16029 in (LrTable.NT 2,(result,ALPHA1left,ALPHA1right),rest671) end
16030| (16,(_,(MlyValue.SYMBOL SYMBOL1,SYMBOL1left,SYMBOL1right))::rest671)
16031 => let val result=MlyValue.lab(fn _ => let val SYMBOL as SYMBOL1=
16032SYMBOL1 ()
16033 in ( Lab.fromString SYMBOL ) end
16034)
16035 in (LrTable.NT 2,(result,SYMBOL1left,SYMBOL1right),rest671) end
16036| (17,(_,(_,STAR1left,STAR1right))::rest671) => let val result=
16037MlyValue.lab(fn _ => ( Lab.fromString "*" ))
16038 in (LrTable.NT 2,(result,STAR1left,STAR1right),rest671) end
16039| (18,(_,(MlyValue.DIGIT DIGIT1,DIGIT1left,DIGIT1right))::rest671) =>
16040let val result=MlyValue.lab(fn _ => let val DIGIT as DIGIT1=DIGIT1 ()
16041 in ( Lab.fromInt DIGIT ) end
16042)
16043 in (LrTable.NT 2,(result,DIGIT1left,DIGIT1right),rest671) end
16044| (19,(_,(MlyValue.NUMERIC NUMERIC1,NUMERIC1left,NUMERIC1right))::
16045rest671) => let val result=MlyValue.lab(fn _ => let val NUMERIC as
16046NUMERIC1=NUMERIC1 ()
16047 in ( Lab.fromInt NUMERIC ) end
16048)
16049 in (LrTable.NT 2,(result,NUMERIC1left,NUMERIC1right),rest671) end
16050| (20,(_,(MlyValue.vid' vid'1,vid'1left,vid'1right))::rest671) => let
16051val result=MlyValue.vid(fn _ => let val vid' as vid'1=vid'1 ()
16052 in ( vid' ) end
16053)
16054 in (LrTable.NT 3,(result,vid'1left,vid'1right),rest671) end
16055| (21,(_,(_,EQUALS1left,EQUALS1right))::rest671) => let val result=
16056MlyValue.vid(fn _ => ( VId.fromString "=" ))
16057 in (LrTable.NT 3,(result,EQUALS1left,EQUALS1right),rest671) end
16058| (22,(_,(MlyValue.ALPHA ALPHA1,ALPHA1left,ALPHA1right))::rest671) =>
16059let val result=MlyValue.vid'(fn _ => let val ALPHA as ALPHA1=ALPHA1 ()
16060 in ( VId.fromString ALPHA ) end
16061)
16062 in (LrTable.NT 4,(result,ALPHA1left,ALPHA1right),rest671) end
16063| (23,(_,(MlyValue.SYMBOL SYMBOL1,SYMBOL1left,SYMBOL1right))::rest671)
16064 => let val result=MlyValue.vid'(fn _ => let val SYMBOL as SYMBOL1=
16065SYMBOL1 ()
16066 in ( VId.fromString SYMBOL ) end
16067)
16068 in (LrTable.NT 4,(result,SYMBOL1left,SYMBOL1right),rest671) end
16069| (24,(_,(_,STAR1left,STAR1right))::rest671) => let val result=
16070MlyValue.vid'(fn _ => ( VId.fromString "*" ))
16071 in (LrTable.NT 4,(result,STAR1left,STAR1right),rest671) end
16072| (25,(_,(MlyValue.ALPHA ALPHA1,ALPHA1left,ALPHA1right))::rest671) =>
16073let val result=MlyValue.tycon(fn _ => let val ALPHA as ALPHA1=ALPHA1
16074()
16075 in ( TyCon.fromString ALPHA ) end
16076)
16077 in (LrTable.NT 5,(result,ALPHA1left,ALPHA1right),rest671) end
16078| (26,(_,(MlyValue.SYMBOL SYMBOL1,SYMBOL1left,SYMBOL1right))::rest671)
16079 => let val result=MlyValue.tycon(fn _ => let val SYMBOL as SYMBOL1=
16080SYMBOL1 ()
16081 in ( TyCon.fromString SYMBOL ) end
16082)
16083 in (LrTable.NT 5,(result,SYMBOL1left,SYMBOL1right),rest671) end
16084| (27,(_,(MlyValue.TYVAR TYVAR1,TYVAR1left,TYVAR1right))::rest671) =>
16085let val result=MlyValue.tyvar(fn _ => let val TYVAR as TYVAR1=TYVAR1
16086()
16087 in ( TyVar.fromString TYVAR ) end
16088)
16089 in (LrTable.NT 6,(result,TYVAR1left,TYVAR1right),rest671) end
16090| (28,(_,(MlyValue.ALPHA ALPHA1,ALPHA1left,ALPHA1right))::rest671) =>
16091let val result=MlyValue.strid(fn _ => let val ALPHA as ALPHA1=ALPHA1
16092()
16093 in ( StrId.fromString ALPHA ) end
16094)
16095 in (LrTable.NT 7,(result,ALPHA1left,ALPHA1right),rest671) end
16096| (29,(_,(MlyValue.ALPHA ALPHA1,ALPHA1left,ALPHA1right))::rest671) =>
16097let val result=MlyValue.sigid(fn _ => let val ALPHA as ALPHA1=ALPHA1
16098()
16099 in ( SigId.fromString ALPHA ) end
16100)
16101 in (LrTable.NT 8,(result,ALPHA1left,ALPHA1right),rest671) end
16102| (30,(_,(MlyValue.ALPHA ALPHA1,ALPHA1left,ALPHA1right))::rest671) =>
16103let val result=MlyValue.funid(fn _ => let val ALPHA as ALPHA1=ALPHA1
16104()
16105 in ( FunId.fromString ALPHA ) end
16106)
16107 in (LrTable.NT 9,(result,ALPHA1left,ALPHA1right),rest671) end
16108| (31,(_,(MlyValue.longvid' longvid'1,longvid'1left,longvid'1right))::
16109rest671) => let val result=MlyValue.longvid(fn _ => let val longvid'
16110 as longvid'1=longvid'1 ()
16111 in ( longvid' ) end
16112)
16113 in (LrTable.NT 10,(result,longvid'1left,longvid'1right),rest671) end
16114| (32,(_,(_,EQUALS1left,EQUALS1right))::rest671) => let val result=
16115MlyValue.longvid(fn _ => ( LongVId.fromId(VId.fromString "=") ))
16116 in (LrTable.NT 10,(result,EQUALS1left,EQUALS1right),rest671) end
16117| (33,(_,(MlyValue.vid' vid'1,vid'1left,vid'1right))::rest671) => let
16118val result=MlyValue.longvid'(fn _ => let val vid' as vid'1=vid'1 ()
16119 in ( LongVId.fromId vid' ) end
16120)
16121 in (LrTable.NT 11,(result,vid'1left,vid'1right),rest671) end
16122| (34,(_,(MlyValue.LONGID LONGID1,LONGID1left,LONGID1right))::rest671)
16123 => let val result=MlyValue.longvid'(fn _ => let val LONGID as LONGID1
16124=LONGID1 ()
16125 in ( LongVId.implode(toLongId VId.fromString LONGID) ) end
16126)
16127 in (LrTable.NT 11,(result,LONGID1left,LONGID1right),rest671) end
16128| (35,(_,(MlyValue.tycon tycon1,tycon1left,tycon1right))::rest671) =>
16129let val result=MlyValue.longtycon(fn _ => let val tycon as tycon1=
16130tycon1 ()
16131 in ( LongTyCon.fromId tycon ) end
16132)
16133 in (LrTable.NT 12,(result,tycon1left,tycon1right),rest671) end
16134| (36,(_,(MlyValue.LONGID LONGID1,LONGID1left,LONGID1right))::rest671)
16135 => let val result=MlyValue.longtycon(fn _ => let val LONGID as
16136LONGID1=LONGID1 ()
16137 in ( LongTyCon.implode(toLongId TyCon.fromString LONGID) ) end
16138)
16139 in (LrTable.NT 12,(result,LONGID1left,LONGID1right),rest671) end
16140| (37,(_,(MlyValue.strid strid1,strid1left,strid1right))::rest671) =>
16141let val result=MlyValue.longstrid(fn _ => let val strid as strid1=
16142strid1 ()
16143 in ( LongStrId.fromId strid ) end
16144)
16145 in (LrTable.NT 13,(result,strid1left,strid1right),rest671) end
16146| (38,(_,(MlyValue.LONGID LONGID1,LONGID1left,LONGID1right))::rest671)
16147 => let val result=MlyValue.longstrid(fn _ => let val LONGID as
16148LONGID1=LONGID1 ()
16149 in ( LongStrId.implode(toLongId StrId.fromString LONGID) ) end
16150)
16151 in (LrTable.NT 13,(result,LONGID1left,LONGID1right),rest671) end
16152| (39,(_,(_,OP1left,OP1right))::rest671) => let val result=
16153MlyValue.OP_opt(fn _ => ( WITHOp ))
16154 in (LrTable.NT 14,(result,OP1left,OP1right),rest671) end
16155| (40,rest671) => let val result=MlyValue.OP_opt(fn _ => ( SANSOp ))
16156 in (LrTable.NT 14,(result,defaultPos,defaultPos),rest671) end
16157| (41,(_,(MlyValue.scon scon1,sconleft as scon1left,sconright as
16158scon1right))::rest671) => let val result=MlyValue.atexp(fn _ => let
16159val scon as scon1=scon1 ()
16160 in ( SCONAtExp(I(sconleft,sconright), scon) ) end
16161)
16162 in (LrTable.NT 15,(result,scon1left,scon1right),rest671) end
16163| (42,(_,(MlyValue.longvid longvid1,_,longvidright as longvid1right))
16164::(_,(MlyValue.OP_opt OP_opt1,OP_optleft as OP_opt1left,_))::rest671)
16165 => let val result=MlyValue.atexp(fn _ => let val OP_opt as OP_opt1=
16166OP_opt1 ()
16167val longvid as longvid1=longvid1 ()
16168 in (
16169 LONGVIDAtExp(I(OP_optleft,longvidright),
16170 OP_opt, longvid)
16171) end
16172)
16173 in (LrTable.NT 15,(result,OP_opt1left,longvid1right),rest671) end
16174| (43,(_,(_,_,RBRACEright as RBRACE1right))::(_,(MlyValue.exprow_opt
16175exprow_opt1,_,_))::(_,(_,LBRACEleft as LBRACE1left,_))::rest671) =>
16176let val result=MlyValue.atexp(fn _ => let val exprow_opt as
16177exprow_opt1=exprow_opt1 ()
16178 in ( RECORDAtExp(I(LBRACEleft,RBRACEright), exprow_opt) ) end
16179)
16180 in (LrTable.NT 15,(result,LBRACE1left,RBRACE1right),rest671) end
16181| (44,(_,(MlyValue.lab lab1,_,labright as lab1right))::(_,(_,HASHleft
16182 as HASH1left,_))::rest671) => let val result=MlyValue.atexp(fn _ =>
16183let val lab as lab1=lab1 ()
16184 in ( HASHAtExp(I(HASHleft,labright), lab) ) end
16185)
16186 in (LrTable.NT 15,(result,HASH1left,lab1right),rest671) end
16187| (45,(_,(_,_,RPARright as RPAR1right))::(_,(_,LPARleft as LPAR1left,_
16188))::rest671) => let val result=MlyValue.atexp(fn _ => (
16189 UNITAtExp(I(LPARleft,RPARright)) ))
16190 in (LrTable.NT 15,(result,LPAR1left,RPAR1right),rest671) end
16191| (46,(_,(_,_,RPARright as RPAR1right))::(_,(MlyValue.exp_COMMA_list2
16192exp_COMMA_list21,_,_))::(_,(_,LPARleft as LPAR1left,_))::rest671) =>
16193let val result=MlyValue.atexp(fn _ => let val exp_COMMA_list2 as
16194exp_COMMA_list21=exp_COMMA_list21 ()
16195 in ( TUPLEAtExp(I(LPARleft,RPARright), exp_COMMA_list2) ) end
16196)
16197 in (LrTable.NT 15,(result,LPAR1left,RPAR1right),rest671) end
16198| (47,(_,(_,_,RBRACKright as RBRACK1right))::(_,(
16199MlyValue.exp_COMMA_list0 exp_COMMA_list01,_,_))::(_,(_,LBRACKleft as
16200LBRACK1left,_))::rest671) => let val result=MlyValue.atexp(fn _ =>
16201let val exp_COMMA_list0 as exp_COMMA_list01=exp_COMMA_list01 ()
16202 in ( LISTAtExp(I(LBRACKleft,RBRACKright),
16203 exp_COMMA_list0 ))
16204 end
16205)
16206 in (LrTable.NT 15,(result,LBRACK1left,RBRACK1right),rest671) end
16207| (48,(_,(_,_,RPARright as RPAR1right))::(_,(
16208MlyValue.exp_SEMICOLON_list2 exp_SEMICOLON_list21,_,_))::(_,(_,
16209LPARleft as LPAR1left,_))::rest671) => let val result=MlyValue.atexp(
16210fn _ => let val exp_SEMICOLON_list2 as exp_SEMICOLON_list21=
16211exp_SEMICOLON_list21 ()
16212 in ( SEQAtExp(I(LPARleft,RPARright), exp_SEMICOLON_list2) ) end
16213)
16214 in (LrTable.NT 15,(result,LPAR1left,RPAR1right),rest671) end
16215| (49,(_,(_,_,ENDright as END1right))::(_,(MlyValue.popInfix popInfix1
16216,_,_))::(_,(MlyValue.exp_SEMICOLON_list1 exp_SEMICOLON_list11,_,_))::_
16217::(_,(MlyValue.dec dec1,_,_))::(_,(MlyValue.pushInfix pushInfix1,_,_))
16218::(_,(_,LETleft as LET1left,_))::rest671) => let val result=
16219MlyValue.atexp(fn _ => let val pushInfix1=pushInfix1 ()
16220val dec as dec1=dec1 ()
16221val exp_SEMICOLON_list1 as exp_SEMICOLON_list11=exp_SEMICOLON_list11
16222()
16223val popInfix1=popInfix1 ()
16224 in ( LETAtExp(I(LETleft,ENDright),
16225 dec, exp_SEMICOLON_list1) )
16226 end
16227)
16228 in (LrTable.NT 15,(result,LET1left,END1right),rest671) end
16229| (50,(_,(_,_,RPARright as RPAR1right))::(_,(MlyValue.exp exp1,_,_))::
16230(_,(_,LPARleft as LPAR1left,_))::rest671) => let val result=
16231MlyValue.atexp(fn _ => let val exp as exp1=exp1 ()
16232 in ( PARAtExp(I(LPARleft,RPARright), exp) ) end
16233)
16234 in (LrTable.NT 15,(result,LPAR1left,RPAR1right),rest671) end
16235| (51,(_,(MlyValue.exp_COMMA_list1 exp_COMMA_list11,
16236exp_COMMA_list11left,exp_COMMA_list11right))::rest671) => let val
16237result=MlyValue.exp_COMMA_list0(fn _ => let val exp_COMMA_list1 as
16238exp_COMMA_list11=exp_COMMA_list11 ()
16239 in ( exp_COMMA_list1 ) end
16240)
16241 in (LrTable.NT 16,(result,exp_COMMA_list11left,exp_COMMA_list11right)
16242,rest671) end
16243| (52,rest671) => let val result=MlyValue.exp_COMMA_list0(fn _ => (
16244 [] ))
16245 in (LrTable.NT 16,(result,defaultPos,defaultPos),rest671) end
16246| (53,(_,(MlyValue.exp_COMMA_list1 exp_COMMA_list11,_,
16247exp_COMMA_list11right))::_::(_,(MlyValue.exp exp1,exp1left,_))::
16248rest671) => let val result=MlyValue.exp_COMMA_list1(fn _ => let val
16249exp as exp1=exp1 ()
16250val exp_COMMA_list1 as exp_COMMA_list11=exp_COMMA_list11 ()
16251 in ( exp::exp_COMMA_list1 ) end
16252)
16253 in (LrTable.NT 17,(result,exp1left,exp_COMMA_list11right),rest671)
16254 end
16255| (54,(_,(MlyValue.exp exp1,exp1left,exp1right))::rest671) => let val
16256result=MlyValue.exp_COMMA_list1(fn _ => let val exp as exp1=exp1 ()
16257 in ( exp::[] ) end
16258)
16259 in (LrTable.NT 17,(result,exp1left,exp1right),rest671) end
16260| (55,(_,(MlyValue.exp_COMMA_list1 exp_COMMA_list11,_,
16261exp_COMMA_list11right))::_::(_,(MlyValue.exp exp1,exp1left,_))::
16262rest671) => let val result=MlyValue.exp_COMMA_list2(fn _ => let val
16263exp as exp1=exp1 ()
16264val exp_COMMA_list1 as exp_COMMA_list11=exp_COMMA_list11 ()
16265 in ( exp::exp_COMMA_list1 ) end
16266)
16267 in (LrTable.NT 18,(result,exp1left,exp_COMMA_list11right),rest671)
16268 end
16269| (56,(_,(MlyValue.exp_SEMICOLON_list1 exp_SEMICOLON_list11,_,
16270exp_SEMICOLON_list11right))::_::(_,(MlyValue.exp exp1,exp1left,_))::
16271rest671) => let val result=MlyValue.exp_SEMICOLON_list1(fn _ => let
16272val exp as exp1=exp1 ()
16273val exp_SEMICOLON_list1 as exp_SEMICOLON_list11=exp_SEMICOLON_list11
16274()
16275 in ( exp::exp_SEMICOLON_list1 ) end
16276)
16277 in (LrTable.NT 19,(result,exp1left,exp_SEMICOLON_list11right),rest671
16278) end
16279| (57,(_,(MlyValue.exp exp1,exp1left,exp1right))::rest671) => let val
16280result=MlyValue.exp_SEMICOLON_list1(fn _ => let val exp as exp1=exp1
16281()
16282 in ( exp::[] ) end
16283)
16284 in (LrTable.NT 19,(result,exp1left,exp1right),rest671) end
16285| (58,(_,(MlyValue.exp_SEMICOLON_list2 exp_SEMICOLON_list21,_,
16286exp_SEMICOLON_list21right))::_::(_,(MlyValue.exp exp1,exp1left,_))::
16287rest671) => let val result=MlyValue.exp_SEMICOLON_list2(fn _ => let
16288val exp as exp1=exp1 ()
16289val exp_SEMICOLON_list2 as exp_SEMICOLON_list21=exp_SEMICOLON_list21
16290()
16291 in ( exp::exp_SEMICOLON_list2 ) end
16292)
16293 in (LrTable.NT 20,(result,exp1left,exp_SEMICOLON_list21right),rest671
16294) end
16295| (59,(_,(MlyValue.exp exp2,_,exp2right))::_::(_,(MlyValue.exp exp1,
16296exp1left,_))::rest671) => let val result=MlyValue.exp_SEMICOLON_list2(
16297fn _ => let val exp1=exp1 ()
16298val exp2=exp2 ()
16299 in ( [exp1, exp2] ) end
16300)
16301 in (LrTable.NT 20,(result,exp1left,exp2right),rest671) end
16302| (60,(_,(MlyValue.COMMA_exprow_opt COMMA_exprow_opt1,_,
16303COMMA_exprow_optright as COMMA_exprow_opt1right))::(_,(MlyValue.exp
16304exp1,_,_))::_::(_,(MlyValue.lab lab1,lableft as lab1left,_))::rest671)
16305 => let val result=MlyValue.exprow(fn _ => let val lab as lab1=lab1 ()
16306val exp as exp1=exp1 ()
16307val COMMA_exprow_opt as COMMA_exprow_opt1=COMMA_exprow_opt1 ()
16308 in (
16309 ExpRow(I(lableft,COMMA_exprow_optright),
16310 lab, exp, COMMA_exprow_opt)
16311) end
16312)
16313 in (LrTable.NT 21,(result,lab1left,COMMA_exprow_opt1right),rest671)
16314 end
16315| (61,(_,(MlyValue.exprow exprow1,_,exprow1right))::(_,(_,COMMA1left,_
16316))::rest671) => let val result=MlyValue.COMMA_exprow_opt(fn _ => let
16317val exprow as exprow1=exprow1 ()
16318 in ( SOME exprow ) end
16319)
16320 in (LrTable.NT 23,(result,COMMA1left,exprow1right),rest671) end
16321| (62,rest671) => let val result=MlyValue.COMMA_exprow_opt(fn _ => (
16322 NONE ))
16323 in (LrTable.NT 23,(result,defaultPos,defaultPos),rest671) end
16324| (63,(_,(MlyValue.exprow exprow1,exprow1left,exprow1right))::rest671)
16325 => let val result=MlyValue.exprow_opt(fn _ => let val exprow as
16326exprow1=exprow1 ()
16327 in ( SOME exprow ) end
16328)
16329 in (LrTable.NT 22,(result,exprow1left,exprow1right),rest671) end
16330| (64,rest671) => let val result=MlyValue.exprow_opt(fn _ => ( NONE ))
16331 in (LrTable.NT 22,(result,defaultPos,defaultPos),rest671) end
16332| (65,(_,(MlyValue.atexp atexp1,atexp1left,atexp1right))::rest671) =>
16333let val result=MlyValue.appexp(fn _ => let val atexp as atexp1=atexp1
16334()
16335 in ( atexp::[] ) end
16336)
16337 in (LrTable.NT 24,(result,atexp1left,atexp1right),rest671) end
16338| (66,(_,(MlyValue.atexp atexp1,_,atexp1right))::(_,(MlyValue.appexp
16339appexp1,appexp1left,_))::rest671) => let val result=MlyValue.appexp(
16340fn _ => let val appexp as appexp1=appexp1 ()
16341val atexp as atexp1=atexp1 ()
16342 in ( atexp::appexp ) end
16343)
16344 in (LrTable.NT 24,(result,appexp1left,atexp1right),rest671) end
16345| (67,(_,(MlyValue.appexp appexp1,appexp1left,appexp1right))::rest671)
16346 => let val result=MlyValue.infexp(fn _ => let val appexp as appexp1=
16347appexp1 ()
16348 in ( Infix.parseExp(!J, List.rev appexp) ) end
16349)
16350 in (LrTable.NT 25,(result,appexp1left,appexp1right),rest671) end
16351| (68,(_,(MlyValue.infexp infexp1,infexp1left,infexp1right))::rest671)
16352 => let val result=MlyValue.exp(fn _ => let val infexp as infexp1=
16353infexp1 ()
16354 in ( infexp ) end
16355)
16356 in (LrTable.NT 26,(result,infexp1left,infexp1right),rest671) end
16357| (69,(_,(MlyValue.ty ty1,_,tyright as ty1right))::_::(_,(MlyValue.exp
16358 exp1,expleft as exp1left,_))::rest671) => let val result=MlyValue.exp
16359(fn _ => let val exp as exp1=exp1 ()
16360val ty as ty1=ty1 ()
16361 in ( TYPEDExp(I(expleft,tyright), exp, ty) ) end
16362)
16363 in (LrTable.NT 26,(result,exp1left,ty1right),rest671) end
16364| (70,(_,(MlyValue.exp exp2,_,exp2right))::_::(_,(MlyValue.exp exp1,
16365exp1left,_))::rest671) => let val result=MlyValue.exp(fn _ => let val
16366exp1=exp1 ()
16367val exp2=exp2 ()
16368 in ( ANDALSOExp(I(exp1left,exp2right), exp1, exp2)) end
16369)
16370 in (LrTable.NT 26,(result,exp1left,exp2right),rest671) end
16371| (71,(_,(MlyValue.exp exp2,_,exp2right))::_::(_,(MlyValue.exp exp1,
16372exp1left,_))::rest671) => let val result=MlyValue.exp(fn _ => let val
16373exp1=exp1 ()
16374val exp2=exp2 ()
16375 in ( ORELSEExp(I(exp1left,exp2right), exp1, exp2) ) end
16376)
16377 in (LrTable.NT 26,(result,exp1left,exp2right),rest671) end
16378| (72,(_,(MlyValue.match match1,_,matchright as match1right))::_::(_,(
16379MlyValue.exp exp1,expleft as exp1left,_))::rest671) => let val result=
16380MlyValue.exp(fn _ => let val exp as exp1=exp1 ()
16381val match as match1=match1 ()
16382 in ( HANDLEExp(I(expleft,matchright), exp, match) ) end
16383)
16384 in (LrTable.NT 26,(result,exp1left,match1right),rest671) end
16385| (73,(_,(MlyValue.exp exp1,_,expright as exp1right))::(_,(_,RAISEleft
16386 as RAISE1left,_))::rest671) => let val result=MlyValue.exp(fn _ =>
16387let val exp as exp1=exp1 ()
16388 in ( RAISEExp(I(RAISEleft,expright), exp) ) end
16389)
16390 in (LrTable.NT 26,(result,RAISE1left,exp1right),rest671) end
16391| (74,(_,(MlyValue.exp exp3,_,exp3right))::_::(_,(MlyValue.exp exp2,_,
16392_))::_::(_,(MlyValue.exp exp1,_,_))::(_,(_,IFleft as IF1left,_))::
16393rest671) => let val result=MlyValue.exp(fn _ => let val exp1=exp1 ()
16394val exp2=exp2 ()
16395val exp3=exp3 ()
16396 in ( IFExp(I(IFleft,exp3right), exp1, exp2, exp3) ) end
16397)
16398 in (LrTable.NT 26,(result,IF1left,exp3right),rest671) end
16399| (75,(_,(MlyValue.exp exp2,_,exp2right))::_::(_,(MlyValue.exp exp1,_,
16400_))::(_,(_,WHILEleft as WHILE1left,_))::rest671) => let val result=
16401MlyValue.exp(fn _ => let val exp1=exp1 ()
16402val exp2=exp2 ()
16403 in ( WHILEExp(I(WHILEleft,exp2right), exp1, exp2) ) end
16404)
16405 in (LrTable.NT 26,(result,WHILE1left,exp2right),rest671) end
16406| (76,(_,(MlyValue.match match1,_,matchright as match1right))::_::(_,(
16407MlyValue.exp exp1,_,_))::(_,(_,CASEleft as CASE1left,_))::rest671) =>
16408let val result=MlyValue.exp(fn _ => let val exp as exp1=exp1 ()
16409val match as match1=match1 ()
16410 in ( CASEExp(I(CASEleft,matchright), exp, match) ) end
16411)
16412 in (LrTable.NT 26,(result,CASE1left,match1right),rest671) end
16413| (77,(_,(MlyValue.match match1,_,matchright as match1right))::(_,(_,
16414FNleft as FN1left,_))::rest671) => let val result=MlyValue.exp(fn _
16415 => let val match as match1=match1 ()
16416 in ( FNExp(I(FNleft,matchright), match) ) end
16417)
16418 in (LrTable.NT 26,(result,FN1left,match1right),rest671) end
16419| (78,(_,(MlyValue.BAR_match_opt BAR_match_opt1,_,BAR_match_optright
16420 as BAR_match_opt1right))::(_,(MlyValue.mrule mrule1,mruleleft as
16421mrule1left,_))::rest671) => let val result=MlyValue.match(fn _ => let
16422val mrule as mrule1=mrule1 ()
16423val BAR_match_opt as BAR_match_opt1=BAR_match_opt1 ()
16424 in (
16425 Match(I(mruleleft,BAR_match_optright),
16426 mrule, BAR_match_opt) )
16427 end
16428)
16429 in (LrTable.NT 27,(result,mrule1left,BAR_match_opt1right),rest671)
16430 end
16431| (79,(_,(MlyValue.match match1,_,match1right))::(_,(_,BAR1left,_))::
16432rest671) => let val result=MlyValue.BAR_match_opt(fn _ => let val
16433match as match1=match1 ()
16434 in ( SOME match ) end
16435)
16436 in (LrTable.NT 28,(result,BAR1left,match1right),rest671) end
16437| (80,rest671) => let val result=MlyValue.BAR_match_opt(fn _ => (
16438 NONE ))
16439 in (LrTable.NT 28,(result,defaultPos,defaultPos),rest671) end
16440| (81,(_,(MlyValue.exp exp1,_,expright as exp1right))::_::(_,(
16441MlyValue.pat pat1,patleft as pat1left,_))::rest671) => let val result=
16442MlyValue.mrule(fn _ => let val pat as pat1=pat1 ()
16443val exp as exp1=exp1 ()
16444 in ( Mrule(I(patleft,expright), pat, exp) ) end
16445)
16446 in (LrTable.NT 29,(result,pat1left,exp1right),rest671) end
16447| (82,(_,(MlyValue.dec1 dec11,dec11left,dec11right))::rest671) => let
16448val result=MlyValue.dec(fn _ => let val dec1 as dec11=dec11 ()
16449 in ( dec1 ) end
16450)
16451 in (LrTable.NT 30,(result,dec11left,dec11right),rest671) end
16452| (83,rest671) => let val result=MlyValue.dec(fn _ => (
16453 EMPTYDec(I(defaultPos,defaultPos)) ))
16454 in (LrTable.NT 30,(result,defaultPos,defaultPos),rest671) end
16455| (84,(_,(MlyValue.dec1' dec1'1,dec1'1left,dec1'1right))::rest671) =>
16456let val result=MlyValue.dec1(fn _ => let val dec1' as dec1'1=dec1'1 ()
16457 in ( dec1' ) end
16458)
16459 in (LrTable.NT 31,(result,dec1'1left,dec1'1right),rest671) end
16460| (85,(_,(_,_,ENDright as END1right))::(_,(MlyValue.popLocalInfix
16461popLocalInfix1,_,_))::(_,(MlyValue.dec dec2,_,_))::(_,(
16462MlyValue.pushLocalInfix pushLocalInfix1,_,_))::_::(_,(MlyValue.dec
16463dec1,_,_))::(_,(MlyValue.pushInfix pushInfix1,_,_))::(_,(_,LOCALleft
16464 as LOCAL1left,_))::rest671) => let val result=MlyValue.dec1(fn _ =>
16465let val pushInfix1=pushInfix1 ()
16466val dec1=dec1 ()
16467val pushLocalInfix1=pushLocalInfix1 ()
16468val dec2=dec2 ()
16469val popLocalInfix1=popLocalInfix1 ()
16470 in ( LOCALDec(I(LOCALleft,ENDright), dec1, dec2) ) end
16471)
16472 in (LrTable.NT 31,(result,LOCAL1left,END1right),rest671) end
16473| (86,(_,(MlyValue.dec1 dec12,_,dec12right))::(_,(MlyValue.dec1 dec11,
16474dec11left,_))::rest671) => let val result=MlyValue.dec1(fn _ => let
16475val dec11=dec11 ()
16476val dec12=dec12 ()
16477 in ( SEQDec(I(dec11left,dec12right), dec11, dec12) ) end
16478)
16479 in (LrTable.NT 31,(result,dec11left,dec12right),rest671) end
16480| (87,(_,(_,SEMICOLON1left,SEMICOLON1right))::rest671) => let val
16481result=MlyValue.dec1(fn _ => ( EMPTYDec(I(defaultPos,defaultPos)) ))
16482 in (LrTable.NT 31,(result,SEMICOLON1left,SEMICOLON1right),rest671)
16483 end
16484| (88,(_,(MlyValue.valbind valbind1,_,valbindright as valbind1right))
16485::(_,(_,VALleft as VAL1left,_))::rest671) => let val result=
16486MlyValue.dec1'(fn _ => let val valbind as valbind1=valbind1 ()
16487 in (
16488 VALDec(I(VALleft,valbindright),
16489 TyVarseq(I(defaultPos,defaultPos), []), valbind)
16490) end
16491)
16492 in (LrTable.NT 32,(result,VAL1left,valbind1right),rest671) end
16493| (89,(_,(MlyValue.valbind valbind1,_,valbindright as valbind1right))
16494::(_,(MlyValue.tyvarseq1 tyvarseq11,_,_))::(_,(_,VALleft as VAL1left,_
16495))::rest671) => let val result=MlyValue.dec1'(fn _ => let val
16496tyvarseq1 as tyvarseq11=tyvarseq11 ()
16497val valbind as valbind1=valbind1 ()
16498 in ( VALDec(I(VALleft,valbindright), tyvarseq1, valbind) ) end
16499)
16500 in (LrTable.NT 32,(result,VAL1left,valbind1right),rest671) end
16501| (90,(_,(MlyValue.fvalbind fvalbind1,_,fvalbindright as
16502fvalbind1right))::(_,(_,FUNleft as FUN1left,_))::rest671) => let val
16503result=MlyValue.dec1'(fn _ => let val fvalbind as fvalbind1=fvalbind1
16504()
16505 in (
16506 FUNDec(I(FUNleft,fvalbindright),
16507 TyVarseq(I(defaultPos,defaultPos), []), fvalbind)
16508) end
16509)
16510 in (LrTable.NT 32,(result,FUN1left,fvalbind1right),rest671) end
16511| (91,(_,(MlyValue.fvalbind fvalbind1,_,fvalbindright as
16512fvalbind1right))::(_,(MlyValue.tyvarseq1 tyvarseq11,_,_))::(_,(_,
16513FUNleft as FUN1left,_))::rest671) => let val result=MlyValue.dec1'(fn
16514_ => let val tyvarseq1 as tyvarseq11=tyvarseq11 ()
16515val fvalbind as fvalbind1=fvalbind1 ()
16516 in ( FUNDec(I(FUNleft,fvalbindright), tyvarseq1, fvalbind)) end
16517)
16518 in (LrTable.NT 32,(result,FUN1left,fvalbind1right),rest671) end
16519| (92,(_,(MlyValue.typbind typbind1,_,typbindright as typbind1right))
16520::(_,(_,TYPEleft as TYPE1left,_))::rest671) => let val result=
16521MlyValue.dec1'(fn _ => let val typbind as typbind1=typbind1 ()
16522 in ( TYPEDec(I(TYPEleft,typbindright), typbind) ) end
16523)
16524 in (LrTable.NT 32,(result,TYPE1left,typbind1right),rest671) end
16525| (93,(_,(MlyValue.WITHTYPE_typbind_opt WITHTYPE_typbind_opt1,_,
16526WITHTYPE_typbind_optright as WITHTYPE_typbind_opt1right))::(_,(
16527MlyValue.datbind0 datbind01,_,_))::(_,(_,DATATYPEleft as DATATYPE1left
16528,_))::rest671) => let val result=MlyValue.dec1'(fn _ => let val
16529datbind0 as datbind01=datbind01 ()
16530val WITHTYPE_typbind_opt as WITHTYPE_typbind_opt1=
16531WITHTYPE_typbind_opt1 ()
16532 in (
16533 DATATYPEDec(I(DATATYPEleft,WITHTYPE_typbind_optright),
16534 datbind0, WITHTYPE_typbind_opt)
16535) end
16536)
16537 in (LrTable.NT 32,(result,DATATYPE1left,WITHTYPE_typbind_opt1right),
16538rest671) end
16539| (94,(_,(MlyValue.WITHTYPE_typbind_opt WITHTYPE_typbind_opt1,_,
16540WITHTYPE_typbind_optright as WITHTYPE_typbind_opt1right))::(_,(
16541MlyValue.datbind1 datbind11,_,_))::(_,(_,DATATYPEleft as DATATYPE1left
16542,_))::rest671) => let val result=MlyValue.dec1'(fn _ => let val
16543datbind1 as datbind11=datbind11 ()
16544val WITHTYPE_typbind_opt as WITHTYPE_typbind_opt1=
16545WITHTYPE_typbind_opt1 ()
16546 in (
16547 DATATYPEDec(I(DATATYPEleft,WITHTYPE_typbind_optright),
16548 datbind1, WITHTYPE_typbind_opt)
16549) end
16550)
16551 in (LrTable.NT 32,(result,DATATYPE1left,WITHTYPE_typbind_opt1right),
16552rest671) end
16553| (95,(_,(MlyValue.longtycon longtycon1,_,longtyconright as
16554longtycon1right))::_::_::(_,(MlyValue.tycon tycon1,_,_))::(_,(_,
16555DATATYPEleft as DATATYPE1left,_))::rest671) => let val result=
16556MlyValue.dec1'(fn _ => let val tycon as tycon1=tycon1 ()
16557val longtycon as longtycon1=longtycon1 ()
16558 in (
16559 REPLICATIONDec(I(DATATYPEleft,longtyconright),
16560 tycon, longtycon)
16561) end
16562)
16563 in (LrTable.NT 32,(result,DATATYPE1left,longtycon1right),rest671) end
16564| (96,(_,(_,_,ENDright as END1right))::(_,(MlyValue.dec dec1,_,_))::_
16565::(_,(MlyValue.WITHTYPE_typbind_opt WITHTYPE_typbind_opt1,_,_))::(_,(
16566MlyValue.datbind datbind1,_,_))::(_,(_,ABSTYPEleft as ABSTYPE1left,_))
16567::rest671) => let val result=MlyValue.dec1'(fn _ => let val datbind
16568 as datbind1=datbind1 ()
16569val WITHTYPE_typbind_opt as WITHTYPE_typbind_opt1=
16570WITHTYPE_typbind_opt1 ()
16571val dec as dec1=dec1 ()
16572 in (
16573 ABSTYPEDec(I(ABSTYPEleft,ENDright), datbind,
16574 WITHTYPE_typbind_opt, dec)
16575) end
16576)
16577 in (LrTable.NT 32,(result,ABSTYPE1left,END1right),rest671) end
16578| (97,(_,(MlyValue.exbind exbind1,_,exbindright as exbind1right))::(_,
16579(_,EXCEPTIONleft as EXCEPTION1left,_))::rest671) => let val result=
16580MlyValue.dec1'(fn _ => let val exbind as exbind1=exbind1 ()
16581 in ( EXCEPTIONDec(I(EXCEPTIONleft,exbindright), exbind) ) end
16582)
16583 in (LrTable.NT 32,(result,EXCEPTION1left,exbind1right),rest671) end
16584| (98,(_,(MlyValue.longstrid_list1 longstrid_list11,_,
16585longstrid_list1right as longstrid_list11right))::(_,(_,OPENleft as
16586OPEN1left,_))::rest671) => let val result=MlyValue.dec1'(fn _ => let
16587val longstrid_list1 as longstrid_list11=longstrid_list11 ()
16588 in (
16589 OPENDec(I(OPENleft,longstrid_list1right),
16590 longstrid_list1) )
16591 end
16592)
16593 in (LrTable.NT 32,(result,OPEN1left,longstrid_list11right),rest671)
16594 end
16595| (99,(_,(MlyValue.vid_list1 vid_list11,_,vid_list1right as
16596vid_list11right))::(_,(MlyValue.d_opt d_opt1,_,_))::(_,(_,INFIXleft
16597 as INFIX1left,_))::rest671) => let val result=MlyValue.dec1'(fn _ =>
16598let val d_opt as d_opt1=d_opt1 ()
16599val vid_list1 as vid_list11=vid_list11 ()
16600 in (
16601 assignInfix((Infix.LEFT, d_opt), vid_list1);
16602 EMPTYDec(I(INFIXleft,vid_list1right))
16603) end
16604)
16605 in (LrTable.NT 32,(result,INFIX1left,vid_list11right),rest671) end
16606| (100,(_,(MlyValue.vid_list1 vid_list11,_,vid_list1right as
16607vid_list11right))::(_,(MlyValue.d_opt d_opt1,_,_))::(_,(_,INFIXRleft
16608 as INFIXR1left,_))::rest671) => let val result=MlyValue.dec1'(fn _
16609 => let val d_opt as d_opt1=d_opt1 ()
16610val vid_list1 as vid_list11=vid_list11 ()
16611 in (
16612 assignInfix((Infix.RIGHT, d_opt), vid_list1);
16613 EMPTYDec(I(INFIXRleft,vid_list1right))
16614) end
16615)
16616 in (LrTable.NT 32,(result,INFIXR1left,vid_list11right),rest671) end
16617| (101,(_,(MlyValue.vid_list1 vid_list11,_,vid_list1right as
16618vid_list11right))::(_,(_,NONFIXleft as NONFIX1left,_))::rest671) =>
16619let val result=MlyValue.dec1'(fn _ => let val vid_list1 as vid_list11=
16620vid_list11 ()
16621 in (
16622 cancelInfix(vid_list1);
16623 EMPTYDec(I(NONFIXleft,vid_list1right)) )
16624 end
16625)
16626 in (LrTable.NT 32,(result,NONFIX1left,vid_list11right),rest671) end
16627| (102,(_,(MlyValue.typbind typbind1,_,typbind1right))::(_,(_,
16628WITHTYPE1left,_))::rest671) => let val result=
16629MlyValue.WITHTYPE_typbind_opt(fn _ => let val typbind as typbind1=
16630typbind1 ()
16631 in ( SOME typbind ) end
16632)
16633 in (LrTable.NT 33,(result,WITHTYPE1left,typbind1right),rest671) end
16634| (103,rest671) => let val result=MlyValue.WITHTYPE_typbind_opt(fn _
16635 => ( NONE ))
16636 in (LrTable.NT 33,(result,defaultPos,defaultPos),rest671) end
16637| (104,(_,(MlyValue.vid_list1 vid_list11,_,vid_list11right))::(_,(
16638MlyValue.vid vid1,vid1left,_))::rest671) => let val result=
16639MlyValue.vid_list1(fn _ => let val vid as vid1=vid1 ()
16640val vid_list1 as vid_list11=vid_list11 ()
16641 in ( vid::vid_list1 ) end
16642)
16643 in (LrTable.NT 34,(result,vid1left,vid_list11right),rest671) end
16644| (105,(_,(MlyValue.vid vid1,vid1left,vid1right))::rest671) => let
16645val result=MlyValue.vid_list1(fn _ => let val vid as vid1=vid1 ()
16646 in ( vid::[] ) end
16647)
16648 in (LrTable.NT 34,(result,vid1left,vid1right),rest671) end
16649| (106,(_,(MlyValue.longstrid_list1 longstrid_list11,_,
16650longstrid_list11right))::(_,(MlyValue.longstrid longstrid1,
16651longstrid1left,_))::rest671) => let val result=
16652MlyValue.longstrid_list1(fn _ => let val longstrid as longstrid1=
16653longstrid1 ()
16654val longstrid_list1 as longstrid_list11=longstrid_list11 ()
16655 in ( longstrid::longstrid_list1 ) end
16656)
16657 in (LrTable.NT 35,(result,longstrid1left,longstrid_list11right),
16658rest671) end
16659| (107,(_,(MlyValue.longstrid longstrid1,longstrid1left,
16660longstrid1right))::rest671) => let val result=MlyValue.longstrid_list1
16661(fn _ => let val longstrid as longstrid1=longstrid1 ()
16662 in ( longstrid::[] ) end
16663)
16664 in (LrTable.NT 35,(result,longstrid1left,longstrid1right),rest671)
16665 end
16666| (108,(_,(MlyValue.d d1,d1left,d1right))::rest671) => let val result=
16667MlyValue.d_opt(fn _ => let val d as d1=d1 ()
16668 in ( d ) end
16669)
16670 in (LrTable.NT 36,(result,d1left,d1right),rest671) end
16671| (109,rest671) => let val result=MlyValue.d_opt(fn _ => ( 0 ))
16672 in (LrTable.NT 36,(result,defaultPos,defaultPos),rest671) end
16673| (110,(_,(MlyValue.AND_valbind_opt AND_valbind_opt1,_,
16674AND_valbind_optright as AND_valbind_opt1right))::(_,(MlyValue.exp exp1
16675,_,_))::_::(_,(MlyValue.pat pat1,patleft as pat1left,_))::rest671) =>
16676let val result=MlyValue.valbind(fn _ => let val pat as pat1=pat1 ()
16677val exp as exp1=exp1 ()
16678val AND_valbind_opt as AND_valbind_opt1=AND_valbind_opt1 ()
16679 in (
16680 PLAINValBind(I(patleft,AND_valbind_optright),
16681 pat, exp, AND_valbind_opt)
16682) end
16683)
16684 in (LrTable.NT 37,(result,pat1left,AND_valbind_opt1right),rest671)
16685 end
16686| (111,(_,(MlyValue.valbind valbind1,_,valbindright as valbind1right))
16687::(_,(_,RECleft as REC1left,_))::rest671) => let val result=
16688MlyValue.valbind(fn _ => let val valbind as valbind1=valbind1 ()
16689 in ( RECValBind(I(RECleft,valbindright), valbind) ) end
16690)
16691 in (LrTable.NT 37,(result,REC1left,valbind1right),rest671) end
16692| (112,(_,(MlyValue.valbind valbind1,_,valbind1right))::(_,(_,AND1left
16693,_))::rest671) => let val result=MlyValue.AND_valbind_opt(fn _ => let
16694val valbind as valbind1=valbind1 ()
16695 in ( SOME valbind ) end
16696)
16697 in (LrTable.NT 38,(result,AND1left,valbind1right),rest671) end
16698| (113,rest671) => let val result=MlyValue.AND_valbind_opt(fn _ => (
16699 NONE ))
16700 in (LrTable.NT 38,(result,defaultPos,defaultPos),rest671) end
16701| (114,(_,(MlyValue.AND_fvalbind_opt AND_fvalbind_opt1,_,
16702AND_fvalbind_optright as AND_fvalbind_opt1right))::(_,(MlyValue.fmatch
16703 fmatch1,fmatchleft as fmatch1left,_))::rest671) => let val result=
16704MlyValue.fvalbind(fn _ => let val fmatch as fmatch1=fmatch1 ()
16705val AND_fvalbind_opt as AND_fvalbind_opt1=AND_fvalbind_opt1 ()
16706 in (
16707 FvalBind(I(fmatchleft,AND_fvalbind_optright),
16708 fmatch, AND_fvalbind_opt)
16709) end
16710)
16711 in (LrTable.NT 39,(result,fmatch1left,AND_fvalbind_opt1right),rest671
16712) end
16713| (115,(_,(MlyValue.fvalbind fvalbind1,_,fvalbind1right))::(_,(_,
16714AND1left,_))::rest671) => let val result=MlyValue.AND_fvalbind_opt(fn
16715_ => let val fvalbind as fvalbind1=fvalbind1 ()
16716 in ( SOME fvalbind ) end
16717)
16718 in (LrTable.NT 40,(result,AND1left,fvalbind1right),rest671) end
16719| (116,rest671) => let val result=MlyValue.AND_fvalbind_opt(fn _ => (
16720 NONE ))
16721 in (LrTable.NT 40,(result,defaultPos,defaultPos),rest671) end
16722| (117,(_,(MlyValue.BAR_fmatch_opt BAR_fmatch_opt1,_,
16723BAR_fmatch_optright as BAR_fmatch_opt1right))::(_,(MlyValue.fmrule
16724fmrule1,fmruleleft as fmrule1left,_))::rest671) => let val result=
16725MlyValue.fmatch(fn _ => let val fmrule as fmrule1=fmrule1 ()
16726val BAR_fmatch_opt as BAR_fmatch_opt1=BAR_fmatch_opt1 ()
16727 in (
16728 Fmatch(I(fmruleleft,BAR_fmatch_optright),
16729 fmrule, BAR_fmatch_opt)
16730) end
16731)
16732 in (LrTable.NT 41,(result,fmrule1left,BAR_fmatch_opt1right),rest671)
16733 end
16734| (118,(_,(MlyValue.fmatch fmatch1,_,fmatch1right))::(_,(_,BAR1left,_)
16735)::rest671) => let val result=MlyValue.BAR_fmatch_opt(fn _ => let val
16736fmatch as fmatch1=fmatch1 ()
16737 in ( SOME fmatch ) end
16738)
16739 in (LrTable.NT 42,(result,BAR1left,fmatch1right),rest671) end
16740| (119,rest671) => let val result=MlyValue.BAR_fmatch_opt(fn _ => (
16741 NONE ))
16742 in (LrTable.NT 42,(result,defaultPos,defaultPos),rest671) end
16743| (120,(_,(MlyValue.exp exp1,_,expright as exp1right))::_::(_,(
16744MlyValue.COLON_ty_opt COLON_ty_opt1,_,_))::(_,(MlyValue.atpat_list1
16745atpat_list11,atpat_list1left as atpat_list11left,_))::rest671) => let
16746val result=MlyValue.fmrule(fn _ => let val atpat_list1 as atpat_list11
16747=atpat_list11 ()
16748val COLON_ty_opt as COLON_ty_opt1=COLON_ty_opt1 ()
16749val exp as exp1=exp1 ()
16750 in (
16751 let
16752 val (op_opt, vid, atpats) =
16753 Infix.parseFmrule(!J, atpat_list1)
16754 in
16755 Fmrule(I(atpat_list1left,expright),
16756 op_opt, vid, atpats, COLON_ty_opt, exp)
16757 end
16758) end
16759)
16760 in (LrTable.NT 43,(result,atpat_list11left,exp1right),rest671) end
16761| (121,(_,(MlyValue.AND_typbind_opt AND_typbind_opt1,_,
16762AND_typbind_optright as AND_typbind_opt1right))::(_,(MlyValue.ty ty1,_
16763,_))::_::(_,(MlyValue.tycon tycon1,_,_))::(_,(MlyValue.tyvarseq
16764tyvarseq1,tyvarseqleft as tyvarseq1left,_))::rest671) => let val
16765result=MlyValue.typbind(fn _ => let val tyvarseq as tyvarseq1=
16766tyvarseq1 ()
16767val tycon as tycon1=tycon1 ()
16768val ty as ty1=ty1 ()
16769val AND_typbind_opt as AND_typbind_opt1=AND_typbind_opt1 ()
16770 in (
16771 TypBind(I(tyvarseqleft,AND_typbind_optright),
16772 tyvarseq, tycon, ty, AND_typbind_opt)
16773) end
16774)
16775 in (LrTable.NT 44,(result,tyvarseq1left,AND_typbind_opt1right),
16776rest671) end
16777| (122,(_,(MlyValue.typbind typbind1,_,typbind1right))::(_,(_,AND1left
16778,_))::rest671) => let val result=MlyValue.AND_typbind_opt(fn _ => let
16779val typbind as typbind1=typbind1 ()
16780 in ( SOME typbind ) end
16781)
16782 in (LrTable.NT 45,(result,AND1left,typbind1right),rest671) end
16783| (123,rest671) => let val result=MlyValue.AND_typbind_opt(fn _ => (
16784 NONE ))
16785 in (LrTable.NT 45,(result,defaultPos,defaultPos),rest671) end
16786| (124,(_,(MlyValue.AND_datbind_opt AND_datbind_opt1,_,
16787AND_datbind_optright as AND_datbind_opt1right))::(_,(MlyValue.conbind
16788conbind1,_,_))::_::(_,(MlyValue.tycon tycon1,_,_))::(_,(
16789MlyValue.tyvarseq tyvarseq1,tyvarseqleft as tyvarseq1left,_))::rest671
16790) => let val result=MlyValue.datbind(fn _ => let val tyvarseq as
16791tyvarseq1=tyvarseq1 ()
16792val tycon as tycon1=tycon1 ()
16793val conbind as conbind1=conbind1 ()
16794val AND_datbind_opt as AND_datbind_opt1=AND_datbind_opt1 ()
16795 in (
16796 DatBind(I(tyvarseqleft,AND_datbind_optright),
16797 tyvarseq, tycon, conbind, AND_datbind_opt)
16798) end
16799)
16800 in (LrTable.NT 46,(result,tyvarseq1left,AND_datbind_opt1right),
16801rest671) end
16802| (125,(_,(MlyValue.AND_datbind_opt AND_datbind_opt1,_,
16803AND_datbind_optright as AND_datbind_opt1right))::(_,(MlyValue.conbind
16804conbind1,_,_))::_::(_,(MlyValue.tycon tycon1,tyconleft as tycon1left,_
16805))::rest671) => let val result=MlyValue.datbind0(fn _ => let val tycon
16806 as tycon1=tycon1 ()
16807val conbind as conbind1=conbind1 ()
16808val AND_datbind_opt as AND_datbind_opt1=AND_datbind_opt1 ()
16809 in (
16810 DatBind(I(tyconleft,AND_datbind_optright),
16811 TyVarseq(I(defaultPos,defaultPos), []),
16812 tycon, conbind, AND_datbind_opt)
16813) end
16814)
16815 in (LrTable.NT 47,(result,tycon1left,AND_datbind_opt1right),rest671)
16816 end
16817| (126,(_,(MlyValue.AND_datbind_opt AND_datbind_opt1,_,
16818AND_datbind_optright as AND_datbind_opt1right))::(_,(MlyValue.conbind
16819conbind1,_,_))::_::(_,(MlyValue.tycon tycon1,_,_))::(_,(
16820MlyValue.tyvarseq1 tyvarseq11,tyvarseq1left as tyvarseq11left,_))::
16821rest671) => let val result=MlyValue.datbind1(fn _ => let val tyvarseq1
16822 as tyvarseq11=tyvarseq11 ()
16823val tycon as tycon1=tycon1 ()
16824val conbind as conbind1=conbind1 ()
16825val AND_datbind_opt as AND_datbind_opt1=AND_datbind_opt1 ()
16826 in (
16827 DatBind(I(tyvarseq1left,AND_datbind_optright),
16828 tyvarseq1, tycon, conbind, AND_datbind_opt)
16829) end
16830)
16831 in (LrTable.NT 48,(result,tyvarseq11left,AND_datbind_opt1right),
16832rest671) end
16833| (127,(_,(MlyValue.datbind datbind1,_,datbind1right))::(_,(_,AND1left
16834,_))::rest671) => let val result=MlyValue.AND_datbind_opt(fn _ => let
16835val datbind as datbind1=datbind1 ()
16836 in ( SOME datbind ) end
16837)
16838 in (LrTable.NT 49,(result,AND1left,datbind1right),rest671) end
16839| (128,rest671) => let val result=MlyValue.AND_datbind_opt(fn _ => (
16840 NONE ))
16841 in (LrTable.NT 49,(result,defaultPos,defaultPos),rest671) end
16842| (129,(_,(MlyValue.BAR_conbind_opt BAR_conbind_opt1,_,
16843BAR_conbind_optright as BAR_conbind_opt1right))::(_,(
16844MlyValue.OF_ty_opt OF_ty_opt1,_,_))::(_,(MlyValue.vid' vid'1,_,_))::(_
16845,(MlyValue.OP_opt OP_opt1,OP_optleft as OP_opt1left,_))::rest671) =>
16846let val result=MlyValue.conbind(fn _ => let val OP_opt as OP_opt1=
16847OP_opt1 ()
16848val vid' as vid'1=vid'1 ()
16849val OF_ty_opt as OF_ty_opt1=OF_ty_opt1 ()
16850val BAR_conbind_opt as BAR_conbind_opt1=BAR_conbind_opt1 ()
16851 in (
16852 ConBind(I(OP_optleft,BAR_conbind_optright),
16853 OP_opt, vid', OF_ty_opt, BAR_conbind_opt)
16854) end
16855)
16856 in (LrTable.NT 50,(result,OP_opt1left,BAR_conbind_opt1right),rest671)
16857 end
16858| (130,(_,(MlyValue.conbind conbind1,_,conbind1right))::(_,(_,BAR1left
16859,_))::rest671) => let val result=MlyValue.BAR_conbind_opt(fn _ => let
16860val conbind as conbind1=conbind1 ()
16861 in ( SOME conbind ) end
16862)
16863 in (LrTable.NT 51,(result,BAR1left,conbind1right),rest671) end
16864| (131,rest671) => let val result=MlyValue.BAR_conbind_opt(fn _ => (
16865 NONE ))
16866 in (LrTable.NT 51,(result,defaultPos,defaultPos),rest671) end
16867| (132,(_,(MlyValue.ty ty1,_,ty1right))::(_,(_,OF1left,_))::rest671)
16868 => let val result=MlyValue.OF_ty_opt(fn _ => let val ty as ty1=ty1 ()
16869 in ( SOME ty ) end
16870)
16871 in (LrTable.NT 52,(result,OF1left,ty1right),rest671) end
16872| (133,rest671) => let val result=MlyValue.OF_ty_opt(fn _ => ( NONE ))
16873 in (LrTable.NT 52,(result,defaultPos,defaultPos),rest671) end
16874| (134,(_,(MlyValue.AND_exbind_opt AND_exbind_opt1,_,
16875AND_exbind_optright as AND_exbind_opt1right))::(_,(MlyValue.OF_ty_opt
16876OF_ty_opt1,_,_))::(_,(MlyValue.vid' vid'1,_,_))::(_,(MlyValue.OP_opt
16877OP_opt1,OP_optleft as OP_opt1left,_))::rest671) => let val result=
16878MlyValue.exbind(fn _ => let val OP_opt as OP_opt1=OP_opt1 ()
16879val vid' as vid'1=vid'1 ()
16880val OF_ty_opt as OF_ty_opt1=OF_ty_opt1 ()
16881val AND_exbind_opt as AND_exbind_opt1=AND_exbind_opt1 ()
16882 in (
16883 NEWExBind(I(OP_optleft,AND_exbind_optright),
16884 OP_opt, vid', OF_ty_opt, AND_exbind_opt)
16885) end
16886)
16887 in (LrTable.NT 53,(result,OP_opt1left,AND_exbind_opt1right),rest671)
16888 end
16889| (135,(_,(MlyValue.AND_exbind_opt AND_exbind_opt1,_,
16890AND_exbind_optright as AND_exbind_opt1right))::(_,(MlyValue.longvid
16891longvid1,_,_))::(_,(MlyValue.OP_opt OP_opt2,_,_))::_::(_,(
16892MlyValue.vid' vid'1,_,_))::(_,(MlyValue.OP_opt OP_opt1,OP_opt1left,_))
16893::rest671) => let val result=MlyValue.exbind(fn _ => let val OP_opt1=
16894OP_opt1 ()
16895val vid' as vid'1=vid'1 ()
16896val OP_opt2=OP_opt2 ()
16897val longvid as longvid1=longvid1 ()
16898val AND_exbind_opt as AND_exbind_opt1=AND_exbind_opt1 ()
16899 in (
16900 EQUALExBind(I(OP_opt1left,AND_exbind_optright),
16901 OP_opt1, vid', OP_opt2, longvid,
16902 AND_exbind_opt)
16903) end
16904)
16905 in (LrTable.NT 53,(result,OP_opt1left,AND_exbind_opt1right),rest671)
16906 end
16907| (136,(_,(MlyValue.exbind exbind1,_,exbind1right))::(_,(_,AND1left,_)
16908)::rest671) => let val result=MlyValue.AND_exbind_opt(fn _ => let val
16909exbind as exbind1=exbind1 ()
16910 in ( SOME exbind ) end
16911)
16912 in (LrTable.NT 54,(result,AND1left,exbind1right),rest671) end
16913| (137,rest671) => let val result=MlyValue.AND_exbind_opt(fn _ => (
16914 NONE ))
16915 in (LrTable.NT 54,(result,defaultPos,defaultPos),rest671) end
16916| (138,(_,(MlyValue.atpat' atpat'1,atpat'1left,atpat'1right))::rest671
16917) => let val result=MlyValue.atpat(fn _ => let val atpat' as atpat'1=
16918atpat'1 ()
16919 in ( atpat' ) end
16920)
16921 in (LrTable.NT 55,(result,atpat'1left,atpat'1right),rest671) end
16922| (139,(_,(MlyValue.longvid' longvid'1,_,longvid'right as
16923longvid'1right))::(_,(MlyValue.OP_opt OP_opt1,OP_optleft as
16924OP_opt1left,_))::rest671) => let val result=MlyValue.atpat(fn _ =>
16925let val OP_opt as OP_opt1=OP_opt1 ()
16926val longvid' as longvid'1=longvid'1 ()
16927 in (
16928 LONGVIDAtPat(I(OP_optleft,longvid'right),
16929 OP_opt, longvid')
16930) end
16931)
16932 in (LrTable.NT 55,(result,OP_opt1left,longvid'1right),rest671) end
16933| (140,(_,(_,UNDERBARleft as UNDERBAR1left,UNDERBARright as
16934UNDERBAR1right))::rest671) => let val result=MlyValue.atpat'(fn _ => (
16935 WILDCARDAtPat(I(UNDERBARleft,UNDERBARright)) ))
16936 in (LrTable.NT 56,(result,UNDERBAR1left,UNDERBAR1right),rest671) end
16937| (141,(_,(MlyValue.scon scon1,sconleft as scon1left,sconright as
16938scon1right))::rest671) => let val result=MlyValue.atpat'(fn _ => let
16939val scon as scon1=scon1 ()
16940 in ( SCONAtPat(I(sconleft,sconright), scon) ) end
16941)
16942 in (LrTable.NT 56,(result,scon1left,scon1right),rest671) end
16943| (142,(_,(_,_,RBRACEright as RBRACE1right))::(_,(MlyValue.patrow_opt
16944patrow_opt1,_,_))::(_,(_,LBRACEleft as LBRACE1left,_))::rest671) =>
16945let val result=MlyValue.atpat'(fn _ => let val patrow_opt as
16946patrow_opt1=patrow_opt1 ()
16947 in ( RECORDAtPat(I(LBRACEleft,RBRACEright), patrow_opt) ) end
16948)
16949 in (LrTable.NT 56,(result,LBRACE1left,RBRACE1right),rest671) end
16950| (143,(_,(_,_,RPARright as RPAR1right))::(_,(_,LPARleft as LPAR1left,
16951_))::rest671) => let val result=MlyValue.atpat'(fn _ => (
16952 UNITAtPat(I(LPARleft,RPARright)) ))
16953 in (LrTable.NT 56,(result,LPAR1left,RPAR1right),rest671) end
16954| (144,(_,(_,_,RPARright as RPAR1right))::(_,(MlyValue.pat_COMMA_list2
16955 pat_COMMA_list21,_,_))::(_,(_,LPARleft as LPAR1left,_))::rest671) =>
16956let val result=MlyValue.atpat'(fn _ => let val pat_COMMA_list2 as
16957pat_COMMA_list21=pat_COMMA_list21 ()
16958 in ( TUPLEAtPat(I(LPARleft,RPARright), pat_COMMA_list2) ) end
16959)
16960 in (LrTable.NT 56,(result,LPAR1left,RPAR1right),rest671) end
16961| (145,(_,(_,_,RBRACKright as RBRACK1right))::(_,(
16962MlyValue.pat_COMMA_list0 pat_COMMA_list01,_,_))::(_,(_,LBRACKleft as
16963LBRACK1left,_))::rest671) => let val result=MlyValue.atpat'(fn _ =>
16964let val pat_COMMA_list0 as pat_COMMA_list01=pat_COMMA_list01 ()
16965 in ( LISTAtPat(I(LBRACKleft,RBRACKright),
16966 pat_COMMA_list0) )
16967 end
16968)
16969 in (LrTable.NT 56,(result,LBRACK1left,RBRACK1right),rest671) end
16970| (146,(_,(_,_,RPARright as RPAR1right))::(_,(MlyValue.pat pat1,_,_))
16971::(_,(_,LPARleft as LPAR1left,_))::rest671) => let val result=
16972MlyValue.atpat'(fn _ => let val pat as pat1=pat1 ()
16973 in ( PARAtPat(I(LPARleft,RPARright), pat) ) end
16974)
16975 in (LrTable.NT 56,(result,LPAR1left,RPAR1right),rest671) end
16976| (147,(_,(MlyValue.pat_COMMA_list1 pat_COMMA_list11,
16977pat_COMMA_list11left,pat_COMMA_list11right))::rest671) => let val
16978result=MlyValue.pat_COMMA_list0(fn _ => let val pat_COMMA_list1 as
16979pat_COMMA_list11=pat_COMMA_list11 ()
16980 in ( pat_COMMA_list1 ) end
16981)
16982 in (LrTable.NT 57,(result,pat_COMMA_list11left,pat_COMMA_list11right)
16983,rest671) end
16984| (148,rest671) => let val result=MlyValue.pat_COMMA_list0(fn _ => (
16985 [] ))
16986 in (LrTable.NT 57,(result,defaultPos,defaultPos),rest671) end
16987| (149,(_,(MlyValue.pat_COMMA_list1 pat_COMMA_list11,_,
16988pat_COMMA_list11right))::_::(_,(MlyValue.pat pat1,pat1left,_))::
16989rest671) => let val result=MlyValue.pat_COMMA_list1(fn _ => let val
16990pat as pat1=pat1 ()
16991val pat_COMMA_list1 as pat_COMMA_list11=pat_COMMA_list11 ()
16992 in ( pat::pat_COMMA_list1 ) end
16993)
16994 in (LrTable.NT 58,(result,pat1left,pat_COMMA_list11right),rest671)
16995 end
16996| (150,(_,(MlyValue.pat pat1,pat1left,pat1right))::rest671) => let
16997val result=MlyValue.pat_COMMA_list1(fn _ => let val pat as pat1=pat1
16998()
16999 in ( pat::[] ) end
17000)
17001 in (LrTable.NT 58,(result,pat1left,pat1right),rest671) end
17002| (151,(_,(MlyValue.pat_COMMA_list1 pat_COMMA_list11,_,
17003pat_COMMA_list11right))::_::(_,(MlyValue.pat pat1,pat1left,_))::
17004rest671) => let val result=MlyValue.pat_COMMA_list2(fn _ => let val
17005pat as pat1=pat1 ()
17006val pat_COMMA_list1 as pat_COMMA_list11=pat_COMMA_list11 ()
17007 in ( pat::pat_COMMA_list1 ) end
17008)
17009 in (LrTable.NT 59,(result,pat1left,pat_COMMA_list11right),rest671)
17010 end
17011| (152,(_,(_,DOTSleft as DOTS1left,DOTSright as DOTS1right))::rest671)
17012 => let val result=MlyValue.patrow(fn _ => (
17013 WILDCARDPatRow(I(DOTSleft,DOTSright)) ))
17014 in (LrTable.NT 60,(result,DOTS1left,DOTS1right),rest671) end
17015| (153,(_,(MlyValue.COMMA_patrow_opt COMMA_patrow_opt1,_,
17016COMMA_patrow_optright as COMMA_patrow_opt1right))::(_,(MlyValue.pat
17017pat1,_,_))::_::(_,(MlyValue.lab lab1,lableft as lab1left,_))::rest671)
17018 => let val result=MlyValue.patrow(fn _ => let val lab as lab1=lab1 ()
17019val pat as pat1=pat1 ()
17020val COMMA_patrow_opt as COMMA_patrow_opt1=COMMA_patrow_opt1 ()
17021 in (
17022 ROWPatRow(I(lableft,COMMA_patrow_optright),
17023 lab, pat, COMMA_patrow_opt)
17024) end
17025)
17026 in (LrTable.NT 60,(result,lab1left,COMMA_patrow_opt1right),rest671)
17027 end
17028| (154,(_,(MlyValue.COMMA_patrow_opt COMMA_patrow_opt1,_,
17029COMMA_patrow_optright as COMMA_patrow_opt1right))::(_,(
17030MlyValue.AS_pat_opt AS_pat_opt1,_,_))::(_,(MlyValue.COLON_ty_opt
17031COLON_ty_opt1,_,_))::(_,(MlyValue.vid' vid'1,vid'left as vid'1left,_))
17032::rest671) => let val result=MlyValue.patrow(fn _ => let val vid' as
17033vid'1=vid'1 ()
17034val COLON_ty_opt as COLON_ty_opt1=COLON_ty_opt1 ()
17035val AS_pat_opt as AS_pat_opt1=AS_pat_opt1 ()
17036val COMMA_patrow_opt as COMMA_patrow_opt1=COMMA_patrow_opt1 ()
17037 in (
17038 VIDPatRow(I(vid'left,COMMA_patrow_optright),
17039 vid', COLON_ty_opt, AS_pat_opt,
17040 COMMA_patrow_opt)
17041) end
17042)
17043 in (LrTable.NT 60,(result,vid'1left,COMMA_patrow_opt1right),rest671)
17044 end
17045| (155,(_,(MlyValue.patrow patrow1,_,patrow1right))::(_,(_,COMMA1left,
17046_))::rest671) => let val result=MlyValue.COMMA_patrow_opt(fn _ => let
17047val patrow as patrow1=patrow1 ()
17048 in ( SOME patrow ) end
17049)
17050 in (LrTable.NT 62,(result,COMMA1left,patrow1right),rest671) end
17051| (156,rest671) => let val result=MlyValue.COMMA_patrow_opt(fn _ => (
17052 NONE ))
17053 in (LrTable.NT 62,(result,defaultPos,defaultPos),rest671) end
17054| (157,(_,(MlyValue.ty ty1,_,ty1right))::(_,(_,COLON1left,_))::rest671
17055) => let val result=MlyValue.COLON_ty_opt(fn _ => let val ty as ty1=
17056ty1 ()
17057 in ( SOME ty ) end
17058)
17059 in (LrTable.NT 63,(result,COLON1left,ty1right),rest671) end
17060| (158,rest671) => let val result=MlyValue.COLON_ty_opt(fn _ => (
17061 NONE ))
17062 in (LrTable.NT 63,(result,defaultPos,defaultPos),rest671) end
17063| (159,(_,(MlyValue.pat pat1,_,pat1right))::(_,(_,AS1left,_))::rest671
17064) => let val result=MlyValue.AS_pat_opt(fn _ => let val pat as pat1=
17065pat1 ()
17066 in ( SOME pat ) end
17067)
17068 in (LrTable.NT 64,(result,AS1left,pat1right),rest671) end
17069| (160,rest671) => let val result=MlyValue.AS_pat_opt(fn _ => ( NONE )
17070)
17071 in (LrTable.NT 64,(result,defaultPos,defaultPos),rest671) end
17072| (161,(_,(MlyValue.patrow patrow1,patrow1left,patrow1right))::rest671
17073) => let val result=MlyValue.patrow_opt(fn _ => let val patrow as
17074patrow1=patrow1 ()
17075 in ( SOME patrow ) end
17076)
17077 in (LrTable.NT 61,(result,patrow1left,patrow1right),rest671) end
17078| (162,rest671) => let val result=MlyValue.patrow_opt(fn _ => ( NONE )
17079)
17080 in (LrTable.NT 61,(result,defaultPos,defaultPos),rest671) end
17081| (163,(_,(MlyValue.atpat atpat1,atpat1left,atpat1right))::rest671)
17082 => let val result=MlyValue.pat(fn _ => let val atpat as atpat1=atpat1
17083 ()
17084 in ( Infix.parsePat(!J, [atpat]) ) end
17085)
17086 in (LrTable.NT 65,(result,atpat1left,atpat1right),rest671) end
17087| (164,(_,(MlyValue.atpat_list2 atpat_list21,atpat_list21left,
17088atpat_list21right))::rest671) => let val result=MlyValue.pat(fn _ =>
17089let val atpat_list2 as atpat_list21=atpat_list21 ()
17090 in ( Infix.parsePat(!J, atpat_list2) ) end
17091)
17092 in (LrTable.NT 65,(result,atpat_list21left,atpat_list21right),rest671
17093) end
17094| (165,(_,(MlyValue.COLON_ty_list1 COLON_ty_list11,_,
17095COLON_ty_list11right))::(_,(MlyValue.atpat' atpat'1,atpat'1left,_))::
17096rest671) => let val result=MlyValue.pat(fn _ => let val atpat' as
17097atpat'1=atpat'1 ()
17098val COLON_ty_list1 as COLON_ty_list11=COLON_ty_list11 ()
17099 in (
17100 let val pat = Infix.parsePat(!J, [atpat'])
17101 in typedPat(pat, COLON_ty_list1) end
17102) end
17103)
17104 in (LrTable.NT 65,(result,atpat'1left,COLON_ty_list11right),rest671)
17105 end
17106| (166,(_,(MlyValue.COLON_ty_list1 COLON_ty_list11,_,
17107COLON_ty_list11right))::(_,(MlyValue.atpat_list2 atpat_list21,
17108atpat_list21left,_))::rest671) => let val result=MlyValue.pat(fn _ =>
17109let val atpat_list2 as atpat_list21=atpat_list21 ()
17110val COLON_ty_list1 as COLON_ty_list11=COLON_ty_list11 ()
17111 in (
17112 let val pat = Infix.parsePat(!J, atpat_list2)
17113 in typedPat(pat, COLON_ty_list1) end
17114) end
17115)
17116 in (LrTable.NT 65,(result,atpat_list21left,COLON_ty_list11right),
17117rest671) end
17118| (167,(_,(MlyValue.COLON_ty_list1 COLON_ty_list11,_,
17119COLON_ty_list11right))::(_,(MlyValue.vid' vid'1,_,vid'right))::(_,(
17120MlyValue.OP_opt OP_opt1,OP_optleft as OP_opt1left,_))::rest671) =>
17121let val result=MlyValue.pat(fn _ => let val OP_opt as OP_opt1=OP_opt1
17122()
17123val vid' as vid'1=vid'1 ()
17124val COLON_ty_list1 as COLON_ty_list11=COLON_ty_list11 ()
17125 in (
17126 let val atpat = LONGVIDAtPat(I(OP_optleft,vid'right),
17127 OP_opt,
17128 LongVId.fromId vid')
17129 val pat = Infix.parsePat(!J, [atpat])
17130 in typedPat(pat, COLON_ty_list1) end
17131) end
17132)
17133 in (LrTable.NT 65,(result,OP_opt1left,COLON_ty_list11right),rest671)
17134 end
17135| (168,(_,(MlyValue.COLON_ty_list1 COLON_ty_list11,_,
17136COLON_ty_list11right))::(_,(MlyValue.LONGID LONGID1,_,LONGIDright))::(
17137_,(MlyValue.OP_opt OP_opt1,OP_optleft as OP_opt1left,_))::rest671) =>
17138let val result=MlyValue.pat(fn _ => let val OP_opt as OP_opt1=OP_opt1
17139()
17140val LONGID as LONGID1=LONGID1 ()
17141val COLON_ty_list1 as COLON_ty_list11=COLON_ty_list11 ()
17142 in (
17143 let val longvid = LongVId.implode
17144 (toLongId VId.fromString LONGID)
17145 val atpat = LONGVIDAtPat(I(OP_optleft,LONGIDright),
17146 OP_opt, longvid)
17147 val pat = Infix.parsePat(!J, [atpat])
17148 in typedPat(pat, COLON_ty_list1) end
17149) end
17150)
17151 in (LrTable.NT 65,(result,OP_opt1left,COLON_ty_list11right),rest671)
17152 end
17153| (169,(_,(MlyValue.pat pat1,_,patright as pat1right))::_::(_,(
17154MlyValue.COLON_ty_opt COLON_ty_opt1,_,_))::(_,(MlyValue.vid' vid'1,_,
17155vid'right))::(_,(MlyValue.OP_opt OP_opt1,OP_optleft as OP_opt1left,_))
17156::rest671) => let val result=MlyValue.pat(fn _ => let val OP_opt as
17157OP_opt1=OP_opt1 ()
17158val vid' as vid'1=vid'1 ()
17159val COLON_ty_opt as COLON_ty_opt1=COLON_ty_opt1 ()
17160val pat as pat1=pat1 ()
17161 in (
17162 Infix.parsePat(!J,
17163 [ LONGVIDAtPat(I(OP_optleft,vid'right),
17164 OP_opt,
17165 LongVId.implode([],vid')) ] ) ;
17166 ASPat(I(OP_optleft,patright),
17167 OP_opt, vid', COLON_ty_opt, pat)
17168) end
17169)
17170 in (LrTable.NT 65,(result,OP_opt1left,pat1right),rest671) end
17171| (170,(_,(MlyValue.atpat_list1 atpat_list11,_,atpat_list11right))::(_
17172,(MlyValue.atpat atpat1,atpat1left,_))::rest671) => let val result=
17173MlyValue.atpat_list1(fn _ => let val atpat as atpat1=atpat1 ()
17174val atpat_list1 as atpat_list11=atpat_list11 ()
17175 in ( atpat::atpat_list1 ) end
17176)
17177 in (LrTable.NT 66,(result,atpat1left,atpat_list11right),rest671) end
17178| (171,(_,(MlyValue.atpat atpat1,atpat1left,atpat1right))::rest671)
17179 => let val result=MlyValue.atpat_list1(fn _ => let val atpat as
17180atpat1=atpat1 ()
17181 in ( atpat::[] ) end
17182)
17183 in (LrTable.NT 66,(result,atpat1left,atpat1right),rest671) end
17184| (172,(_,(MlyValue.atpat_list1 atpat_list11,_,atpat_list11right))::(_
17185,(MlyValue.atpat atpat1,atpat1left,_))::rest671) => let val result=
17186MlyValue.atpat_list2(fn _ => let val atpat as atpat1=atpat1 ()
17187val atpat_list1 as atpat_list11=atpat_list11 ()
17188 in ( atpat::atpat_list1 ) end
17189)
17190 in (LrTable.NT 67,(result,atpat1left,atpat_list11right),rest671) end
17191| (173,(_,(MlyValue.COLON_ty_list1 COLON_ty_list11,_,
17192COLON_ty_list11right))::(_,(MlyValue.ty ty1,_,_))::(_,(_,COLON1left,_)
17193)::rest671) => let val result=MlyValue.COLON_ty_list1(fn _ => let val
17194ty as ty1=ty1 ()
17195val COLON_ty_list1 as COLON_ty_list11=COLON_ty_list11 ()
17196 in ( ty::COLON_ty_list1 ) end
17197)
17198 in (LrTable.NT 68,(result,COLON1left,COLON_ty_list11right),rest671)
17199 end
17200| (174,(_,(MlyValue.ty ty1,_,ty1right))::(_,(_,COLON1left,_))::rest671
17201) => let val result=MlyValue.COLON_ty_list1(fn _ => let val ty as ty1=
17202ty1 ()
17203 in ( ty::[] ) end
17204)
17205 in (LrTable.NT 68,(result,COLON1left,ty1right),rest671) end
17206| (175,(_,(MlyValue.tupty tupty1,tupty1left,tupty1right))::rest671)
17207 => let val result=MlyValue.ty(fn _ => let val tupty as tupty1=tupty1
17208()
17209 in ( tupty ) end
17210)
17211 in (LrTable.NT 69,(result,tupty1left,tupty1right),rest671) end
17212| (176,(_,(MlyValue.ty ty1,_,tyright as ty1right))::_::(_,(
17213MlyValue.tupty tupty1,tuptyleft as tupty1left,_))::rest671) => let
17214val result=MlyValue.ty(fn _ => let val tupty as tupty1=tupty1 ()
17215val ty as ty1=ty1 ()
17216 in ( ARROWTy(I(tuptyleft,tyright), tupty, ty) ) end
17217)
17218 in (LrTable.NT 69,(result,tupty1left,ty1right),rest671) end
17219| (177,(_,(MlyValue.ty_STAR_list ty_STAR_list1,ty_STAR_listleft as
17220ty_STAR_list1left,ty_STAR_listright as ty_STAR_list1right))::rest671)
17221 => let val result=MlyValue.tupty(fn _ => let val ty_STAR_list as
17222ty_STAR_list1=ty_STAR_list1 ()
17223 in (
17224 TUPLETy(I(ty_STAR_listleft,ty_STAR_listright),
17225 ty_STAR_list) )
17226 end
17227)
17228 in (LrTable.NT 70,(result,ty_STAR_list1left,ty_STAR_list1right),
17229rest671) end
17230| (178,(_,(MlyValue.ty_STAR_list ty_STAR_list1,_,ty_STAR_list1right))
17231::_::(_,(MlyValue.consty consty1,consty1left,_))::rest671) => let val
17232result=MlyValue.ty_STAR_list(fn _ => let val consty as consty1=consty1
17233 ()
17234val ty_STAR_list as ty_STAR_list1=ty_STAR_list1 ()
17235 in ( consty::ty_STAR_list ) end
17236)
17237 in (LrTable.NT 71,(result,consty1left,ty_STAR_list1right),rest671)
17238 end
17239| (179,(_,(MlyValue.consty consty1,consty1left,consty1right))::rest671
17240) => let val result=MlyValue.ty_STAR_list(fn _ => let val consty as
17241consty1=consty1 ()
17242 in ( consty::[] ) end
17243)
17244 in (LrTable.NT 71,(result,consty1left,consty1right),rest671) end
17245| (180,(_,(MlyValue.atty atty1,atty1left,atty1right))::rest671) =>
17246let val result=MlyValue.consty(fn _ => let val atty as atty1=atty1 ()
17247 in ( atty ) end
17248)
17249 in (LrTable.NT 72,(result,atty1left,atty1right),rest671) end
17250| (181,(_,(MlyValue.longtycon longtycon1,_,longtyconright as
17251longtycon1right))::(_,(MlyValue.tyseq tyseq1,tyseqleft as tyseq1left,_
17252))::rest671) => let val result=MlyValue.consty(fn _ => let val tyseq
17253 as tyseq1=tyseq1 ()
17254val longtycon as longtycon1=longtycon1 ()
17255 in ( TYCONTy(I(tyseqleft,longtyconright),
17256 tyseq, longtycon) )
17257 end
17258)
17259 in (LrTable.NT 72,(result,tyseq1left,longtycon1right),rest671) end
17260| (182,(_,(MlyValue.tyvar tyvar1,tyvarleft as tyvar1left,tyvarright
17261 as tyvar1right))::rest671) => let val result=MlyValue.atty(fn _ =>
17262let val tyvar as tyvar1=tyvar1 ()
17263 in ( TYVARTy(I(tyvarleft,tyvarright), tyvar) ) end
17264)
17265 in (LrTable.NT 73,(result,tyvar1left,tyvar1right),rest671) end
17266| (183,(_,(_,_,RBRACEright as RBRACE1right))::(_,(MlyValue.tyrow_opt
17267tyrow_opt1,_,_))::(_,(_,LBRACEleft as LBRACE1left,_))::rest671) =>
17268let val result=MlyValue.atty(fn _ => let val tyrow_opt as tyrow_opt1=
17269tyrow_opt1 ()
17270 in ( RECORDTy(I(LBRACEleft,RBRACEright), tyrow_opt) ) end
17271)
17272 in (LrTable.NT 73,(result,LBRACE1left,RBRACE1right),rest671) end
17273| (184,(_,(_,_,RPARright as RPAR1right))::(_,(MlyValue.ty ty1,_,_))::(
17274_,(_,LPARleft as LPAR1left,_))::rest671) => let val result=
17275MlyValue.atty(fn _ => let val ty as ty1=ty1 ()
17276 in ( PARTy(I(LPARleft,RPARright), ty) ) end
17277)
17278 in (LrTable.NT 73,(result,LPAR1left,RPAR1right),rest671) end
17279| (185,(_,(MlyValue.COMMA_tyrow_opt COMMA_tyrow_opt1,_,
17280COMMA_tyrow_optright as COMMA_tyrow_opt1right))::(_,(MlyValue.ty ty1,_
17281,_))::_::(_,(MlyValue.lab lab1,lableft as lab1left,_))::rest671) =>
17282let val result=MlyValue.tyrow(fn _ => let val lab as lab1=lab1 ()
17283val ty as ty1=ty1 ()
17284val COMMA_tyrow_opt as COMMA_tyrow_opt1=COMMA_tyrow_opt1 ()
17285 in (
17286 TyRow(I(lableft,COMMA_tyrow_optright),
17287 lab, ty, COMMA_tyrow_opt)
17288) end
17289)
17290 in (LrTable.NT 74,(result,lab1left,COMMA_tyrow_opt1right),rest671)
17291 end
17292| (186,(_,(MlyValue.tyrow tyrow1,_,tyrow1right))::(_,(_,COMMA1left,_))
17293::rest671) => let val result=MlyValue.COMMA_tyrow_opt(fn _ => let val
17294tyrow as tyrow1=tyrow1 ()
17295 in ( SOME tyrow ) end
17296)
17297 in (LrTable.NT 76,(result,COMMA1left,tyrow1right),rest671) end
17298| (187,rest671) => let val result=MlyValue.COMMA_tyrow_opt(fn _ => (
17299 NONE ))
17300 in (LrTable.NT 76,(result,defaultPos,defaultPos),rest671) end
17301| (188,(_,(MlyValue.tyrow tyrow1,tyrow1left,tyrow1right))::rest671)
17302 => let val result=MlyValue.tyrow_opt(fn _ => let val tyrow as tyrow1=
17303tyrow1 ()
17304 in ( SOME tyrow ) end
17305)
17306 in (LrTable.NT 75,(result,tyrow1left,tyrow1right),rest671) end
17307| (189,rest671) => let val result=MlyValue.tyrow_opt(fn _ => ( NONE ))
17308 in (LrTable.NT 75,(result,defaultPos,defaultPos),rest671) end
17309| (190,(_,(MlyValue.consty consty1,constyleft as consty1left,
17310constyright as consty1right))::rest671) => let val result=
17311MlyValue.tyseq(fn _ => let val consty as consty1=consty1 ()
17312 in ( Tyseq(I(constyleft,constyright),
17313 [consty]) ) end
17314)
17315 in (LrTable.NT 77,(result,consty1left,consty1right),rest671) end
17316| (191,rest671) => let val result=MlyValue.tyseq(fn _ => (
17317 Tyseq(I(defaultPos,defaultPos), []) ))
17318 in (LrTable.NT 77,(result,defaultPos,defaultPos),rest671) end
17319| (192,(_,(_,_,RPARright as RPAR1right))::(_,(MlyValue.ty_COMMA_list2
17320ty_COMMA_list21,_,_))::(_,(_,LPARleft as LPAR1left,_))::rest671) =>
17321let val result=MlyValue.tyseq(fn _ => let val ty_COMMA_list2 as
17322ty_COMMA_list21=ty_COMMA_list21 ()
17323 in ( Tyseq(I(LPARleft,RPARright),
17324 ty_COMMA_list2) ) end
17325)
17326 in (LrTable.NT 77,(result,LPAR1left,RPAR1right),rest671) end
17327| (193,(_,(MlyValue.ty_COMMA_list2 ty_COMMA_list21,_,
17328ty_COMMA_list21right))::_::(_,(MlyValue.ty ty1,ty1left,_))::rest671)
17329 => let val result=MlyValue.ty_COMMA_list2(fn _ => let val ty as ty1=
17330ty1 ()
17331val ty_COMMA_list2 as ty_COMMA_list21=ty_COMMA_list21 ()
17332 in ( ty::ty_COMMA_list2 ) end
17333)
17334 in (LrTable.NT 78,(result,ty1left,ty_COMMA_list21right),rest671) end
17335| (194,(_,(MlyValue.ty ty2,_,ty2right))::_::(_,(MlyValue.ty ty1,
17336ty1left,_))::rest671) => let val result=MlyValue.ty_COMMA_list2(fn _
17337 => let val ty1=ty1 ()
17338val ty2=ty2 ()
17339 in ( [ty1, ty2] ) end
17340)
17341 in (LrTable.NT 78,(result,ty1left,ty2right),rest671) end
17342| (195,(_,(MlyValue.tyvarseq1 tyvarseq11,tyvarseq11left,
17343tyvarseq11right))::rest671) => let val result=MlyValue.tyvarseq(fn _
17344 => let val tyvarseq1 as tyvarseq11=tyvarseq11 ()
17345 in ( tyvarseq1 ) end
17346)
17347 in (LrTable.NT 79,(result,tyvarseq11left,tyvarseq11right),rest671)
17348 end
17349| (196,rest671) => let val result=MlyValue.tyvarseq(fn _ => (
17350 TyVarseq(I(defaultPos,defaultPos),
17351 []) ))
17352 in (LrTable.NT 79,(result,defaultPos,defaultPos),rest671) end
17353| (197,(_,(MlyValue.tyvar tyvar1,tyvarleft as tyvar1left,tyvarright
17354 as tyvar1right))::rest671) => let val result=MlyValue.tyvarseq1(fn _
17355 => let val tyvar as tyvar1=tyvar1 ()
17356 in ( TyVarseq(I(tyvarleft,tyvarright),
17357 [tyvar]) ) end
17358)
17359 in (LrTable.NT 80,(result,tyvar1left,tyvar1right),rest671) end
17360| (198,(_,(_,_,RPARright as RPAR1right))::(_,(
17361MlyValue.tyvar_COMMA_list1 tyvar_COMMA_list11,_,_))::(_,(_,LPARleft
17362 as LPAR1left,_))::rest671) => let val result=MlyValue.tyvarseq1(fn _
17363 => let val tyvar_COMMA_list1 as tyvar_COMMA_list11=tyvar_COMMA_list11
17364 ()
17365 in ( TyVarseq(I(LPARleft,RPARright),
17366 tyvar_COMMA_list1) )
17367 end
17368)
17369 in (LrTable.NT 80,(result,LPAR1left,RPAR1right),rest671) end
17370| (199,(_,(MlyValue.tyvar_COMMA_list1 tyvar_COMMA_list11,_,
17371tyvar_COMMA_list11right))::_::(_,(MlyValue.tyvar tyvar1,tyvar1left,_))
17372::rest671) => let val result=MlyValue.tyvar_COMMA_list1(fn _ => let
17373val tyvar as tyvar1=tyvar1 ()
17374val tyvar_COMMA_list1 as tyvar_COMMA_list11=tyvar_COMMA_list11 ()
17375 in ( tyvar::tyvar_COMMA_list1 ) end
17376)
17377 in (LrTable.NT 81,(result,tyvar1left,tyvar_COMMA_list11right),rest671
17378) end
17379| (200,(_,(MlyValue.tyvar tyvar1,tyvar1left,tyvar1right))::rest671)
17380 => let val result=MlyValue.tyvar_COMMA_list1(fn _ => let val tyvar
17381 as tyvar1=tyvar1 ()
17382 in ( tyvar::[] ) end
17383)
17384 in (LrTable.NT 81,(result,tyvar1left,tyvar1right),rest671) end
17385| (201,(_,(MlyValue.strexp' strexp'1,strexp'1left,strexp'1right))::
17386rest671) => let val result=MlyValue.strexp(fn _ => let val strexp' as
17387strexp'1=strexp'1 ()
17388 in ( strexp' ) end
17389)
17390 in (LrTable.NT 82,(result,strexp'1left,strexp'1right),rest671) end
17391| (202,(_,(MlyValue.sigexp sigexp1,_,sigexpright as sigexp1right))::_
17392::(_,(MlyValue.strexp strexp1,strexpleft as strexp1left,_))::rest671)
17393 => let val result=MlyValue.strexp(fn _ => let val strexp as strexp1=
17394strexp1 ()
17395val sigexp as sigexp1=sigexp1 ()
17396 in (
17397 TRANSStrExp(I(strexpleft,sigexpright),
17398 strexp, sigexp) )
17399 end
17400)
17401 in (LrTable.NT 82,(result,strexp1left,sigexp1right),rest671) end
17402| (203,(_,(MlyValue.sigexp sigexp1,_,sigexpright as sigexp1right))::_
17403::(_,(MlyValue.strexp strexp1,strexpleft as strexp1left,_))::rest671)
17404 => let val result=MlyValue.strexp(fn _ => let val strexp as strexp1=
17405strexp1 ()
17406val sigexp as sigexp1=sigexp1 ()
17407 in ( OPAQStrExp(I(strexpleft,sigexpright), strexp, sigexp)) end
17408)
17409 in (LrTable.NT 82,(result,strexp1left,sigexp1right),rest671) end
17410| (204,(_,(_,_,ENDright as END1right))::(_,(MlyValue.popInfix
17411popInfix1,_,_))::(_,(MlyValue.strdec strdec1,_,_))::(_,(
17412MlyValue.pushInfix pushInfix1,_,_))::(_,(_,STRUCTleft as STRUCT1left,_
17413))::rest671) => let val result=MlyValue.strexp'(fn _ => let val
17414pushInfix1=pushInfix1 ()
17415val strdec as strdec1=strdec1 ()
17416val popInfix1=popInfix1 ()
17417 in ( STRUCTStrExp(I(STRUCTleft,ENDright), strdec) ) end
17418)
17419 in (LrTable.NT 83,(result,STRUCT1left,END1right),rest671) end
17420| (205,(_,(MlyValue.longstrid longstrid1,longstridleft as
17421longstrid1left,longstridright as longstrid1right))::rest671) => let
17422val result=MlyValue.strexp'(fn _ => let val longstrid as longstrid1=
17423longstrid1 ()
17424 in (
17425 LONGSTRIDStrExp(I(longstridleft,longstridright),
17426 longstrid) )
17427 end
17428)
17429 in (LrTable.NT 83,(result,longstrid1left,longstrid1right),rest671)
17430 end
17431| (206,(_,(_,_,RPARright as RPAR1right))::(_,(MlyValue.strexp strexp1,
17432_,_))::_::(_,(MlyValue.funid funid1,funidleft as funid1left,_))::
17433rest671) => let val result=MlyValue.strexp'(fn _ => let val funid as
17434funid1=funid1 ()
17435val strexp as strexp1=strexp1 ()
17436 in ( APPStrExp(I(funidleft,RPARright), funid, strexp) ) end
17437)
17438 in (LrTable.NT 83,(result,funid1left,RPAR1right),rest671) end
17439| (207,(_,(_,_,RPARright as RPAR1right))::(_,(MlyValue.strdec strdec1,
17440_,_))::_::(_,(MlyValue.funid funid1,funidleft as funid1left,_))::
17441rest671) => let val result=MlyValue.strexp'(fn _ => let val funid as
17442funid1=funid1 ()
17443val strdec as strdec1=strdec1 ()
17444 in ( APPDECStrExp(I(funidleft,RPARright), funid, strdec) ) end
17445)
17446 in (LrTable.NT 83,(result,funid1left,RPAR1right),rest671) end
17447| (208,(_,(_,_,ENDright as END1right))::(_,(MlyValue.popInfix
17448popInfix1,_,_))::(_,(MlyValue.strexp strexp1,_,_))::_::(_,(
17449MlyValue.strdec strdec1,_,_))::(_,(MlyValue.pushInfix pushInfix1,_,_))
17450::(_,(_,LETleft as LET1left,_))::rest671) => let val result=
17451MlyValue.strexp'(fn _ => let val pushInfix1=pushInfix1 ()
17452val strdec as strdec1=strdec1 ()
17453val strexp as strexp1=strexp1 ()
17454val popInfix1=popInfix1 ()
17455 in ( LETStrExp(I(LETleft,ENDright), strdec, strexp) ) end
17456)
17457 in (LrTable.NT 83,(result,LET1left,END1right),rest671) end
17458| (209,(_,(MlyValue.strdec1 strdec11,strdec11left,strdec11right))::
17459rest671) => let val result=MlyValue.strdec(fn _ => let val strdec1 as
17460strdec11=strdec11 ()
17461 in ( strdec1 ) end
17462)
17463 in (LrTable.NT 84,(result,strdec11left,strdec11right),rest671) end
17464| (210,rest671) => let val result=MlyValue.strdec(fn _ => (
17465 EMPTYStrDec(I(defaultPos,defaultPos)) ))
17466 in (LrTable.NT 84,(result,defaultPos,defaultPos),rest671) end
17467| (211,(_,(MlyValue.strdec1' strdec1'1,strdec1'1left,strdec1'1right))
17468::rest671) => let val result=MlyValue.strdec1(fn _ => let val strdec1'
17469 as strdec1'1=strdec1'1 ()
17470 in ( strdec1' ) end
17471)
17472 in (LrTable.NT 85,(result,strdec1'1left,strdec1'1right),rest671) end
17473| (212,(_,(MlyValue.strdec1 strdec12,_,strdec12right))::(_,(
17474MlyValue.strdec1 strdec11,strdec11left,_))::rest671) => let val result
17475=MlyValue.strdec1(fn _ => let val strdec11=strdec11 ()
17476val strdec12=strdec12 ()
17477 in (
17478 SEQStrDec(I(strdec11left,strdec12right),
17479 strdec11, strdec12)
17480) end
17481)
17482 in (LrTable.NT 85,(result,strdec11left,strdec12right),rest671) end
17483| (213,(_,(_,SEMICOLONleft as SEMICOLON1left,SEMICOLONright as
17484SEMICOLON1right))::rest671) => let val result=MlyValue.strdec1(fn _
17485 => ( EMPTYStrDec(I(SEMICOLONleft,SEMICOLONright)) ))
17486 in (LrTable.NT 85,(result,SEMICOLON1left,SEMICOLON1right),rest671)
17487 end
17488| (214,(_,(MlyValue.dec1' dec1'1,dec1'left as dec1'1left,dec1'right
17489 as dec1'1right))::rest671) => let val result=MlyValue.strdec1'(fn _
17490 => let val dec1' as dec1'1=dec1'1 ()
17491 in ( DECStrDec(I(dec1'left,dec1'right), dec1') ) end
17492)
17493 in (LrTable.NT 86,(result,dec1'1left,dec1'1right),rest671) end
17494| (215,(_,(MlyValue.strbind strbind1,_,strbindright as strbind1right))
17495::(_,(_,STRUCTUREleft as STRUCTURE1left,_))::rest671) => let val
17496result=MlyValue.strdec1'(fn _ => let val strbind as strbind1=strbind1
17497()
17498 in ( STRUCTUREStrDec(I(STRUCTUREleft,strbindright),
17499 strbind) )
17500 end
17501)
17502 in (LrTable.NT 86,(result,STRUCTURE1left,strbind1right),rest671) end
17503| (216,(_,(_,_,ENDright as END1right))::(_,(MlyValue.popLocalInfix
17504popLocalInfix1,_,_))::(_,(MlyValue.strdec strdec2,_,_))::(_,(
17505MlyValue.pushLocalInfix pushLocalInfix1,_,_))::_::(_,(MlyValue.strdec
17506strdec1,_,_))::(_,(MlyValue.pushInfix pushInfix1,_,_))::(_,(_,
17507LOCALleft as LOCAL1left,_))::rest671) => let val result=
17508MlyValue.strdec1'(fn _ => let val pushInfix1=pushInfix1 ()
17509val strdec1=strdec1 ()
17510val pushLocalInfix1=pushLocalInfix1 ()
17511val strdec2=strdec2 ()
17512val popLocalInfix1=popLocalInfix1 ()
17513 in ( LOCALStrDec(I(LOCALleft,ENDright), strdec1, strdec2) ) end
17514)
17515 in (LrTable.NT 86,(result,LOCAL1left,END1right),rest671) end
17516| (217,(_,(MlyValue.strexp__AND_strbind_opt strexp__AND_strbind_opt1,_
17517,strexp__AND_strbind_optright as strexp__AND_strbind_opt1right))::_::(
17518_,(MlyValue.COLON_sigexp_opt COLON_sigexp_opt1,_,_))::(_,(
17519MlyValue.strid strid1,stridleft as strid1left,_))::rest671) => let
17520val result=MlyValue.strbind(fn _ => let val strid as strid1=strid1 ()
17521val COLON_sigexp_opt as COLON_sigexp_opt1=COLON_sigexp_opt1 ()
17522val strexp__AND_strbind_opt as strexp__AND_strbind_opt1=
17523strexp__AND_strbind_opt1 ()
17524 in (
17525 TRANSStrBind(I(stridleft,
17526 strexp__AND_strbind_optright),
17527 strid, COLON_sigexp_opt,
17528 #1 strexp__AND_strbind_opt,
17529 #2 strexp__AND_strbind_opt)
17530) end
17531)
17532 in (LrTable.NT 87,(result,strid1left,strexp__AND_strbind_opt1right),
17533rest671) end
17534| (218,(_,(MlyValue.strexp__AND_strbind_opt strexp__AND_strbind_opt1,_
17535,strexp__AND_strbind_optright as strexp__AND_strbind_opt1right))::_::(
17536_,(MlyValue.sigexp sigexp1,_,_))::_::(_,(MlyValue.strid strid1,
17537stridleft as strid1left,_))::rest671) => let val result=
17538MlyValue.strbind(fn _ => let val strid as strid1=strid1 ()
17539val sigexp as sigexp1=sigexp1 ()
17540val strexp__AND_strbind_opt as strexp__AND_strbind_opt1=
17541strexp__AND_strbind_opt1 ()
17542 in (
17543 OPAQStrBind(I(stridleft,strexp__AND_strbind_optright),
17544 strid, sigexp, #1 strexp__AND_strbind_opt,
17545 #2 strexp__AND_strbind_opt)
17546) end
17547)
17548 in (LrTable.NT 87,(result,strid1left,strexp__AND_strbind_opt1right),
17549rest671) end
17550| (219,(_,(MlyValue.strbind strbind1,_,strbind1right))::(_,(_,AND1left
17551,_))::rest671) => let val result=MlyValue.AND_strbind_opt(fn _ => let
17552val strbind as strbind1=strbind1 ()
17553 in ( SOME strbind ) end
17554)
17555 in (LrTable.NT 88,(result,AND1left,strbind1right),rest671) end
17556| (220,rest671) => let val result=MlyValue.AND_strbind_opt(fn _ => (
17557 NONE ))
17558 in (LrTable.NT 88,(result,defaultPos,defaultPos),rest671) end
17559| (221,(_,(MlyValue.AND_strbind_opt AND_strbind_opt1,_,
17560AND_strbind_opt1right))::(_,(MlyValue.strexp' strexp'1,strexp'1left,_)
17561)::rest671) => let val result=MlyValue.strexp__AND_strbind_opt(fn _
17562 => let val strexp' as strexp'1=strexp'1 ()
17563val AND_strbind_opt as AND_strbind_opt1=AND_strbind_opt1 ()
17564 in ( ( strexp', AND_strbind_opt ) ) end
17565)
17566 in (LrTable.NT 89,(result,strexp'1left,AND_strbind_opt1right),rest671
17567) end
17568| (222,(_,(MlyValue.sigexp__AND_strbind_opt sigexp__AND_strbind_opt1,_
17569,sigexp__AND_strbind_optright as sigexp__AND_strbind_opt1right))::_::(
17570_,(MlyValue.strexp strexp1,strexpleft as strexp1left,_))::rest671) =>
17571let val result=MlyValue.strexp__AND_strbind_opt(fn _ => let val strexp
17572 as strexp1=strexp1 ()
17573val sigexp__AND_strbind_opt as sigexp__AND_strbind_opt1=
17574sigexp__AND_strbind_opt1 ()
17575 in (
17576 ( TRANSStrExp(I(strexpleft,
17577 sigexp__AND_strbind_optright),
17578 strexp, #1 sigexp__AND_strbind_opt),
17579 #2 sigexp__AND_strbind_opt )
17580) end
17581)
17582 in (LrTable.NT 89,(result,strexp1left,sigexp__AND_strbind_opt1right),
17583rest671) end
17584| (223,(_,(MlyValue.sigexp__AND_strbind_opt sigexp__AND_strbind_opt1,_
17585,sigexp__AND_strbind_optright as sigexp__AND_strbind_opt1right))::_::(
17586_,(MlyValue.strexp strexp1,strexpleft as strexp1left,_))::rest671) =>
17587let val result=MlyValue.strexp__AND_strbind_opt(fn _ => let val strexp
17588 as strexp1=strexp1 ()
17589val sigexp__AND_strbind_opt as sigexp__AND_strbind_opt1=
17590sigexp__AND_strbind_opt1 ()
17591 in (
17592 ( OPAQStrExp(I(strexpleft,
17593 sigexp__AND_strbind_optright),
17594 strexp, #1 sigexp__AND_strbind_opt),
17595 #2 sigexp__AND_strbind_opt )
17596) end
17597)
17598 in (LrTable.NT 89,(result,strexp1left,sigexp__AND_strbind_opt1right),
17599rest671) end
17600| (224,(_,(MlyValue.AND_strbind_opt AND_strbind_opt1,_,
17601AND_strbind_opt1right))::(_,(MlyValue.sigexp' sigexp'1,sigexp'1left,_)
17602)::rest671) => let val result=MlyValue.sigexp__AND_strbind_opt(fn _
17603 => let val sigexp' as sigexp'1=sigexp'1 ()
17604val AND_strbind_opt as AND_strbind_opt1=AND_strbind_opt1 ()
17605 in ( ( sigexp', AND_strbind_opt ) ) end
17606)
17607 in (LrTable.NT 90,(result,sigexp'1left,AND_strbind_opt1right),rest671
17608) end
17609| (225,(_,(MlyValue.tyreadesc__AND_strbind_opt
17610tyreadesc__AND_strbind_opt1,_,tyreadesc__AND_strbind_optright as
17611tyreadesc__AND_strbind_opt1right))::_::(_,(MlyValue.sigexp sigexp1,
17612sigexpleft as sigexp1left,_))::rest671) => let val result=
17613MlyValue.sigexp__AND_strbind_opt(fn _ => let val sigexp as sigexp1=
17614sigexp1 ()
17615val tyreadesc__AND_strbind_opt as tyreadesc__AND_strbind_opt1=
17616tyreadesc__AND_strbind_opt1 ()
17617 in (
17618 ( WHERETYPESigExp(I(sigexpleft,
17619 tyreadesc__AND_strbind_optright),
17620 sigexp,
17621 #1 tyreadesc__AND_strbind_opt),
17622 #2 tyreadesc__AND_strbind_opt )
17623) end
17624)
17625 in (LrTable.NT 90,(result,sigexp1left,
17626tyreadesc__AND_strbind_opt1right),rest671) end
17627| (226,(_,(MlyValue.AND_tyreadesc_opt__AND_strbind_opt
17628AND_tyreadesc_opt__AND_strbind_opt1,_,
17629AND_tyreadesc_opt__AND_strbind_optright as
17630AND_tyreadesc_opt__AND_strbind_opt1right))::(_,(MlyValue.ty ty1,_,_))
17631::_::(_,(MlyValue.longtycon longtycon1,_,_))::(_,(MlyValue.tyvarseq
17632tyvarseq1,_,_))::(_,(_,TYPEleft as TYPE1left,_))::rest671) => let val
17633result=MlyValue.tyreadesc__AND_strbind_opt(fn _ => let val tyvarseq
17634 as tyvarseq1=tyvarseq1 ()
17635val longtycon as longtycon1=longtycon1 ()
17636val ty as ty1=ty1 ()
17637val AND_tyreadesc_opt__AND_strbind_opt as
17638AND_tyreadesc_opt__AND_strbind_opt1=
17639AND_tyreadesc_opt__AND_strbind_opt1 ()
17640 in (
17641 ( TyReaDesc(I(TYPEleft,
17642 AND_tyreadesc_opt__AND_strbind_optright),
17643 tyvarseq, longtycon, ty,
17644 #1 AND_tyreadesc_opt__AND_strbind_opt),
17645 #2 AND_tyreadesc_opt__AND_strbind_opt )
17646) end
17647)
17648 in (LrTable.NT 91,(result,TYPE1left,
17649AND_tyreadesc_opt__AND_strbind_opt1right),rest671) end
17650| (227,(_,(MlyValue.AND_strbind_opt AND_strbind_opt1,
17651AND_strbind_opt1left,AND_strbind_opt1right))::rest671) => let val
17652result=MlyValue.AND_tyreadesc_opt__AND_strbind_opt(fn _ => let val
17653AND_strbind_opt as AND_strbind_opt1=AND_strbind_opt1 ()
17654 in ( ( NONE, AND_strbind_opt ) ) end
17655)
17656 in (LrTable.NT 92,(result,AND_strbind_opt1left,AND_strbind_opt1right)
17657,rest671) end
17658| (228,(_,(MlyValue.tyreadesc__AND_strbind_opt
17659tyreadesc__AND_strbind_opt1,_,tyreadesc__AND_strbind_opt1right))::(_,(
17660_,AND1left,_))::rest671) => let val result=
17661MlyValue.AND_tyreadesc_opt__AND_strbind_opt(fn _ => let val
17662tyreadesc__AND_strbind_opt as tyreadesc__AND_strbind_opt1=
17663tyreadesc__AND_strbind_opt1 ()
17664 in (
17665 ( SOME(#1 tyreadesc__AND_strbind_opt),
17666 #2 tyreadesc__AND_strbind_opt )
17667) end
17668)
17669 in (LrTable.NT 92,(result,AND1left,tyreadesc__AND_strbind_opt1right),
17670rest671) end
17671| (229,(_,(MlyValue.sigexp sigexp1,_,sigexp1right))::(_,(_,COLON1left,
17672_))::rest671) => let val result=MlyValue.COLON_sigexp_opt(fn _ => let
17673val sigexp as sigexp1=sigexp1 ()
17674 in ( SOME sigexp ) end
17675)
17676 in (LrTable.NT 93,(result,COLON1left,sigexp1right),rest671) end
17677| (230,rest671) => let val result=MlyValue.COLON_sigexp_opt(fn _ => (
17678 NONE ))
17679 in (LrTable.NT 93,(result,defaultPos,defaultPos),rest671) end
17680| (231,(_,(MlyValue.sigexp' sigexp'1,sigexp'1left,sigexp'1right))::
17681rest671) => let val result=MlyValue.sigexp(fn _ => let val sigexp' as
17682sigexp'1=sigexp'1 ()
17683 in ( sigexp' ) end
17684)
17685 in (LrTable.NT 94,(result,sigexp'1left,sigexp'1right),rest671) end
17686| (232,(_,(MlyValue.tyreadesc tyreadesc1,_,tyreadescright as
17687tyreadesc1right))::_::(_,(MlyValue.sigexp sigexp1,sigexpleft as
17688sigexp1left,_))::rest671) => let val result=MlyValue.sigexp(fn _ =>
17689let val sigexp as sigexp1=sigexp1 ()
17690val tyreadesc as tyreadesc1=tyreadesc1 ()
17691 in (
17692 WHERETYPESigExp(I(sigexpleft,tyreadescright),
17693 sigexp, tyreadesc)
17694) end
17695)
17696 in (LrTable.NT 94,(result,sigexp1left,tyreadesc1right),rest671) end
17697| (233,(_,(_,_,ENDright as END1right))::(_,(MlyValue.spec spec1,_,_))
17698::(_,(_,SIGleft as SIG1left,_))::rest671) => let val result=
17699MlyValue.sigexp'(fn _ => let val spec as spec1=spec1 ()
17700 in ( SIGSigExp(I(SIGleft,ENDright), spec) ) end
17701)
17702 in (LrTable.NT 95,(result,SIG1left,END1right),rest671) end
17703| (234,(_,(MlyValue.sigid sigid1,sigidleft as sigid1left,sigidright
17704 as sigid1right))::rest671) => let val result=MlyValue.sigexp'(fn _
17705 => let val sigid as sigid1=sigid1 ()
17706 in ( SIGIDSigExp(I(sigidleft,sigidright), sigid) ) end
17707)
17708 in (LrTable.NT 95,(result,sigid1left,sigid1right),rest671) end
17709| (235,(_,(MlyValue.sigbind sigbind1,_,sigbindright as sigbind1right))
17710::(_,(_,SIGNATUREleft as SIGNATURE1left,_))::rest671) => let val
17711result=MlyValue.sigdec(fn _ => let val sigbind as sigbind1=sigbind1 ()
17712 in ( SigDec(I(SIGNATUREleft,sigbindright), sigbind) ) end
17713)
17714 in (LrTable.NT 96,(result,SIGNATURE1left,sigbind1right),rest671) end
17715| (236,(_,(MlyValue.sigexp__AND_sigbind_opt sigexp__AND_sigbind_opt1,_
17716,sigexp__AND_sigbind_optright as sigexp__AND_sigbind_opt1right))::_::(
17717_,(MlyValue.sigid sigid1,sigidleft as sigid1left,_))::rest671) => let
17718val result=MlyValue.sigbind(fn _ => let val sigid as sigid1=sigid1 ()
17719val sigexp__AND_sigbind_opt as sigexp__AND_sigbind_opt1=
17720sigexp__AND_sigbind_opt1 ()
17721 in (
17722 SigBind(I(sigidleft,sigexp__AND_sigbind_optright),
17723 sigid, #1 sigexp__AND_sigbind_opt,
17724 #2 sigexp__AND_sigbind_opt)
17725) end
17726)
17727 in (LrTable.NT 97,(result,sigid1left,sigexp__AND_sigbind_opt1right),
17728rest671) end
17729| (237,(_,(MlyValue.sigbind sigbind1,_,sigbind1right))::(_,(_,AND1left
17730,_))::rest671) => let val result=MlyValue.AND_sigbind_opt(fn _ => let
17731val sigbind as sigbind1=sigbind1 ()
17732 in ( SOME sigbind ) end
17733)
17734 in (LrTable.NT 98,(result,AND1left,sigbind1right),rest671) end
17735| (238,rest671) => let val result=MlyValue.AND_sigbind_opt(fn _ => (
17736 NONE ))
17737 in (LrTable.NT 98,(result,defaultPos,defaultPos),rest671) end
17738| (239,(_,(MlyValue.AND_sigbind_opt AND_sigbind_opt1,_,
17739AND_sigbind_opt1right))::(_,(MlyValue.sigexp' sigexp'1,sigexp'1left,_)
17740)::rest671) => let val result=MlyValue.sigexp__AND_sigbind_opt(fn _
17741 => let val sigexp' as sigexp'1=sigexp'1 ()
17742val AND_sigbind_opt as AND_sigbind_opt1=AND_sigbind_opt1 ()
17743 in ( ( sigexp', AND_sigbind_opt ) ) end
17744)
17745 in (LrTable.NT 99,(result,sigexp'1left,AND_sigbind_opt1right),rest671
17746) end
17747| (240,(_,(MlyValue.tyreadesc__AND_sigbind_opt
17748tyreadesc__AND_sigbind_opt1,_,tyreadesc__AND_sigbind_optright as
17749tyreadesc__AND_sigbind_opt1right))::_::(_,(MlyValue.sigexp sigexp1,
17750sigexpleft as sigexp1left,_))::rest671) => let val result=
17751MlyValue.sigexp__AND_sigbind_opt(fn _ => let val sigexp as sigexp1=
17752sigexp1 ()
17753val tyreadesc__AND_sigbind_opt as tyreadesc__AND_sigbind_opt1=
17754tyreadesc__AND_sigbind_opt1 ()
17755 in (
17756 ( WHERETYPESigExp(I(sigexpleft,
17757 tyreadesc__AND_sigbind_optright),
17758 sigexp,
17759 #1 tyreadesc__AND_sigbind_opt),
17760 #2 tyreadesc__AND_sigbind_opt )
17761) end
17762)
17763 in (LrTable.NT 99,(result,sigexp1left,
17764tyreadesc__AND_sigbind_opt1right),rest671) end
17765| (241,(_,(MlyValue.AND_tyreadesc_opt__AND_sigbind_opt
17766AND_tyreadesc_opt__AND_sigbind_opt1,_,
17767AND_tyreadesc_opt__AND_sigbind_optright as
17768AND_tyreadesc_opt__AND_sigbind_opt1right))::(_,(MlyValue.ty ty1,_,_))
17769::_::(_,(MlyValue.longtycon longtycon1,_,_))::(_,(MlyValue.tyvarseq
17770tyvarseq1,_,_))::(_,(_,TYPEleft as TYPE1left,_))::rest671) => let val
17771result=MlyValue.tyreadesc__AND_sigbind_opt(fn _ => let val tyvarseq
17772 as tyvarseq1=tyvarseq1 ()
17773val longtycon as longtycon1=longtycon1 ()
17774val ty as ty1=ty1 ()
17775val AND_tyreadesc_opt__AND_sigbind_opt as
17776AND_tyreadesc_opt__AND_sigbind_opt1=
17777AND_tyreadesc_opt__AND_sigbind_opt1 ()
17778 in (
17779 ( TyReaDesc(I(TYPEleft,
17780 AND_tyreadesc_opt__AND_sigbind_optright),
17781 tyvarseq, longtycon, ty,
17782 #1 AND_tyreadesc_opt__AND_sigbind_opt),
17783 #2 AND_tyreadesc_opt__AND_sigbind_opt )
17784) end
17785)
17786 in (LrTable.NT 100,(result,TYPE1left,
17787AND_tyreadesc_opt__AND_sigbind_opt1right),rest671) end
17788| (242,(_,(MlyValue.AND_sigbind_opt AND_sigbind_opt1,
17789AND_sigbind_opt1left,AND_sigbind_opt1right))::rest671) => let val
17790result=MlyValue.AND_tyreadesc_opt__AND_sigbind_opt(fn _ => let val
17791AND_sigbind_opt as AND_sigbind_opt1=AND_sigbind_opt1 ()
17792 in ( ( NONE, AND_sigbind_opt) ) end
17793)
17794 in (LrTable.NT 101,(result,AND_sigbind_opt1left,AND_sigbind_opt1right
17795),rest671) end
17796| (243,(_,(MlyValue.tyreadesc__AND_sigbind_opt
17797tyreadesc__AND_sigbind_opt1,_,tyreadesc__AND_sigbind_opt1right))::(_,(
17798_,AND1left,_))::rest671) => let val result=
17799MlyValue.AND_tyreadesc_opt__AND_sigbind_opt(fn _ => let val
17800tyreadesc__AND_sigbind_opt as tyreadesc__AND_sigbind_opt1=
17801tyreadesc__AND_sigbind_opt1 ()
17802 in (
17803 ( SOME(#1 tyreadesc__AND_sigbind_opt),
17804 #2 tyreadesc__AND_sigbind_opt )
17805) end
17806)
17807 in (LrTable.NT 101,(result,AND1left,tyreadesc__AND_sigbind_opt1right)
17808,rest671) end
17809| (244,(_,(MlyValue.AND_tyreadesc_opt AND_tyreadesc_opt1,_,
17810AND_tyreadesc_optright as AND_tyreadesc_opt1right))::(_,(MlyValue.ty
17811ty1,_,_))::_::(_,(MlyValue.longtycon longtycon1,_,_))::(_,(
17812MlyValue.tyvarseq tyvarseq1,_,_))::(_,(_,TYPEleft as TYPE1left,_))::
17813rest671) => let val result=MlyValue.tyreadesc(fn _ => let val tyvarseq
17814 as tyvarseq1=tyvarseq1 ()
17815val longtycon as longtycon1=longtycon1 ()
17816val ty as ty1=ty1 ()
17817val AND_tyreadesc_opt as AND_tyreadesc_opt1=AND_tyreadesc_opt1 ()
17818 in (
17819 TyReaDesc(I(TYPEleft,AND_tyreadesc_optright),
17820 tyvarseq, longtycon, ty,
17821 AND_tyreadesc_opt)
17822) end
17823)
17824 in (LrTable.NT 102,(result,TYPE1left,AND_tyreadesc_opt1right),rest671
17825) end
17826| (245,(_,(MlyValue.tyreadesc tyreadesc1,_,tyreadesc1right))::(_,(_,
17827AND1left,_))::rest671) => let val result=MlyValue.AND_tyreadesc_opt(
17828fn _ => let val tyreadesc as tyreadesc1=tyreadesc1 ()
17829 in ( SOME tyreadesc ) end
17830)
17831 in (LrTable.NT 103,(result,AND1left,tyreadesc1right),rest671) end
17832| (246,rest671) => let val result=MlyValue.AND_tyreadesc_opt(fn _ => (
17833 NONE ))
17834 in (LrTable.NT 103,(result,defaultPos,defaultPos),rest671) end
17835| (247,(_,(MlyValue.spec1 spec11,spec11left,spec11right))::rest671)
17836 => let val result=MlyValue.spec(fn _ => let val spec1 as spec11=
17837spec11 ()
17838 in ( spec1 ) end
17839)
17840 in (LrTable.NT 104,(result,spec11left,spec11right),rest671) end
17841| (248,rest671) => let val result=MlyValue.spec(fn _ => (
17842 EMPTYSpec(I(defaultPos,defaultPos)) ))
17843 in (LrTable.NT 104,(result,defaultPos,defaultPos),rest671) end
17844| (249,(_,(MlyValue.spec1' spec1'1,spec1'1left,spec1'1right))::rest671
17845) => let val result=MlyValue.spec1(fn _ => let val spec1' as spec1'1=
17846spec1'1 ()
17847 in ( spec1' ) end
17848)
17849 in (LrTable.NT 105,(result,spec1'1left,spec1'1right),rest671) end
17850| (250,(_,(MlyValue.spec1' spec1'1,_,spec1'right as spec1'1right))::(_
17851,(MlyValue.spec1 spec11,spec1left as spec11left,_))::rest671) => let
17852val result=MlyValue.spec1(fn _ => let val spec1 as spec11=spec11 ()
17853val spec1' as spec1'1=spec1'1 ()
17854 in ( SEQSpec(I(spec1left,spec1'right), spec1, spec1') ) end
17855)
17856 in (LrTable.NT 105,(result,spec11left,spec1'1right),rest671) end
17857| (251,(_,(_,SEMICOLON1left,SEMICOLON1right))::rest671) => let val
17858result=MlyValue.spec1(fn _ => ( EMPTYSpec(I(defaultPos,defaultPos)) ))
17859 in (LrTable.NT 105,(result,SEMICOLON1left,SEMICOLON1right),rest671)
17860 end
17861| (252,(_,(MlyValue.longtycon_EQUALS_list2 longtycon_EQUALS_list21,_,
17862longtycon_EQUALS_list2right as longtycon_EQUALS_list21right))::_::(_,(
17863_,SHARINGleft as SHARING1left,_))::rest671) => let val result=
17864MlyValue.spec1(fn _ => let val longtycon_EQUALS_list2 as
17865longtycon_EQUALS_list21=longtycon_EQUALS_list21 ()
17866 in (
17867 SHARINGTYPESpec(I(SHARINGleft,
17868 longtycon_EQUALS_list2right),
17869 EMPTYSpec(I(SHARINGleft,SHARINGleft)),
17870 longtycon_EQUALS_list2)
17871) end
17872)
17873 in (LrTable.NT 105,(result,SHARING1left,longtycon_EQUALS_list21right)
17874,rest671) end
17875| (253,(_,(MlyValue.longtycon_EQUALS_list2 longtycon_EQUALS_list21,_,
17876longtycon_EQUALS_list2right as longtycon_EQUALS_list21right))::_::_::(
17877_,(MlyValue.spec1 spec11,spec1left as spec11left,_))::rest671) => let
17878val result=MlyValue.spec1(fn _ => let val spec1 as spec11=spec11 ()
17879val longtycon_EQUALS_list2 as longtycon_EQUALS_list21=
17880longtycon_EQUALS_list21 ()
17881 in (
17882 SHARINGTYPESpec(I(spec1left,
17883 longtycon_EQUALS_list2right),
17884 spec1, longtycon_EQUALS_list2)
17885) end
17886)
17887 in (LrTable.NT 105,(result,spec11left,longtycon_EQUALS_list21right),
17888rest671) end
17889| (254,(_,(MlyValue.longstrid_EQUALS_list2 longstrid_EQUALS_list21,_,
17890longstrid_EQUALS_list2right as longstrid_EQUALS_list21right))::(_,(_,
17891SHARINGleft as SHARING1left,_))::rest671) => let val result=
17892MlyValue.spec1(fn _ => let val longstrid_EQUALS_list2 as
17893longstrid_EQUALS_list21=longstrid_EQUALS_list21 ()
17894 in (
17895 SHARINGSpec(I(SHARINGleft,
17896 longstrid_EQUALS_list2right),
17897 EMPTYSpec(I(SHARINGleft,SHARINGleft)),
17898 longstrid_EQUALS_list2)
17899) end
17900)
17901 in (LrTable.NT 105,(result,SHARING1left,longstrid_EQUALS_list21right)
17902,rest671) end
17903| (255,(_,(MlyValue.longstrid_EQUALS_list2 longstrid_EQUALS_list21,_,
17904longstrid_EQUALS_list2right as longstrid_EQUALS_list21right))::_::(_,(
17905MlyValue.spec1 spec11,spec1left as spec11left,_))::rest671) => let
17906val result=MlyValue.spec1(fn _ => let val spec1 as spec11=spec11 ()
17907val longstrid_EQUALS_list2 as longstrid_EQUALS_list21=
17908longstrid_EQUALS_list21 ()
17909 in (
17910 SHARINGSpec(I(spec1left,longstrid_EQUALS_list2right),
17911 spec1, longstrid_EQUALS_list2)
17912) end
17913)
17914 in (LrTable.NT 105,(result,spec11left,longstrid_EQUALS_list21right),
17915rest671) end
17916| (256,(_,(MlyValue.valdesc valdesc1,_,valdescright as valdesc1right))
17917::(_,(_,VALleft as VAL1left,_))::rest671) => let val result=
17918MlyValue.spec1'(fn _ => let val valdesc as valdesc1=valdesc1 ()
17919 in ( VALSpec(I(VALleft,valdescright), valdesc) ) end
17920)
17921 in (LrTable.NT 106,(result,VAL1left,valdesc1right),rest671) end
17922| (257,(_,(MlyValue.typdesc typdesc1,_,typdescright as typdesc1right))
17923::(_,(_,TYPEleft as TYPE1left,_))::rest671) => let val result=
17924MlyValue.spec1'(fn _ => let val typdesc as typdesc1=typdesc1 ()
17925 in ( TYPESpec(I(TYPEleft,typdescright), typdesc) ) end
17926)
17927 in (LrTable.NT 106,(result,TYPE1left,typdesc1right),rest671) end
17928| (258,(_,(MlyValue.typdesc typdesc1,_,typdescright as typdesc1right))
17929::(_,(_,EQTYPEleft as EQTYPE1left,_))::rest671) => let val result=
17930MlyValue.spec1'(fn _ => let val typdesc as typdesc1=typdesc1 ()
17931 in ( EQTYPESpec(I(EQTYPEleft,typdescright), typdesc) ) end
17932)
17933 in (LrTable.NT 106,(result,EQTYPE1left,typdesc1right),rest671) end
17934| (259,(_,(MlyValue.syndesc syndesc1,_,syndescright as syndesc1right))
17935::(_,(_,TYPEleft as TYPE1left,_))::rest671) => let val result=
17936MlyValue.spec1'(fn _ => let val syndesc as syndesc1=syndesc1 ()
17937 in ( SYNSpec(I(TYPEleft,syndescright), syndesc) ) end
17938)
17939 in (LrTable.NT 106,(result,TYPE1left,syndesc1right),rest671) end
17940| (260,(_,(MlyValue.datdesc0 datdesc01,_,datdesc0right as
17941datdesc01right))::(_,(_,DATATYPEleft as DATATYPE1left,_))::rest671)
17942 => let val result=MlyValue.spec1'(fn _ => let val datdesc0 as
17943datdesc01=datdesc01 ()
17944 in ( DATATYPESpec(I(DATATYPEleft,datdesc0right), datdesc0)) end
17945)
17946 in (LrTable.NT 106,(result,DATATYPE1left,datdesc01right),rest671) end
17947| (261,(_,(MlyValue.datdesc1 datdesc11,_,datdesc1right as
17948datdesc11right))::(_,(_,DATATYPEleft as DATATYPE1left,_))::rest671)
17949 => let val result=MlyValue.spec1'(fn _ => let val datdesc1 as
17950datdesc11=datdesc11 ()
17951 in ( DATATYPESpec(I(DATATYPEleft,datdesc1right), datdesc1)) end
17952)
17953 in (LrTable.NT 106,(result,DATATYPE1left,datdesc11right),rest671) end
17954| (262,(_,(MlyValue.longtycon longtycon1,_,longtyconright as
17955longtycon1right))::_::_::(_,(MlyValue.tycon tycon1,_,_))::(_,(_,
17956DATATYPEleft as DATATYPE1left,_))::rest671) => let val result=
17957MlyValue.spec1'(fn _ => let val tycon as tycon1=tycon1 ()
17958val longtycon as longtycon1=longtycon1 ()
17959 in (
17960 REPLICATIONSpec(I(DATATYPEleft,longtyconright),
17961 tycon, longtycon)
17962) end
17963)
17964 in (LrTable.NT 106,(result,DATATYPE1left,longtycon1right),rest671)
17965 end
17966| (263,(_,(MlyValue.exdesc exdesc1,_,exdescright as exdesc1right))::(_
17967,(_,EXCEPTIONleft as EXCEPTION1left,_))::rest671) => let val result=
17968MlyValue.spec1'(fn _ => let val exdesc as exdesc1=exdesc1 ()
17969 in ( EXCEPTIONSpec(I(EXCEPTIONleft,exdescright), exdesc) ) end
17970)
17971 in (LrTable.NT 106,(result,EXCEPTION1left,exdesc1right),rest671) end
17972| (264,(_,(MlyValue.strdesc strdesc1,_,strdescright as strdesc1right))
17973::(_,(_,STRUCTUREleft as STRUCTURE1left,_))::rest671) => let val
17974result=MlyValue.spec1'(fn _ => let val strdesc as strdesc1=strdesc1 ()
17975 in ( STRUCTURESpec(I(STRUCTUREleft,strdescright), strdesc)) end
17976)
17977 in (LrTable.NT 106,(result,STRUCTURE1left,strdesc1right),rest671) end
17978| (265,(_,(MlyValue.sigexp sigexp1,_,sigexpright as sigexp1right))::(_
17979,(_,INCLUDEleft as INCLUDE1left,_))::rest671) => let val result=
17980MlyValue.spec1'(fn _ => let val sigexp as sigexp1=sigexp1 ()
17981 in ( INCLUDESpec(I(INCLUDEleft,sigexpright), sigexp) ) end
17982)
17983 in (LrTable.NT 106,(result,INCLUDE1left,sigexp1right),rest671) end
17984| (266,(_,(MlyValue.sigid_list2 sigid_list21,_,sigid_list2right as
17985sigid_list21right))::(_,(_,INCLUDEleft as INCLUDE1left,_))::rest671)
17986 => let val result=MlyValue.spec1'(fn _ => let val sigid_list2 as
17987sigid_list21=sigid_list21 ()
17988 in (
17989 INCLUDEMULTISpec(I(INCLUDEleft,sigid_list2right),
17990 sigid_list2)
17991) end
17992)
17993 in (LrTable.NT 106,(result,INCLUDE1left,sigid_list21right),rest671)
17994 end
17995| (267,(_,(MlyValue.sigid_list2 sigid_list21,_,sigid_list21right))::(_
17996,(MlyValue.sigid sigid1,sigid1left,_))::rest671) => let val result=
17997MlyValue.sigid_list2(fn _ => let val sigid as sigid1=sigid1 ()
17998val sigid_list2 as sigid_list21=sigid_list21 ()
17999 in ( sigid::sigid_list2 ) end
18000)
18001 in (LrTable.NT 107,(result,sigid1left,sigid_list21right),rest671) end
18002| (268,(_,(MlyValue.sigid sigid2,_,sigid2right))::(_,(MlyValue.sigid
18003sigid1,sigid1left,_))::rest671) => let val result=MlyValue.sigid_list2
18004(fn _ => let val sigid1=sigid1 ()
18005val sigid2=sigid2 ()
18006 in ( sigid1::sigid2::[] ) end
18007)
18008 in (LrTable.NT 107,(result,sigid1left,sigid2right),rest671) end
18009| (269,(_,(MlyValue.longtycon_EQUALS_list1 longtycon_EQUALS_list11,_,
18010longtycon_EQUALS_list11right))::_::(_,(MlyValue.longtycon longtycon1,
18011longtycon1left,_))::rest671) => let val result=
18012MlyValue.longtycon_EQUALS_list1(fn _ => let val longtycon as
18013longtycon1=longtycon1 ()
18014val longtycon_EQUALS_list1 as longtycon_EQUALS_list11=
18015longtycon_EQUALS_list11 ()
18016 in ( longtycon::longtycon_EQUALS_list1 ) end
18017)
18018 in (LrTable.NT 108,(result,longtycon1left,
18019longtycon_EQUALS_list11right),rest671) end
18020| (270,(_,(MlyValue.longtycon longtycon1,longtycon1left,
18021longtycon1right))::rest671) => let val result=
18022MlyValue.longtycon_EQUALS_list1(fn _ => let val longtycon as
18023longtycon1=longtycon1 ()
18024 in ( longtycon::[] ) end
18025)
18026 in (LrTable.NT 108,(result,longtycon1left,longtycon1right),rest671)
18027 end
18028| (271,(_,(MlyValue.longtycon_EQUALS_list1 longtycon_EQUALS_list11,_,
18029longtycon_EQUALS_list11right))::_::(_,(MlyValue.longtycon longtycon1,
18030longtycon1left,_))::rest671) => let val result=
18031MlyValue.longtycon_EQUALS_list2(fn _ => let val longtycon as
18032longtycon1=longtycon1 ()
18033val longtycon_EQUALS_list1 as longtycon_EQUALS_list11=
18034longtycon_EQUALS_list11 ()
18035 in ( longtycon::longtycon_EQUALS_list1 ) end
18036)
18037 in (LrTable.NT 109,(result,longtycon1left,
18038longtycon_EQUALS_list11right),rest671) end
18039| (272,(_,(MlyValue.longstrid_EQUALS_list1 longstrid_EQUALS_list11,_,
18040longstrid_EQUALS_list11right))::_::(_,(MlyValue.longstrid longstrid1,
18041longstrid1left,_))::rest671) => let val result=
18042MlyValue.longstrid_EQUALS_list1(fn _ => let val longstrid as
18043longstrid1=longstrid1 ()
18044val longstrid_EQUALS_list1 as longstrid_EQUALS_list11=
18045longstrid_EQUALS_list11 ()
18046 in ( longstrid::longstrid_EQUALS_list1 ) end
18047)
18048 in (LrTable.NT 110,(result,longstrid1left,
18049longstrid_EQUALS_list11right),rest671) end
18050| (273,(_,(MlyValue.longstrid longstrid1,longstrid1left,
18051longstrid1right))::rest671) => let val result=
18052MlyValue.longstrid_EQUALS_list1(fn _ => let val longstrid as
18053longstrid1=longstrid1 ()
18054 in ( longstrid::[] ) end
18055)
18056 in (LrTable.NT 110,(result,longstrid1left,longstrid1right),rest671)
18057 end
18058| (274,(_,(MlyValue.longstrid_EQUALS_list1 longstrid_EQUALS_list11,_,
18059longstrid_EQUALS_list11right))::_::(_,(MlyValue.longstrid longstrid1,
18060longstrid1left,_))::rest671) => let val result=
18061MlyValue.longstrid_EQUALS_list2(fn _ => let val longstrid as
18062longstrid1=longstrid1 ()
18063val longstrid_EQUALS_list1 as longstrid_EQUALS_list11=
18064longstrid_EQUALS_list11 ()
18065 in ( longstrid::longstrid_EQUALS_list1 ) end
18066)
18067 in (LrTable.NT 111,(result,longstrid1left,
18068longstrid_EQUALS_list11right),rest671) end
18069| (275,(_,(MlyValue.AND_valdesc_opt AND_valdesc_opt1,_,
18070AND_valdesc_optright as AND_valdesc_opt1right))::(_,(MlyValue.ty ty1,_
18071,_))::_::(_,(MlyValue.vid' vid'1,vid'left as vid'1left,_))::rest671)
18072 => let val result=MlyValue.valdesc(fn _ => let val vid' as vid'1=
18073vid'1 ()
18074val ty as ty1=ty1 ()
18075val AND_valdesc_opt as AND_valdesc_opt1=AND_valdesc_opt1 ()
18076 in (
18077 ValDesc(I(vid'left,AND_valdesc_optright),
18078 vid', ty, AND_valdesc_opt)
18079) end
18080)
18081 in (LrTable.NT 112,(result,vid'1left,AND_valdesc_opt1right),rest671)
18082 end
18083| (276,(_,(MlyValue.valdesc valdesc1,_,valdesc1right))::(_,(_,AND1left
18084,_))::rest671) => let val result=MlyValue.AND_valdesc_opt(fn _ => let
18085val valdesc as valdesc1=valdesc1 ()
18086 in ( SOME valdesc ) end
18087)
18088 in (LrTable.NT 113,(result,AND1left,valdesc1right),rest671) end
18089| (277,rest671) => let val result=MlyValue.AND_valdesc_opt(fn _ => (
18090 NONE ))
18091 in (LrTable.NT 113,(result,defaultPos,defaultPos),rest671) end
18092| (278,(_,(MlyValue.AND_typdesc_opt AND_typdesc_opt1,_,
18093AND_typdesc_optright as AND_typdesc_opt1right))::(_,(MlyValue.tycon
18094tycon1,_,_))::(_,(MlyValue.tyvarseq tyvarseq1,tyvarseqleft as
18095tyvarseq1left,_))::rest671) => let val result=MlyValue.typdesc(fn _
18096 => let val tyvarseq as tyvarseq1=tyvarseq1 ()
18097val tycon as tycon1=tycon1 ()
18098val AND_typdesc_opt as AND_typdesc_opt1=AND_typdesc_opt1 ()
18099 in (
18100 TypDesc(I(tyvarseqleft,AND_typdesc_optright),
18101 tyvarseq, tycon, AND_typdesc_opt)
18102) end
18103)
18104 in (LrTable.NT 114,(result,tyvarseq1left,AND_typdesc_opt1right),
18105rest671) end
18106| (279,(_,(MlyValue.typdesc typdesc1,_,typdesc1right))::(_,(_,AND1left
18107,_))::rest671) => let val result=MlyValue.AND_typdesc_opt(fn _ => let
18108val typdesc as typdesc1=typdesc1 ()
18109 in ( SOME typdesc ) end
18110)
18111 in (LrTable.NT 115,(result,AND1left,typdesc1right),rest671) end
18112| (280,rest671) => let val result=MlyValue.AND_typdesc_opt(fn _ => (
18113 NONE ))
18114 in (LrTable.NT 115,(result,defaultPos,defaultPos),rest671) end
18115| (281,(_,(MlyValue.AND_syndesc_opt AND_syndesc_opt1,_,
18116AND_syndesc_optright as AND_syndesc_opt1right))::(_,(MlyValue.ty ty1,_
18117,_))::_::(_,(MlyValue.tycon tycon1,_,_))::(_,(MlyValue.tyvarseq
18118tyvarseq1,tyvarseqleft as tyvarseq1left,_))::rest671) => let val
18119result=MlyValue.syndesc(fn _ => let val tyvarseq as tyvarseq1=
18120tyvarseq1 ()
18121val tycon as tycon1=tycon1 ()
18122val ty as ty1=ty1 ()
18123val AND_syndesc_opt as AND_syndesc_opt1=AND_syndesc_opt1 ()
18124 in (
18125 SynDesc(I(tyvarseqleft,AND_syndesc_optright),
18126 tyvarseq, tycon, ty, AND_syndesc_opt)
18127) end
18128)
18129 in (LrTable.NT 116,(result,tyvarseq1left,AND_syndesc_opt1right),
18130rest671) end
18131| (282,(_,(MlyValue.syndesc syndesc1,_,syndesc1right))::(_,(_,AND1left
18132,_))::rest671) => let val result=MlyValue.AND_syndesc_opt(fn _ => let
18133val syndesc as syndesc1=syndesc1 ()
18134 in ( SOME syndesc ) end
18135)
18136 in (LrTable.NT 117,(result,AND1left,syndesc1right),rest671) end
18137| (283,rest671) => let val result=MlyValue.AND_syndesc_opt(fn _ => (
18138 NONE ))
18139 in (LrTable.NT 117,(result,defaultPos,defaultPos),rest671) end
18140| (284,(_,(MlyValue.AND_datdesc_opt AND_datdesc_opt1,_,
18141AND_datdesc_optright as AND_datdesc_opt1right))::(_,(MlyValue.condesc
18142condesc1,_,_))::_::(_,(MlyValue.tycon tycon1,_,_))::(_,(
18143MlyValue.tyvarseq tyvarseq1,tyvarseqleft as tyvarseq1left,_))::rest671
18144) => let val result=MlyValue.datdesc(fn _ => let val tyvarseq as
18145tyvarseq1=tyvarseq1 ()
18146val tycon as tycon1=tycon1 ()
18147val condesc as condesc1=condesc1 ()
18148val AND_datdesc_opt as AND_datdesc_opt1=AND_datdesc_opt1 ()
18149 in (
18150 DatDesc(I(tyvarseqleft,AND_datdesc_optright),
18151 tyvarseq, tycon, condesc, AND_datdesc_opt)
18152) end
18153)
18154 in (LrTable.NT 118,(result,tyvarseq1left,AND_datdesc_opt1right),
18155rest671) end
18156| (285,(_,(MlyValue.AND_datdesc_opt AND_datdesc_opt1,_,
18157AND_datdesc_optright as AND_datdesc_opt1right))::(_,(MlyValue.condesc
18158condesc1,_,_))::_::(_,(MlyValue.tycon tycon1,tyconleft as tycon1left,_
18159))::rest671) => let val result=MlyValue.datdesc0(fn _ => let val tycon
18160 as tycon1=tycon1 ()
18161val condesc as condesc1=condesc1 ()
18162val AND_datdesc_opt as AND_datdesc_opt1=AND_datdesc_opt1 ()
18163 in (
18164 DatDesc(I(tyconleft,AND_datdesc_optright),
18165 TyVarseq(I(defaultPos,defaultPos), []),
18166 tycon, condesc, AND_datdesc_opt)
18167) end
18168)
18169 in (LrTable.NT 119,(result,tycon1left,AND_datdesc_opt1right),rest671)
18170 end
18171| (286,(_,(MlyValue.AND_datdesc_opt AND_datdesc_opt1,_,
18172AND_datdesc_optright as AND_datdesc_opt1right))::(_,(MlyValue.condesc
18173condesc1,_,_))::_::(_,(MlyValue.tycon tycon1,_,_))::(_,(
18174MlyValue.tyvarseq1 tyvarseq11,tyvarseq1left as tyvarseq11left,_))::
18175rest671) => let val result=MlyValue.datdesc1(fn _ => let val tyvarseq1
18176 as tyvarseq11=tyvarseq11 ()
18177val tycon as tycon1=tycon1 ()
18178val condesc as condesc1=condesc1 ()
18179val AND_datdesc_opt as AND_datdesc_opt1=AND_datdesc_opt1 ()
18180 in (
18181 DatDesc(I(tyvarseq1left,AND_datdesc_optright),
18182 tyvarseq1, tycon, condesc, AND_datdesc_opt)
18183) end
18184)
18185 in (LrTable.NT 120,(result,tyvarseq11left,AND_datdesc_opt1right),
18186rest671) end
18187| (287,(_,(MlyValue.datdesc datdesc1,_,datdesc1right))::(_,(_,AND1left
18188,_))::rest671) => let val result=MlyValue.AND_datdesc_opt(fn _ => let
18189val datdesc as datdesc1=datdesc1 ()
18190 in ( SOME datdesc ) end
18191)
18192 in (LrTable.NT 121,(result,AND1left,datdesc1right),rest671) end
18193| (288,rest671) => let val result=MlyValue.AND_datdesc_opt(fn _ => (
18194 NONE ))
18195 in (LrTable.NT 121,(result,defaultPos,defaultPos),rest671) end
18196| (289,(_,(MlyValue.BAR_condesc_opt BAR_condesc_opt1,_,
18197BAR_condesc_optright as BAR_condesc_opt1right))::(_,(
18198MlyValue.OF_ty_opt OF_ty_opt1,_,_))::(_,(MlyValue.vid' vid'1,vid'left
18199 as vid'1left,_))::rest671) => let val result=MlyValue.condesc(fn _
18200 => let val vid' as vid'1=vid'1 ()
18201val OF_ty_opt as OF_ty_opt1=OF_ty_opt1 ()
18202val BAR_condesc_opt as BAR_condesc_opt1=BAR_condesc_opt1 ()
18203 in (
18204 ConDesc(I(vid'left,BAR_condesc_optright),
18205 vid', OF_ty_opt, BAR_condesc_opt)
18206) end
18207)
18208 in (LrTable.NT 122,(result,vid'1left,BAR_condesc_opt1right),rest671)
18209 end
18210| (290,(_,(MlyValue.condesc condesc1,_,condesc1right))::(_,(_,BAR1left
18211,_))::rest671) => let val result=MlyValue.BAR_condesc_opt(fn _ => let
18212val condesc as condesc1=condesc1 ()
18213 in ( SOME condesc ) end
18214)
18215 in (LrTable.NT 123,(result,BAR1left,condesc1right),rest671) end
18216| (291,rest671) => let val result=MlyValue.BAR_condesc_opt(fn _ => (
18217 NONE ))
18218 in (LrTable.NT 123,(result,defaultPos,defaultPos),rest671) end
18219| (292,(_,(MlyValue.AND_exdesc_opt AND_exdesc_opt1,_,
18220AND_exdesc_optright as AND_exdesc_opt1right))::(_,(MlyValue.OF_ty_opt
18221OF_ty_opt1,_,_))::(_,(MlyValue.vid' vid'1,vid'left as vid'1left,_))::
18222rest671) => let val result=MlyValue.exdesc(fn _ => let val vid' as
18223vid'1=vid'1 ()
18224val OF_ty_opt as OF_ty_opt1=OF_ty_opt1 ()
18225val AND_exdesc_opt as AND_exdesc_opt1=AND_exdesc_opt1 ()
18226 in (
18227 ExDesc(I(vid'left,AND_exdesc_optright),
18228 vid', OF_ty_opt, AND_exdesc_opt)
18229) end
18230)
18231 in (LrTable.NT 124,(result,vid'1left,AND_exdesc_opt1right),rest671)
18232 end
18233| (293,(_,(MlyValue.exdesc exdesc1,_,exdesc1right))::(_,(_,AND1left,_)
18234)::rest671) => let val result=MlyValue.AND_exdesc_opt(fn _ => let val
18235exdesc as exdesc1=exdesc1 ()
18236 in ( SOME exdesc ) end
18237)
18238 in (LrTable.NT 125,(result,AND1left,exdesc1right),rest671) end
18239| (294,rest671) => let val result=MlyValue.AND_exdesc_opt(fn _ => (
18240 NONE ))
18241 in (LrTable.NT 125,(result,defaultPos,defaultPos),rest671) end
18242| (295,(_,(MlyValue.sigexp__AND_strdesc_opt sigexp__AND_strdesc_opt1,_
18243,sigexp__AND_strdesc_optright as sigexp__AND_strdesc_opt1right))::_::(
18244_,(MlyValue.strid strid1,stridleft as strid1left,_))::rest671) => let
18245val result=MlyValue.strdesc(fn _ => let val strid as strid1=strid1 ()
18246val sigexp__AND_strdesc_opt as sigexp__AND_strdesc_opt1=
18247sigexp__AND_strdesc_opt1 ()
18248 in (
18249 StrDesc(I(stridleft,sigexp__AND_strdesc_optright),
18250 strid, #1 sigexp__AND_strdesc_opt,
18251 #2 sigexp__AND_strdesc_opt)
18252) end
18253)
18254 in (LrTable.NT 126,(result,strid1left,sigexp__AND_strdesc_opt1right),
18255rest671) end
18256| (296,(_,(MlyValue.strdesc strdesc1,_,strdesc1right))::(_,(_,AND1left
18257,_))::rest671) => let val result=MlyValue.AND_strdesc_opt(fn _ => let
18258val strdesc as strdesc1=strdesc1 ()
18259 in ( SOME strdesc ) end
18260)
18261 in (LrTable.NT 127,(result,AND1left,strdesc1right),rest671) end
18262| (297,rest671) => let val result=MlyValue.AND_strdesc_opt(fn _ => (
18263 NONE ))
18264 in (LrTable.NT 127,(result,defaultPos,defaultPos),rest671) end
18265| (298,(_,(MlyValue.AND_strdesc_opt AND_strdesc_opt1,_,
18266AND_strdesc_opt1right))::(_,(MlyValue.sigexp' sigexp'1,sigexp'1left,_)
18267)::rest671) => let val result=MlyValue.sigexp__AND_strdesc_opt(fn _
18268 => let val sigexp' as sigexp'1=sigexp'1 ()
18269val AND_strdesc_opt as AND_strdesc_opt1=AND_strdesc_opt1 ()
18270 in ( ( sigexp', AND_strdesc_opt ) ) end
18271)
18272 in (LrTable.NT 128,(result,sigexp'1left,AND_strdesc_opt1right),
18273rest671) end
18274| (299,(_,(MlyValue.tyreadesc__AND_strdesc_opt
18275tyreadesc__AND_strdesc_opt1,_,tyreadesc__AND_strdesc_optright as
18276tyreadesc__AND_strdesc_opt1right))::_::(_,(MlyValue.sigexp sigexp1,
18277sigexpleft as sigexp1left,_))::rest671) => let val result=
18278MlyValue.sigexp__AND_strdesc_opt(fn _ => let val sigexp as sigexp1=
18279sigexp1 ()
18280val tyreadesc__AND_strdesc_opt as tyreadesc__AND_strdesc_opt1=
18281tyreadesc__AND_strdesc_opt1 ()
18282 in (
18283 ( WHERETYPESigExp(I(sigexpleft,
18284 tyreadesc__AND_strdesc_optright),
18285 sigexp,
18286 #1 tyreadesc__AND_strdesc_opt),
18287 #2 tyreadesc__AND_strdesc_opt )
18288) end
18289)
18290 in (LrTable.NT 128,(result,sigexp1left,
18291tyreadesc__AND_strdesc_opt1right),rest671) end
18292| (300,(_,(MlyValue.AND_tyreadesc_opt__AND_strdesc_opt
18293AND_tyreadesc_opt__AND_strdesc_opt1,_,
18294AND_tyreadesc_opt__AND_strdesc_optright as
18295AND_tyreadesc_opt__AND_strdesc_opt1right))::(_,(MlyValue.ty ty1,_,_))
18296::_::(_,(MlyValue.longtycon longtycon1,_,_))::(_,(MlyValue.tyvarseq
18297tyvarseq1,_,_))::(_,(_,TYPEleft as TYPE1left,_))::rest671) => let val
18298result=MlyValue.tyreadesc__AND_strdesc_opt(fn _ => let val tyvarseq
18299 as tyvarseq1=tyvarseq1 ()
18300val longtycon as longtycon1=longtycon1 ()
18301val ty as ty1=ty1 ()
18302val AND_tyreadesc_opt__AND_strdesc_opt as
18303AND_tyreadesc_opt__AND_strdesc_opt1=
18304AND_tyreadesc_opt__AND_strdesc_opt1 ()
18305 in (
18306 ( TyReaDesc(I(TYPEleft,
18307 AND_tyreadesc_opt__AND_strdesc_optright),
18308 tyvarseq, longtycon, ty,
18309 #1 AND_tyreadesc_opt__AND_strdesc_opt),
18310 #2 AND_tyreadesc_opt__AND_strdesc_opt )
18311) end
18312)
18313 in (LrTable.NT 129,(result,TYPE1left,
18314AND_tyreadesc_opt__AND_strdesc_opt1right),rest671) end
18315| (301,(_,(MlyValue.AND_strdesc_opt AND_strdesc_opt1,
18316AND_strdesc_opt1left,AND_strdesc_opt1right))::rest671) => let val
18317result=MlyValue.AND_tyreadesc_opt__AND_strdesc_opt(fn _ => let val
18318AND_strdesc_opt as AND_strdesc_opt1=AND_strdesc_opt1 ()
18319 in ( ( NONE, AND_strdesc_opt ) ) end
18320)
18321 in (LrTable.NT 130,(result,AND_strdesc_opt1left,AND_strdesc_opt1right
18322),rest671) end
18323| (302,(_,(MlyValue.tyreadesc__AND_strdesc_opt
18324tyreadesc__AND_strdesc_opt1,_,tyreadesc__AND_strdesc_opt1right))::(_,(
18325_,AND1left,_))::rest671) => let val result=
18326MlyValue.AND_tyreadesc_opt__AND_strdesc_opt(fn _ => let val
18327tyreadesc__AND_strdesc_opt as tyreadesc__AND_strdesc_opt1=
18328tyreadesc__AND_strdesc_opt1 ()
18329 in (
18330 ( SOME(#1 tyreadesc__AND_strdesc_opt),
18331 #2 tyreadesc__AND_strdesc_opt )
18332) end
18333)
18334 in (LrTable.NT 130,(result,AND1left,tyreadesc__AND_strdesc_opt1right)
18335,rest671) end
18336| (303,(_,(MlyValue.funbind funbind1,_,funbindright as funbind1right))
18337::(_,(_,FUNCTORleft as FUNCTOR1left,_))::rest671) => let val result=
18338MlyValue.fundec(fn _ => let val funbind as funbind1=funbind1 ()
18339 in ( FunDec(I(FUNCTORleft,funbindright), funbind) ) end
18340)
18341 in (LrTable.NT 131,(result,FUNCTOR1left,funbind1right),rest671) end
18342| (304,(_,(MlyValue.strexp__AND_funbind_opt strexp__AND_funbind_opt1,_
18343,strexp__AND_funbind_optright as strexp__AND_funbind_opt1right))::_::(
18344_,(MlyValue.COLON_sigexp_opt COLON_sigexp_opt1,_,_))::_::(_,(
18345MlyValue.sigexp sigexp1,_,_))::_::(_,(MlyValue.strid strid1,_,_))::_::
18346(_,(MlyValue.funid funid1,funidleft as funid1left,_))::rest671) =>
18347let val result=MlyValue.funbind(fn _ => let val funid as funid1=funid1
18348 ()
18349val strid as strid1=strid1 ()
18350val sigexp as sigexp1=sigexp1 ()
18351val COLON_sigexp_opt as COLON_sigexp_opt1=COLON_sigexp_opt1 ()
18352val strexp__AND_funbind_opt as strexp__AND_funbind_opt1=
18353strexp__AND_funbind_opt1 ()
18354 in (
18355 TRANSFunBind(I(funidleft,
18356 strexp__AND_funbind_optright),
18357 funid, strid, sigexp, COLON_sigexp_opt,
18358 #1 strexp__AND_funbind_opt,
18359 #2 strexp__AND_funbind_opt)
18360) end
18361)
18362 in (LrTable.NT 132,(result,funid1left,strexp__AND_funbind_opt1right),
18363rest671) end
18364| (305,(_,(MlyValue.strexp__AND_funbind_opt strexp__AND_funbind_opt1,_
18365,strexp__AND_funbind_optright as strexp__AND_funbind_opt1right))::_::(
18366_,(MlyValue.sigexp sigexp2,_,_))::_::_::(_,(MlyValue.sigexp sigexp1,_,
18367_))::_::(_,(MlyValue.strid strid1,_,_))::_::(_,(MlyValue.funid funid1,
18368funidleft as funid1left,_))::rest671) => let val result=
18369MlyValue.funbind(fn _ => let val funid as funid1=funid1 ()
18370val strid as strid1=strid1 ()
18371val sigexp1=sigexp1 ()
18372val sigexp2=sigexp2 ()
18373val strexp__AND_funbind_opt as strexp__AND_funbind_opt1=
18374strexp__AND_funbind_opt1 ()
18375 in (
18376 OPAQFunBind(I(funidleft,strexp__AND_funbind_optright),
18377 funid, strid, sigexp1, sigexp2,
18378 #1 strexp__AND_funbind_opt,
18379 #2 strexp__AND_funbind_opt)
18380) end
18381)
18382 in (LrTable.NT 132,(result,funid1left,strexp__AND_funbind_opt1right),
18383rest671) end
18384| (306,(_,(MlyValue.strexp__AND_funbind_opt strexp__AND_funbind_opt1,_
18385,strexp__AND_funbind_optright as strexp__AND_funbind_opt1right))::_::(
18386_,(MlyValue.COLON_sigexp_opt COLON_sigexp_opt1,_,_))::_::(_,(
18387MlyValue.spec spec1,_,_))::_::(_,(MlyValue.funid funid1,funidleft as
18388funid1left,_))::rest671) => let val result=MlyValue.funbind(fn _ =>
18389let val funid as funid1=funid1 ()
18390val spec as spec1=spec1 ()
18391val COLON_sigexp_opt as COLON_sigexp_opt1=COLON_sigexp_opt1 ()
18392val strexp__AND_funbind_opt as strexp__AND_funbind_opt1=
18393strexp__AND_funbind_opt1 ()
18394 in (
18395 TRANSSPECFunBind(I(funidleft,
18396 strexp__AND_funbind_optright),
18397 funid, spec, COLON_sigexp_opt,
18398 #1 strexp__AND_funbind_opt,
18399 #2 strexp__AND_funbind_opt)
18400) end
18401)
18402 in (LrTable.NT 132,(result,funid1left,strexp__AND_funbind_opt1right),
18403rest671) end
18404| (307,(_,(MlyValue.strexp__AND_funbind_opt strexp__AND_funbind_opt1,_
18405,strexp__AND_funbind_optright as strexp__AND_funbind_opt1right))::_::(
18406_,(MlyValue.sigexp sigexp1,_,_))::_::_::(_,(MlyValue.spec spec1,_,_))
18407::_::(_,(MlyValue.funid funid1,funidleft as funid1left,_))::rest671)
18408 => let val result=MlyValue.funbind(fn _ => let val funid as funid1=
18409funid1 ()
18410val spec as spec1=spec1 ()
18411val sigexp as sigexp1=sigexp1 ()
18412val strexp__AND_funbind_opt as strexp__AND_funbind_opt1=
18413strexp__AND_funbind_opt1 ()
18414 in (
18415 OPAQSPECFunBind(I(funidleft,
18416 strexp__AND_funbind_optright),
18417 funid, spec, sigexp,
18418 #1 strexp__AND_funbind_opt,
18419 #2 strexp__AND_funbind_opt)
18420) end
18421)
18422 in (LrTable.NT 132,(result,funid1left,strexp__AND_funbind_opt1right),
18423rest671) end
18424| (308,(_,(MlyValue.funbind funbind1,_,funbind1right))::(_,(_,AND1left
18425,_))::rest671) => let val result=MlyValue.AND_funbind_opt(fn _ => let
18426val funbind as funbind1=funbind1 ()
18427 in ( SOME funbind ) end
18428)
18429 in (LrTable.NT 133,(result,AND1left,funbind1right),rest671) end
18430| (309,rest671) => let val result=MlyValue.AND_funbind_opt(fn _ => (
18431 NONE ))
18432 in (LrTable.NT 133,(result,defaultPos,defaultPos),rest671) end
18433| (310,(_,(MlyValue.AND_funbind_opt AND_funbind_opt1,_,
18434AND_funbind_opt1right))::(_,(MlyValue.strexp' strexp'1,strexp'1left,_)
18435)::rest671) => let val result=MlyValue.strexp__AND_funbind_opt(fn _
18436 => let val strexp' as strexp'1=strexp'1 ()
18437val AND_funbind_opt as AND_funbind_opt1=AND_funbind_opt1 ()
18438 in ( ( strexp', AND_funbind_opt ) ) end
18439)
18440 in (LrTable.NT 134,(result,strexp'1left,AND_funbind_opt1right),
18441rest671) end
18442| (311,(_,(MlyValue.sigexp__AND_funbind_opt sigexp__AND_funbind_opt1,_
18443,sigexp__AND_funbind_optright as sigexp__AND_funbind_opt1right))::_::(
18444_,(MlyValue.strexp strexp1,strexpleft as strexp1left,_))::rest671) =>
18445let val result=MlyValue.strexp__AND_funbind_opt(fn _ => let val strexp
18446 as strexp1=strexp1 ()
18447val sigexp__AND_funbind_opt as sigexp__AND_funbind_opt1=
18448sigexp__AND_funbind_opt1 ()
18449 in (
18450 ( TRANSStrExp(I(strexpleft,
18451 sigexp__AND_funbind_optright),
18452 strexp, #1 sigexp__AND_funbind_opt),
18453 #2 sigexp__AND_funbind_opt )
18454) end
18455)
18456 in (LrTable.NT 134,(result,strexp1left,sigexp__AND_funbind_opt1right)
18457,rest671) end
18458| (312,(_,(MlyValue.sigexp__AND_funbind_opt sigexp__AND_funbind_opt1,_
18459,sigexp__AND_funbind_optright as sigexp__AND_funbind_opt1right))::_::(
18460_,(MlyValue.strexp strexp1,strexpleft as strexp1left,_))::rest671) =>
18461let val result=MlyValue.strexp__AND_funbind_opt(fn _ => let val strexp
18462 as strexp1=strexp1 ()
18463val sigexp__AND_funbind_opt as sigexp__AND_funbind_opt1=
18464sigexp__AND_funbind_opt1 ()
18465 in (
18466 ( OPAQStrExp(I(strexpleft,
18467 sigexp__AND_funbind_optright),
18468 strexp, #1 sigexp__AND_funbind_opt),
18469 #2 sigexp__AND_funbind_opt )
18470) end
18471)
18472 in (LrTable.NT 134,(result,strexp1left,sigexp__AND_funbind_opt1right)
18473,rest671) end
18474| (313,(_,(MlyValue.AND_funbind_opt AND_funbind_opt1,_,
18475AND_funbind_opt1right))::(_,(MlyValue.sigexp' sigexp'1,sigexp'1left,_)
18476)::rest671) => let val result=MlyValue.sigexp__AND_funbind_opt(fn _
18477 => let val sigexp' as sigexp'1=sigexp'1 ()
18478val AND_funbind_opt as AND_funbind_opt1=AND_funbind_opt1 ()
18479 in ( ( sigexp', AND_funbind_opt ) ) end
18480)
18481 in (LrTable.NT 135,(result,sigexp'1left,AND_funbind_opt1right),
18482rest671) end
18483| (314,(_,(MlyValue.tyreadesc__AND_funbind_opt
18484tyreadesc__AND_funbind_opt1,_,tyreadesc__AND_funbind_optright as
18485tyreadesc__AND_funbind_opt1right))::_::(_,(MlyValue.sigexp sigexp1,
18486sigexpleft as sigexp1left,_))::rest671) => let val result=
18487MlyValue.sigexp__AND_funbind_opt(fn _ => let val sigexp as sigexp1=
18488sigexp1 ()
18489val tyreadesc__AND_funbind_opt as tyreadesc__AND_funbind_opt1=
18490tyreadesc__AND_funbind_opt1 ()
18491 in (
18492 ( WHERETYPESigExp(I(sigexpleft,
18493 tyreadesc__AND_funbind_optright),
18494 sigexp,
18495 #1 tyreadesc__AND_funbind_opt),
18496 #2 tyreadesc__AND_funbind_opt )
18497) end
18498)
18499 in (LrTable.NT 135,(result,sigexp1left,
18500tyreadesc__AND_funbind_opt1right),rest671) end
18501| (315,(_,(MlyValue.AND_tyreadesc_opt__AND_funbind_opt
18502AND_tyreadesc_opt__AND_funbind_opt1,_,
18503AND_tyreadesc_opt__AND_funbind_optright as
18504AND_tyreadesc_opt__AND_funbind_opt1right))::(_,(MlyValue.ty ty1,_,_))
18505::_::(_,(MlyValue.longtycon longtycon1,_,_))::(_,(MlyValue.tyvarseq
18506tyvarseq1,_,_))::(_,(_,TYPEleft as TYPE1left,_))::rest671) => let val
18507result=MlyValue.tyreadesc__AND_funbind_opt(fn _ => let val tyvarseq
18508 as tyvarseq1=tyvarseq1 ()
18509val longtycon as longtycon1=longtycon1 ()
18510val ty as ty1=ty1 ()
18511val AND_tyreadesc_opt__AND_funbind_opt as
18512AND_tyreadesc_opt__AND_funbind_opt1=
18513AND_tyreadesc_opt__AND_funbind_opt1 ()
18514 in (
18515 ( TyReaDesc(I(TYPEleft,
18516 AND_tyreadesc_opt__AND_funbind_optright),
18517 tyvarseq, longtycon, ty,
18518 #1 AND_tyreadesc_opt__AND_funbind_opt),
18519 #2 AND_tyreadesc_opt__AND_funbind_opt )
18520) end
18521)
18522 in (LrTable.NT 136,(result,TYPE1left,
18523AND_tyreadesc_opt__AND_funbind_opt1right),rest671) end
18524| (316,(_,(MlyValue.AND_funbind_opt AND_funbind_opt1,
18525AND_funbind_opt1left,AND_funbind_opt1right))::rest671) => let val
18526result=MlyValue.AND_tyreadesc_opt__AND_funbind_opt(fn _ => let val
18527AND_funbind_opt as AND_funbind_opt1=AND_funbind_opt1 ()
18528 in ( ( NONE, AND_funbind_opt ) ) end
18529)
18530 in (LrTable.NT 137,(result,AND_funbind_opt1left,AND_funbind_opt1right
18531),rest671) end
18532| (317,(_,(MlyValue.tyreadesc__AND_funbind_opt
18533tyreadesc__AND_funbind_opt1,_,tyreadesc__AND_funbind_opt1right))::(_,(
18534_,AND1left,_))::rest671) => let val result=
18535MlyValue.AND_tyreadesc_opt__AND_funbind_opt(fn _ => let val
18536tyreadesc__AND_funbind_opt as tyreadesc__AND_funbind_opt1=
18537tyreadesc__AND_funbind_opt1 ()
18538 in (
18539 ( SOME(#1 tyreadesc__AND_funbind_opt),
18540 #2 tyreadesc__AND_funbind_opt )
18541) end
18542)
18543 in (LrTable.NT 137,(result,AND1left,tyreadesc__AND_funbind_opt1right)
18544,rest671) end
18545| (318,(_,(MlyValue.topdec1 topdec11,topdec11left,topdec11right))::
18546rest671) => let val result=MlyValue.topdec(fn _ => let val topdec1 as
18547topdec11=topdec11 ()
18548 in ( topdec1 ) end
18549)
18550 in (LrTable.NT 138,(result,topdec11left,topdec11right),rest671) end
18551| (319,rest671) => let val result=MlyValue.topdec(fn _ => (
18552 STRDECTopDec(I(defaultPos,defaultPos),
18553 EMPTYStrDec(I(defaultPos,defaultPos)),
18554 NONE)
18555))
18556 in (LrTable.NT 138,(result,defaultPos,defaultPos),rest671) end
18557| (320,(_,(MlyValue.topdec_opt topdec_opt1,_,topdec_optright as
18558topdec_opt1right))::(_,(MlyValue.strdec1' strdec1'1,strdec1'left as
18559strdec1'1left,_))::rest671) => let val result=MlyValue.topdec1(fn _
18560 => let val strdec1' as strdec1'1=strdec1'1 ()
18561val topdec_opt as topdec_opt1=topdec_opt1 ()
18562 in (
18563 STRDECTopDec(I(strdec1'left,topdec_optright),
18564 strdec1', topdec_opt)
18565) end
18566)
18567 in (LrTable.NT 139,(result,strdec1'1left,topdec_opt1right),rest671)
18568 end
18569| (321,(_,(MlyValue.topdec_opt topdec_opt1,_,topdec_optright as
18570topdec_opt1right))::(_,(MlyValue.sigdec sigdec1,sigdecleft as
18571sigdec1left,_))::rest671) => let val result=MlyValue.topdec1(fn _ =>
18572let val sigdec as sigdec1=sigdec1 ()
18573val topdec_opt as topdec_opt1=topdec_opt1 ()
18574 in (
18575 SIGDECTopDec(I(sigdecleft,topdec_optright),
18576 sigdec, topdec_opt)
18577) end
18578)
18579 in (LrTable.NT 139,(result,sigdec1left,topdec_opt1right),rest671) end
18580| (322,(_,(MlyValue.topdec_opt topdec_opt1,_,topdec_optright as
18581topdec_opt1right))::(_,(MlyValue.fundec fundec1,fundecleft as
18582fundec1left,_))::rest671) => let val result=MlyValue.topdec1(fn _ =>
18583let val fundec as fundec1=fundec1 ()
18584val topdec_opt as topdec_opt1=topdec_opt1 ()
18585 in (
18586 FUNDECTopDec(I(fundecleft,topdec_optright),
18587 fundec, topdec_opt)
18588) end
18589)
18590 in (LrTable.NT 139,(result,fundec1left,topdec_opt1right),rest671) end
18591| (323,(_,(MlyValue.topdec1 topdec11,topdec11left,topdec11right))::
18592rest671) => let val result=MlyValue.topdec_opt(fn _ => let val topdec1
18593 as topdec11=topdec11 ()
18594 in ( SOME topdec1 ) end
18595)
18596 in (LrTable.NT 140,(result,topdec11left,topdec11right),rest671) end
18597| (324,rest671) => let val result=MlyValue.topdec_opt(fn _ => ( NONE )
18598)
18599 in (LrTable.NT 140,(result,defaultPos,defaultPos),rest671) end
18600| (325,(_,(MlyValue.program' program'1,_,program'1right))::(_,(
18601MlyValue.initInfix initInfix1,initInfix1left,_))::rest671) => let val
18602result=MlyValue.program(fn _ => let val initInfix1=initInfix1 ()
18603val program' as program'1=program'1 ()
18604 in ( (program', !J) ) end
18605)
18606 in (LrTable.NT 141,(result,initInfix1left,program'1right),rest671)
18607 end
18608| (326,(_,(MlyValue.program_opt program_opt1,_,program_opt1right))::(_
18609,(_,_,SEMICOLONright))::(_,(MlyValue.topdec topdec1,topdecleft as
18610topdec1left,_))::rest671) => let val result=MlyValue.program'(fn _ =>
18611let val topdec as topdec1=topdec1 ()
18612val program_opt as program_opt1=program_opt1 ()
18613 in (
18614 TOPDECProgram(I(topdecleft,SEMICOLONright),
18615 topdec, program_opt)
18616) end
18617)
18618 in (LrTable.NT 142,(result,topdec1left,program_opt1right),rest671)
18619 end
18620| (327,(_,(MlyValue.program_opt program_opt1,_,program_opt1right))::(_
18621,(_,_,SEMICOLONright))::(_,(MlyValue.exp exp1,expleft as exp1left,_))
18622::rest671) => let val result=MlyValue.program'(fn _ => let val exp as
18623exp1=exp1 ()
18624val program_opt as program_opt1=program_opt1 ()
18625 in (
18626 EXPProgram(I(expleft,SEMICOLONright),
18627 exp, program_opt) )
18628 end
18629)
18630 in (LrTable.NT 142,(result,exp1left,program_opt1right),rest671) end
18631| (328,(_,(MlyValue.program' program'1,program'1left,program'1right))
18632::rest671) => let val result=MlyValue.program_opt(fn _ => let val
18633program' as program'1=program'1 ()
18634 in ( SOME program' ) end
18635)
18636 in (LrTable.NT 143,(result,program'1left,program'1right),rest671) end
18637| (329,rest671) => let val result=MlyValue.program_opt(fn _ => ( NONE
18638))
18639 in (LrTable.NT 143,(result,defaultPos,defaultPos),rest671) end
18640| _ => raise (mlyAction i392)
18641end
18642val void = MlyValue.VOID
18643val extract = fn a => (fn MlyValue.program x => x
18644| _ => let exception ParseInternal
18645 in raise ParseInternal end) a ()
18646end
18647end
18648structure Tokens : Parser_TOKENS =
18649struct
18650type svalue = ParserData.svalue
18651type ('a,'b) token = ('a,'b) Token.token
18652fun EOF (p1,p2) = Token.TOKEN (ParserData.LrTable.T 0,(
18653ParserData.MlyValue.VOID,p1,p2))
18654fun ABSTYPE (p1,p2) = Token.TOKEN (ParserData.LrTable.T 1,(
18655ParserData.MlyValue.VOID,p1,p2))
18656fun AND (p1,p2) = Token.TOKEN (ParserData.LrTable.T 2,(
18657ParserData.MlyValue.VOID,p1,p2))
18658fun ANDALSO (p1,p2) = Token.TOKEN (ParserData.LrTable.T 3,(
18659ParserData.MlyValue.VOID,p1,p2))
18660fun AS (p1,p2) = Token.TOKEN (ParserData.LrTable.T 4,(
18661ParserData.MlyValue.VOID,p1,p2))
18662fun CASE (p1,p2) = Token.TOKEN (ParserData.LrTable.T 5,(
18663ParserData.MlyValue.VOID,p1,p2))
18664fun DO (p1,p2) = Token.TOKEN (ParserData.LrTable.T 6,(
18665ParserData.MlyValue.VOID,p1,p2))
18666fun DATATYPE (p1,p2) = Token.TOKEN (ParserData.LrTable.T 7,(
18667ParserData.MlyValue.VOID,p1,p2))
18668fun ELSE (p1,p2) = Token.TOKEN (ParserData.LrTable.T 8,(
18669ParserData.MlyValue.VOID,p1,p2))
18670fun END (p1,p2) = Token.TOKEN (ParserData.LrTable.T 9,(
18671ParserData.MlyValue.VOID,p1,p2))
18672fun EXCEPTION (p1,p2) = Token.TOKEN (ParserData.LrTable.T 10,(
18673ParserData.MlyValue.VOID,p1,p2))
18674fun FN (p1,p2) = Token.TOKEN (ParserData.LrTable.T 11,(
18675ParserData.MlyValue.VOID,p1,p2))
18676fun FUN (p1,p2) = Token.TOKEN (ParserData.LrTable.T 12,(
18677ParserData.MlyValue.VOID,p1,p2))
18678fun HANDLE (p1,p2) = Token.TOKEN (ParserData.LrTable.T 13,(
18679ParserData.MlyValue.VOID,p1,p2))
18680fun IF (p1,p2) = Token.TOKEN (ParserData.LrTable.T 14,(
18681ParserData.MlyValue.VOID,p1,p2))
18682fun IN (p1,p2) = Token.TOKEN (ParserData.LrTable.T 15,(
18683ParserData.MlyValue.VOID,p1,p2))
18684fun INFIX (p1,p2) = Token.TOKEN (ParserData.LrTable.T 16,(
18685ParserData.MlyValue.VOID,p1,p2))
18686fun INFIXR (p1,p2) = Token.TOKEN (ParserData.LrTable.T 17,(
18687ParserData.MlyValue.VOID,p1,p2))
18688fun LET (p1,p2) = Token.TOKEN (ParserData.LrTable.T 18,(
18689ParserData.MlyValue.VOID,p1,p2))
18690fun LOCAL (p1,p2) = Token.TOKEN (ParserData.LrTable.T 19,(
18691ParserData.MlyValue.VOID,p1,p2))
18692fun NONFIX (p1,p2) = Token.TOKEN (ParserData.LrTable.T 20,(
18693ParserData.MlyValue.VOID,p1,p2))
18694fun OF (p1,p2) = Token.TOKEN (ParserData.LrTable.T 21,(
18695ParserData.MlyValue.VOID,p1,p2))
18696fun OP (p1,p2) = Token.TOKEN (ParserData.LrTable.T 22,(
18697ParserData.MlyValue.VOID,p1,p2))
18698fun OPEN (p1,p2) = Token.TOKEN (ParserData.LrTable.T 23,(
18699ParserData.MlyValue.VOID,p1,p2))
18700fun ORELSE (p1,p2) = Token.TOKEN (ParserData.LrTable.T 24,(
18701ParserData.MlyValue.VOID,p1,p2))
18702fun RAISE (p1,p2) = Token.TOKEN (ParserData.LrTable.T 25,(
18703ParserData.MlyValue.VOID,p1,p2))
18704fun REC (p1,p2) = Token.TOKEN (ParserData.LrTable.T 26,(
18705ParserData.MlyValue.VOID,p1,p2))
18706fun THEN (p1,p2) = Token.TOKEN (ParserData.LrTable.T 27,(
18707ParserData.MlyValue.VOID,p1,p2))
18708fun TYPE (p1,p2) = Token.TOKEN (ParserData.LrTable.T 28,(
18709ParserData.MlyValue.VOID,p1,p2))
18710fun VAL (p1,p2) = Token.TOKEN (ParserData.LrTable.T 29,(
18711ParserData.MlyValue.VOID,p1,p2))
18712fun WITH (p1,p2) = Token.TOKEN (ParserData.LrTable.T 30,(
18713ParserData.MlyValue.VOID,p1,p2))
18714fun WITHTYPE (p1,p2) = Token.TOKEN (ParserData.LrTable.T 31,(
18715ParserData.MlyValue.VOID,p1,p2))
18716fun WHILE (p1,p2) = Token.TOKEN (ParserData.LrTable.T 32,(
18717ParserData.MlyValue.VOID,p1,p2))
18718fun LPAR (p1,p2) = Token.TOKEN (ParserData.LrTable.T 33,(
18719ParserData.MlyValue.VOID,p1,p2))
18720fun RPAR (p1,p2) = Token.TOKEN (ParserData.LrTable.T 34,(
18721ParserData.MlyValue.VOID,p1,p2))
18722fun LBRACK (p1,p2) = Token.TOKEN (ParserData.LrTable.T 35,(
18723ParserData.MlyValue.VOID,p1,p2))
18724fun RBRACK (p1,p2) = Token.TOKEN (ParserData.LrTable.T 36,(
18725ParserData.MlyValue.VOID,p1,p2))
18726fun LBRACE (p1,p2) = Token.TOKEN (ParserData.LrTable.T 37,(
18727ParserData.MlyValue.VOID,p1,p2))
18728fun RBRACE (p1,p2) = Token.TOKEN (ParserData.LrTable.T 38,(
18729ParserData.MlyValue.VOID,p1,p2))
18730fun COMMA (p1,p2) = Token.TOKEN (ParserData.LrTable.T 39,(
18731ParserData.MlyValue.VOID,p1,p2))
18732fun COLON (p1,p2) = Token.TOKEN (ParserData.LrTable.T 40,(
18733ParserData.MlyValue.VOID,p1,p2))
18734fun SEMICOLON (p1,p2) = Token.TOKEN (ParserData.LrTable.T 41,(
18735ParserData.MlyValue.VOID,p1,p2))
18736fun DOTS (p1,p2) = Token.TOKEN (ParserData.LrTable.T 42,(
18737ParserData.MlyValue.VOID,p1,p2))
18738fun UNDERBAR (p1,p2) = Token.TOKEN (ParserData.LrTable.T 43,(
18739ParserData.MlyValue.VOID,p1,p2))
18740fun BAR (p1,p2) = Token.TOKEN (ParserData.LrTable.T 44,(
18741ParserData.MlyValue.VOID,p1,p2))
18742fun EQUALS (p1,p2) = Token.TOKEN (ParserData.LrTable.T 45,(
18743ParserData.MlyValue.VOID,p1,p2))
18744fun DARROW (p1,p2) = Token.TOKEN (ParserData.LrTable.T 46,(
18745ParserData.MlyValue.VOID,p1,p2))
18746fun ARROW (p1,p2) = Token.TOKEN (ParserData.LrTable.T 47,(
18747ParserData.MlyValue.VOID,p1,p2))
18748fun HASH (p1,p2) = Token.TOKEN (ParserData.LrTable.T 48,(
18749ParserData.MlyValue.VOID,p1,p2))
18750fun EQTYPE (p1,p2) = Token.TOKEN (ParserData.LrTable.T 49,(
18751ParserData.MlyValue.VOID,p1,p2))
18752fun FUNCTOR (p1,p2) = Token.TOKEN (ParserData.LrTable.T 50,(
18753ParserData.MlyValue.VOID,p1,p2))
18754fun INCLUDE (p1,p2) = Token.TOKEN (ParserData.LrTable.T 51,(
18755ParserData.MlyValue.VOID,p1,p2))
18756fun SHARING (p1,p2) = Token.TOKEN (ParserData.LrTable.T 52,(
18757ParserData.MlyValue.VOID,p1,p2))
18758fun SIG (p1,p2) = Token.TOKEN (ParserData.LrTable.T 53,(
18759ParserData.MlyValue.VOID,p1,p2))
18760fun SIGNATURE (p1,p2) = Token.TOKEN (ParserData.LrTable.T 54,(
18761ParserData.MlyValue.VOID,p1,p2))
18762fun STRUCT (p1,p2) = Token.TOKEN (ParserData.LrTable.T 55,(
18763ParserData.MlyValue.VOID,p1,p2))
18764fun STRUCTURE (p1,p2) = Token.TOKEN (ParserData.LrTable.T 56,(
18765ParserData.MlyValue.VOID,p1,p2))
18766fun WHERE (p1,p2) = Token.TOKEN (ParserData.LrTable.T 57,(
18767ParserData.MlyValue.VOID,p1,p2))
18768fun COLONGREATER (p1,p2) = Token.TOKEN (ParserData.LrTable.T 58,(
18769ParserData.MlyValue.VOID,p1,p2))
18770fun ZERO (p1,p2) = Token.TOKEN (ParserData.LrTable.T 59,(
18771ParserData.MlyValue.VOID,p1,p2))
18772fun DIGIT (i,p1,p2) = Token.TOKEN (ParserData.LrTable.T 60,(
18773ParserData.MlyValue.DIGIT (fn () => i),p1,p2))
18774fun NUMERIC (i,p1,p2) = Token.TOKEN (ParserData.LrTable.T 61,(
18775ParserData.MlyValue.NUMERIC (fn () => i),p1,p2))
18776fun INT (i,p1,p2) = Token.TOKEN (ParserData.LrTable.T 62,(
18777ParserData.MlyValue.INT (fn () => i),p1,p2))
18778fun WORD (i,p1,p2) = Token.TOKEN (ParserData.LrTable.T 63,(
18779ParserData.MlyValue.WORD (fn () => i),p1,p2))
18780fun REAL (i,p1,p2) = Token.TOKEN (ParserData.LrTable.T 64,(
18781ParserData.MlyValue.REAL (fn () => i),p1,p2))
18782fun STRING (i,p1,p2) = Token.TOKEN (ParserData.LrTable.T 65,(
18783ParserData.MlyValue.STRING (fn () => i),p1,p2))
18784fun CHAR (i,p1,p2) = Token.TOKEN (ParserData.LrTable.T 66,(
18785ParserData.MlyValue.CHAR (fn () => i),p1,p2))
18786fun ALPHA (i,p1,p2) = Token.TOKEN (ParserData.LrTable.T 67,(
18787ParserData.MlyValue.ALPHA (fn () => i),p1,p2))
18788fun SYMBOL (i,p1,p2) = Token.TOKEN (ParserData.LrTable.T 68,(
18789ParserData.MlyValue.SYMBOL (fn () => i),p1,p2))
18790fun STAR (p1,p2) = Token.TOKEN (ParserData.LrTable.T 69,(
18791ParserData.MlyValue.VOID,p1,p2))
18792fun TYVAR (i,p1,p2) = Token.TOKEN (ParserData.LrTable.T 70,(
18793ParserData.MlyValue.TYVAR (fn () => i),p1,p2))
18794fun ETYVAR (i,p1,p2) = Token.TOKEN (ParserData.LrTable.T 71,(
18795ParserData.MlyValue.ETYVAR (fn () => i),p1,p2))
18796fun LONGID (i,p1,p2) = Token.TOKEN (ParserData.LrTable.T 72,(
18797ParserData.MlyValue.LONGID (fn () => i),p1,p2))
18798end
18799end
18800(* stop of Parser.grm.sml *)
18801(* start of Lexer.lex.sml *)
18802type int = Int.int
18803 functor LexerFn(structure Tokens: Parser_TOKENS) =
18804 struct
18805 structure UserDeclarations =
18806 struct
18807(*
18808 * Standard ML lexical analysis
18809 *
18810 * Definition, sections 2.1-2.5, 3.1
18811 *
18812 * Notes:
18813 * Since all lexical classes must be disjoint:
18814 * - There is no single class ID, use ALPHA|SYMBOL|STAR|EQUALS.
18815 * - There is no class LAB, use ALPHA|SYMBOL|NUMERIC|DIGIT|STAR.
18816 * - ID does not contain `=' and `*', those are EQUALS and STAR.
18817 * - LONGID does not contain unqualified ids (but allows for `=' and `*').
18818 * - INT does not contain positive decimal integers without leading 0,
18819 * and single DIGIT integers, those are in NUMERIC, DIGIT, and ZERO.
18820 * - NUMERIC does not contain single digit numbers, those are in DIGIT.
18821 * - DIGIT does not contain 0, that is ZERO.
18822 *
18823 * The parser uses a global variable to recognise nested comments, so it is
18824 * not reentrant.
18825 *)
18826
18827
18828 open Tokens
18829
18830
18831 (* Types to match structure LEXER.UserDeclaration *)
18832
18833 type ('a,'b) token = ('a,'b) Tokens.token
18834 type pos = int
18835 type svalue = Tokens.svalue
18836 type lexresult = (svalue, pos) token
18837
18838
18839
18840 (* Handling nested comments *)
18841
18842 val nesting = ref 0 (* non-reentrant side-effect way :-P *)
18843
18844
18845 fun eof() =
18846 if !nesting = 0 then
18847 Tokens.EOF(0, 0)
18848 else
18849 Error.error((0,0), "unclosed comment")
18850
18851
18852
18853 (* Some helpers to create tokens *)
18854
18855 open Tokens
18856
18857
18858 fun toLRPos(yypos, yytext) =
18859 let
18860 val yypos = yypos - 2 (* bug in ML-Lex... *)
18861 in
18862 (yypos, yypos + String.size yytext)
18863 end
18864
18865 fun token(TOKEN, yypos, yytext) =
18866 TOKEN(toLRPos(yypos, yytext))
18867
18868 fun tokenOf(TOKEN, toVal, yypos, yytext) =
18869 let
18870 val i as (l,r) = toLRPos(yypos, yytext)
18871 in
18872 TOKEN(toVal(yytext, i), l, r)
18873 end
18874
18875 fun error(yypos, yytext, s) =
18876 Error.error(toLRPos(yypos,yytext), s)
18877
18878 fun invalid(yypos, yytext) =
18879 let
18880 val s = "invalid character `" ^ String.toCString yytext ^ "'"
18881 in
18882 error(yypos, yytext, s)
18883 end
18884
18885
18886
18887 (* Convert identifiers *)
18888
18889 fun toId(s, i) = s
18890
18891 fun toLongId(s, i) =
18892 let
18893 fun split [] = raise Fail "Lexer.toLongId: empty longid"
18894 | split [x] = ([],x)
18895 | split(x::xs) = let val (ys,y) = split xs in (x::ys,y) end
18896 in
18897 split(String.fields (fn c => c = #".") s)
18898 end
18899
18900
18901 (* Convert constants [Section 2.2] *)
18902
18903 local open StringCvt in
18904
18905 fun toInt(s,i) =
18906 (case String.explode s
18907 of #"0" :: #"x" :: s' =>
18908 valOf(scanString (Int.scan HEX) (String.implode s'))
18909 | #"~" :: #"0" :: #"x" :: s' =>
18910 ~(valOf(scanString (Int.scan HEX) (String.implode s')))
18911 | _ => valOf(scanString (Int.scan DEC) s)
18912 ) handle Overflow =>
18913 Error.error(i, "integer constant too big")
18914
18915 fun toWord(s,i) =
18916 (case String.explode s
18917 of #"0" :: #"w" :: #"x" :: s' =>
18918 valOf(scanString (Word.scan HEX) (String.implode s'))
18919 | #"0" :: #"w" :: s' =>
18920 valOf(scanString (Word.scan DEC) (String.implode s'))
18921 | _ => raise Fail "Lexer.toWord: invalid word constant"
18922 ) handle Overflow =>
18923 Error.error(i, "word constant too big")
18924
18925 fun toReal(s,i) = valOf(scanString Real.scan s)
18926
18927
18928 fun toString(s,i) =
18929 let
18930 fun convert(#"\\"::s, cs) = escape(s, cs)
18931 | convert([#"\""], cs) = cs
18932 | convert(c::s, cs) = convert(s, c::cs)
18933 | convert([], cs) =
18934 raise Fail "Lexer.toString: unclosed string literal"
18935
18936 and escape(#"a"::s, cs) = convert(s, #"\a"::cs)
18937 | escape(#"b"::s, cs) = convert(s, #"\b"::cs)
18938 | escape(#"t"::s, cs) = convert(s, #"\t"::cs)
18939 | escape(#"n"::s, cs) = convert(s, #"\n"::cs)
18940 | escape(#"v"::s, cs) = convert(s, #"\v"::cs)
18941 | escape(#"f"::s, cs) = convert(s, #"\f"::cs)
18942 | escape(#"r"::s, cs) = convert(s, #"\r"::cs)
18943 | escape(#"\""::s, cs) = convert(s, #"\""::cs)
18944 | escape(#"\\"::s, cs) = convert(s, #"\\"::cs)
18945 | escape(#"^"::c::s, cs) =
18946 convert(s, Char.chr(Char.ord c - 64)::cs)
18947
18948 | escape(#"u"::x1::x2::x3::x4::s, cs) =
18949 convert(s, unicode[x1,x2,x3,x4]::cs)
18950
18951 | escape(c::s, cs) =
18952 if Char.isDigit c then
18953 case s
18954 of c2::c3::s => convert(s, ascii[c,c2,c3]::cs)
18955 | _ => raise Fail
18956 "Lexer.toString: invalid ASCII escape sequence"
18957 else if Char.isSpace c then
18958 escapeGap(s,cs)
18959 else
18960 raise Fail "Lexer.toString: invalid escape sequence"
18961
18962 | escape([], cs) =
18963 raise Fail "Lexer.toString: empty escape character"
18964
18965 and escapeGap(c::s, cs) =
18966 if Char.isSpace c then
18967 escapeGap(s, cs)
18968 else (* c = #"\\" *)
18969 convert(s, cs)
18970
18971 | escapeGap([], cs) =
18972 raise Fail "Lexer.toString: invalid string gap"
18973
18974 and ascii s =
18975 Char.chr(valOf(scanString (Int.scan DEC) (String.implode s)))
18976 handle Chr =>
18977 Error.error(i, "ASCII escape character too big")
18978 | Overflow =>
18979 Error.error(i, "ASCII escape character too big")
18980
18981 and unicode s =
18982 Char.chr(valOf(scanString (Int.scan HEX) (String.implode s)))
18983 handle Chr =>
18984 Error.error(i, "unicode escape character too big")
18985 | Overflow =>
18986 Error.error(i, "unicode escape character too big")
18987
18988 val cs = List.tl(String.explode s)
18989 in
18990 String.implode(List.rev(convert(cs, [])))
18991 end
18992
18993
18994 fun toChar(s,i) =
18995 let
18996 val s' = String.substring(s, 1, String.size s-1)
18997 val ss' = toString(s',i)
18998 in
18999 if String.size ss' = 1 then
19000 String.sub(ss',0)
19001 else if ss' = "" then
19002 Error.error(i, "empty character constant")
19003 else
19004 Error.error(i, "character constant too long")
19005 end
19006
19007 end (* local *)
19008
19009
19010end (* end of user routines *)
19011exception LexError (* raised if illegal leaf action tried *)
19012structure Internal =
19013 struct
19014
19015datatype yyfinstate = N of int
19016type statedata = {fin : yyfinstate list, trans: string}
19017(* transition & final state table *)
19018val tab = let
19019val s = [
19020 (0,
19021"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19022\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19023\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19024\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19025\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19026\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19027\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19028\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19029\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19030\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19031\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19032\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19033\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19034\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19035\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19036\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
19037),
19038 (1,
19039"\005\005\005\005\005\005\005\005\005\235\236\235\235\235\005\005\
19040\\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005\
19041\\235\180\223\211\180\180\180\209\207\206\205\180\204\202\199\180\
19042\\191\189\189\189\189\189\189\189\189\189\187\186\180\184\180\180\
19043\\180\025\025\025\025\025\025\025\025\025\025\025\025\025\025\025\
19044\\025\025\025\025\025\025\025\025\025\025\025\183\180\182\180\181\
19045\\180\166\025\162\153\134\126\025\120\108\025\025\101\025\095\085\
19046\\025\025\078\055\048\025\045\030\025\025\025\024\023\022\006\005\
19047\\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005\
19048\\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005\
19049\\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005\
19050\\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005\
19051\\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005\
19052\\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005\
19053\\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005\
19054\\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005\005"
19055),
19056 (3,
19057"\237\237\237\237\237\237\237\237\237\237\242\237\237\237\237\237\
19058\\237\237\237\237\237\237\237\237\237\237\237\237\237\237\237\237\
19059\\237\237\237\237\237\237\237\237\240\237\238\237\237\237\237\237\
19060\\237\237\237\237\237\237\237\237\237\237\237\237\237\237\237\237\
19061\\237\237\237\237\237\237\237\237\237\237\237\237\237\237\237\237\
19062\\237\237\237\237\237\237\237\237\237\237\237\237\237\237\237\237\
19063\\237\237\237\237\237\237\237\237\237\237\237\237\237\237\237\237\
19064\\237\237\237\237\237\237\237\237\237\237\237\237\237\237\237\237\
19065\\237\237\237\237\237\237\237\237\237\237\237\237\237\237\237\237\
19066\\237\237\237\237\237\237\237\237\237\237\237\237\237\237\237\237\
19067\\237\237\237\237\237\237\237\237\237\237\237\237\237\237\237\237\
19068\\237\237\237\237\237\237\237\237\237\237\237\237\237\237\237\237\
19069\\237\237\237\237\237\237\237\237\237\237\237\237\237\237\237\237\
19070\\237\237\237\237\237\237\237\237\237\237\237\237\237\237\237\237\
19071\\237\237\237\237\237\237\237\237\237\237\237\237\237\237\237\237\
19072\\237\237\237\237\237\237\237\237\237\237\237\237\237\237\237\237"
19073),
19074 (6,
19075"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19076\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19077\\000\007\000\007\007\007\007\000\000\000\007\007\000\007\000\007\
19078\\019\008\008\008\008\008\008\008\008\008\007\000\007\007\007\007\
19079\\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19080\\000\000\000\000\000\000\000\000\000\000\000\000\007\000\007\000\
19081\\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19082\\000\000\000\000\000\000\000\000\000\000\000\000\007\000\007\000\
19083\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19084\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19085\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19086\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19087\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19088\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19089\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19090\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
19091),
19092 (7,
19093"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19094\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19095\\000\007\000\007\007\007\007\000\000\000\007\007\000\007\000\007\
19096\\000\000\000\000\000\000\000\000\000\000\007\000\007\007\007\007\
19097\\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19098\\000\000\000\000\000\000\000\000\000\000\000\000\007\000\007\000\
19099\\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19100\\000\000\000\000\000\000\000\000\000\000\000\000\007\000\007\000\
19101\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19102\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19103\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19104\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19105\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19106\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19107\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19108\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
19109),
19110 (8,
19111"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19112\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19113\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\013\000\
19114\\008\008\008\008\008\008\008\008\008\008\000\000\000\000\000\000\
19115\\000\000\000\000\000\009\000\000\000\000\000\000\000\000\000\000\
19116\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19117\\000\000\000\000\000\009\000\000\000\000\000\000\000\000\000\000\
19118\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19119\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19120\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19121\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19122\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19123\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19124\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19125\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19126\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
19127),
19128 (9,
19129"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19130\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19131\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19132\\012\012\012\012\012\012\012\012\012\012\000\000\000\000\000\000\
19133\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19134\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19135\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19136\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\010\000\
19137\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19138\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19139\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19140\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19141\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19142\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19143\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19144\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
19145),
19146 (10,
19147"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19148\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19149\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19150\\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\000\
19151\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19152\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19153\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19154\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19155\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19156\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19157\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19158\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19159\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19160\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19161\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19162\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
19163),
19164 (12,
19165"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19166\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19167\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19168\\012\012\012\012\012\012\012\012\012\012\000\000\000\000\000\000\
19169\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19170\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19171\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19172\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19173\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19174\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19175\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19176\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19177\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19178\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19179\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19180\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
19181),
19182 (13,
19183"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19184\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19185\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19186\\014\014\014\014\014\014\014\014\014\014\000\000\000\000\000\000\
19187\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19188\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19189\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19190\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19191\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19192\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19193\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19194\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19195\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19196\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19197\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19198\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
19199),
19200 (14,
19201"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19202\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19203\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19204\\014\014\014\014\014\014\014\014\014\014\000\000\000\000\000\000\
19205\\000\000\000\000\000\015\000\000\000\000\000\000\000\000\000\000\
19206\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19207\\000\000\000\000\000\015\000\000\000\000\000\000\000\000\000\000\
19208\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19209\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19210\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19211\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19212\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19213\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19214\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19215\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19216\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
19217),
19218 (15,
19219"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19220\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19221\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19222\\018\018\018\018\018\018\018\018\018\018\000\000\000\000\000\000\
19223\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19224\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19225\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19226\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\016\000\
19227\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19228\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19229\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19230\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19231\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19232\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19233\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19234\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
19235),
19236 (16,
19237"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19238\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19239\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19240\\017\017\017\017\017\017\017\017\017\017\000\000\000\000\000\000\
19241\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19242\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19243\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19244\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19245\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19246\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19247\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19248\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19249\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19250\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19251\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19252\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
19253),
19254 (18,
19255"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19256\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19257\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19258\\018\018\018\018\018\018\018\018\018\018\000\000\000\000\000\000\
19259\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19260\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19261\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19262\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19263\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19264\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19265\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19266\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19267\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19268\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19269\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19270\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
19271),
19272 (19,
19273"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19274\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19275\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\013\000\
19276\\008\008\008\008\008\008\008\008\008\008\000\000\000\000\000\000\
19277\\000\000\000\000\000\009\000\000\000\000\000\000\000\000\000\000\
19278\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19279\\000\000\000\000\000\009\000\000\000\000\000\000\000\000\000\000\
19280\\000\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\
19281\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19282\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19283\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19284\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19285\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19286\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19287\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19288\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
19289),
19290 (20,
19291"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19292\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19293\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19294\\021\021\021\021\021\021\021\021\021\021\000\000\000\000\000\000\
19295\\000\021\021\021\021\021\021\000\000\000\000\000\000\000\000\000\
19296\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19297\\000\021\021\021\021\021\021\000\000\000\000\000\000\000\000\000\
19298\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19299\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19300\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19301\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19302\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19303\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19304\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19305\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19306\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
19307),
19308 (25,
19309"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19310\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19311\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
19312\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
19313\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
19314\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
19315\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
19316\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
19317\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19318\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19319\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19320\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19321\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19322\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19323\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19324\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
19325),
19326 (27,
19327"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19328\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19329\\000\028\000\028\028\028\028\000\000\000\028\028\000\028\000\028\
19330\\000\000\000\000\000\000\000\000\000\000\028\000\028\028\028\028\
19331\\028\029\029\029\029\029\029\029\029\029\029\029\029\029\029\029\
19332\\029\029\029\029\029\029\029\029\029\029\029\000\028\000\028\000\
19333\\028\029\029\029\029\029\029\029\029\029\029\029\029\029\029\029\
19334\\029\029\029\029\029\029\029\029\029\029\029\000\028\000\028\000\
19335\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19336\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19337\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19338\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19339\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19340\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19341\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19342\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
19343),
19344 (28,
19345"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19346\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19347\\000\028\000\028\028\028\028\000\000\000\028\028\000\028\000\028\
19348\\000\000\000\000\000\000\000\000\000\000\028\000\028\028\028\028\
19349\\028\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19350\\000\000\000\000\000\000\000\000\000\000\000\000\028\000\028\000\
19351\\028\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19352\\000\000\000\000\000\000\000\000\000\000\000\000\028\000\028\000\
19353\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19354\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19355\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19356\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19357\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19358\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19359\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19360\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
19361),
19362 (29,
19363"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19364\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19365\\000\000\000\000\000\000\000\029\000\000\000\000\000\000\027\000\
19366\\029\029\029\029\029\029\029\029\029\029\000\000\000\000\000\000\
19367\\000\029\029\029\029\029\029\029\029\029\029\029\029\029\029\029\
19368\\029\029\029\029\029\029\029\029\029\029\029\000\000\000\000\029\
19369\\000\029\029\029\029\029\029\029\029\029\029\029\029\029\029\029\
19370\\029\029\029\029\029\029\029\029\029\029\029\000\000\000\000\000\
19371\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19372\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19373\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19374\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19375\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19376\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19377\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19378\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
19379),
19380 (30,
19381"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19382\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19383\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
19384\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
19385\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
19386\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
19387\\000\026\026\026\026\026\026\026\038\031\026\026\026\026\026\026\
19388\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
19389\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19390\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19391\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19392\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19393\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19394\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19395\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19396\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
19397),
19398 (31,
19399"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19400\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19401\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
19402\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
19403\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
19404\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
19405\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
19406\\026\026\026\026\032\026\026\026\026\026\026\000\000\000\000\000\
19407\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19408\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19409\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19410\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19411\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19412\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19413\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19414\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
19415),
19416 (32,
19417"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19418\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19419\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
19420\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
19421\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
19422\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
19423\\000\026\026\026\026\026\026\026\033\026\026\026\026\026\026\026\
19424\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
19425\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19426\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19427\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19428\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19429\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19430\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19431\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19432\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
19433),
19434 (33,
19435"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19436\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19437\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
19438\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
19439\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
19440\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
19441\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
19442\\026\026\026\026\034\026\026\026\026\026\026\000\000\000\000\000\
19443\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19444\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19445\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19446\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19447\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19448\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19449\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19450\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
19451),
19452 (34,
19453"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19454\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19455\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
19456\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
19457\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
19458\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
19459\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
19460\\026\026\026\026\026\026\026\026\026\035\026\000\000\000\000\000\
19461\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19462\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19463\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19464\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19465\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19466\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19467\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19468\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
19469),
19470 (35,
19471"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19472\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19473\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
19474\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
19475\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
19476\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
19477\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
19478\\036\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
19479\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19480\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19481\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19482\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19483\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19484\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19485\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19486\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
19487),
19488 (36,
19489"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19490\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19491\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
19492\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
19493\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
19494\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
19495\\000\026\026\026\026\037\026\026\026\026\026\026\026\026\026\026\
19496\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
19497\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19498\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19499\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19500\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19501\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19502\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19503\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19504\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
19505),
19506 (38,
19507"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19508\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19509\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
19510\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
19511\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
19512\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
19513\\000\026\026\026\026\042\026\026\026\039\026\026\026\026\026\026\
19514\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
19515\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19516\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19517\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19518\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19519\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19520\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19521\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19522\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
19523),
19524 (39,
19525"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19526\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19527\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
19528\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
19529\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
19530\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
19531\\000\026\026\026\026\026\026\026\026\026\026\026\040\026\026\026\
19532\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
19533\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19534\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19535\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19536\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19537\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19538\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19539\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19540\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
19541),
19542 (40,
19543"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19544\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19545\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
19546\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
19547\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
19548\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
19549\\000\026\026\026\026\041\026\026\026\026\026\026\026\026\026\026\
19550\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
19551\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19552\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19553\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19554\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19555\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19556\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19557\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19558\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
19559),
19560 (42,
19561"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19562\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19563\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
19564\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
19565\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
19566\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
19567\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
19568\\026\026\043\026\026\026\026\026\026\026\026\000\000\000\000\000\
19569\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19570\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19571\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19572\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19573\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19574\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19575\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19576\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
19577),
19578 (43,
19579"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19580\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19581\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
19582\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
19583\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
19584\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
19585\\000\026\026\026\026\044\026\026\026\026\026\026\026\026\026\026\
19586\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
19587\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19588\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19589\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19590\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19591\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19592\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19593\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19594\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
19595),
19596 (45,
19597"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19598\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19599\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
19600\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
19601\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
19602\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
19603\\000\046\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
19604\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
19605\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19606\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19607\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19608\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19609\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19610\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19611\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19612\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
19613),
19614 (46,
19615"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19616\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19617\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
19618\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
19619\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
19620\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
19621\\000\026\026\026\026\026\026\026\026\026\026\026\047\026\026\026\
19622\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
19623\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19624\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19625\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19626\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19627\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19628\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19629\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19630\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
19631),
19632 (48,
19633"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19634\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19635\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
19636\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
19637\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
19638\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
19639\\000\026\026\026\026\026\026\026\052\026\026\026\026\026\026\026\
19640\\026\026\026\026\026\026\026\026\026\049\026\000\000\000\000\000\
19641\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19642\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19643\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19644\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19645\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19646\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19647\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19648\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
19649),
19650 (49,
19651"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19652\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19653\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
19654\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
19655\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
19656\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
19657\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
19658\\050\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
19659\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19660\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19661\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19662\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19663\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19664\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19665\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19666\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
19667),
19668 (50,
19669"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19670\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19671\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
19672\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
19673\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
19674\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
19675\\000\026\026\026\026\051\026\026\026\026\026\026\026\026\026\026\
19676\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
19677\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19678\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19679\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19680\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19681\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19682\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19683\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19684\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
19685),
19686 (52,
19687"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19688\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19689\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
19690\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
19691\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
19692\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
19693\\000\026\026\026\026\053\026\026\026\026\026\026\026\026\026\026\
19694\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
19695\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19696\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19697\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19698\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19699\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19700\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19701\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19702\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
19703),
19704 (53,
19705"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19706\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19707\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
19708\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
19709\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
19710\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
19711\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\054\026\
19712\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
19713\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19714\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19715\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19716\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19717\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19718\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19719\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19720\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
19721),
19722 (55,
19723"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19724\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19725\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
19726\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
19727\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
19728\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
19729\\000\026\026\026\026\026\026\026\072\064\026\026\026\026\026\026\
19730\\026\026\026\026\056\026\026\026\026\026\026\000\000\000\000\000\
19731\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19732\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19733\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19734\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19735\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19736\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19737\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19738\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
19739),
19740 (56,
19741"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19742\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19743\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
19744\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
19745\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
19746\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
19747\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
19748\\026\026\057\026\026\026\026\026\026\026\026\000\000\000\000\000\
19749\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19750\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19751\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19752\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19753\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19754\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19755\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19756\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
19757),
19758 (57,
19759"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19760\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19761\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
19762\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
19763\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
19764\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
19765\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
19766\\026\026\026\026\026\058\026\026\026\026\026\000\000\000\000\000\
19767\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19768\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19769\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19770\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19771\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19772\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19773\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19774\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
19775),
19776 (58,
19777"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19778\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19779\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
19780\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
19781\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
19782\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
19783\\000\026\026\059\026\026\026\026\026\026\026\026\026\026\026\026\
19784\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
19785\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19786\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19787\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19788\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19789\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19790\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19791\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19792\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
19793),
19794 (59,
19795"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19796\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19797\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
19798\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
19799\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
19800\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
19801\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
19802\\026\026\026\026\060\026\026\026\026\026\026\000\000\000\000\000\
19803\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19804\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19805\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19806\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19807\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19808\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19809\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19810\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
19811),
19812 (60,
19813"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19814\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19815\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
19816\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
19817\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
19818\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
19819\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
19820\\026\026\026\026\026\061\026\026\026\026\026\000\000\000\000\000\
19821\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19822\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19823\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19824\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19825\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19826\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19827\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19828\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
19829),
19830 (61,
19831"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19832\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19833\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
19834\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
19835\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
19836\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
19837\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
19838\\026\026\062\026\026\026\026\026\026\026\026\000\000\000\000\000\
19839\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19840\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19841\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19842\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19843\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19844\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19845\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19846\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
19847),
19848 (62,
19849"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19850\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19851\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
19852\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
19853\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
19854\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
19855\\000\026\026\026\026\063\026\026\026\026\026\026\026\026\026\026\
19856\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
19857\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19858\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19859\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19860\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19861\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19862\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19863\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19864\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
19865),
19866 (64,
19867"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19868\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19869\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
19870\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
19871\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
19872\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
19873\\000\026\026\026\026\026\026\065\026\026\026\026\026\026\026\026\
19874\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
19875\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19876\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19877\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19878\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19879\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19880\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19881\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19882\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
19883),
19884 (65,
19885"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19886\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19887\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
19888\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
19889\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
19890\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
19891\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\066\026\
19892\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
19893\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19894\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19895\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19896\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19897\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19898\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19899\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19900\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
19901),
19902 (66,
19903"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19904\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19905\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
19906\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
19907\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
19908\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
19909\\000\067\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
19910\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
19911\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19912\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19913\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19914\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19915\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19916\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19917\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19918\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
19919),
19920 (67,
19921"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19922\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19923\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
19924\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
19925\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
19926\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
19927\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
19928\\026\026\026\026\068\026\026\026\026\026\026\000\000\000\000\000\
19929\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19930\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19931\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19932\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19933\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19934\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19935\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19936\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
19937),
19938 (68,
19939"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19940\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19941\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
19942\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
19943\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
19944\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
19945\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
19946\\026\026\026\026\026\069\026\026\026\026\026\000\000\000\000\000\
19947\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19948\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19949\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19950\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19951\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19952\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19953\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19954\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
19955),
19956 (69,
19957"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19958\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19959\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
19960\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
19961\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
19962\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
19963\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
19964\\026\026\070\026\026\026\026\026\026\026\026\000\000\000\000\000\
19965\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19966\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19967\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19968\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19969\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19970\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19971\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19972\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
19973),
19974 (70,
19975"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19976\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19977\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
19978\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
19979\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
19980\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
19981\\000\026\026\026\026\071\026\026\026\026\026\026\026\026\026\026\
19982\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
19983\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19984\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19985\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19986\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19987\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19988\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19989\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19990\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
19991),
19992 (72,
19993"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19994\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
19995\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
19996\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
19997\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
19998\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
19999\\000\073\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20000\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
20001\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20002\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20003\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20004\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20005\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20006\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20007\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20008\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
20009),
20010 (73,
20011"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20012\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20013\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
20014\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
20015\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20016\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
20017\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20018\\026\026\074\026\026\026\026\026\026\026\026\000\000\000\000\000\
20019\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20020\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20021\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20022\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20023\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20024\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20025\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20026\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
20027),
20028 (74,
20029"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20030\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20031\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
20032\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
20033\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20034\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
20035\\000\026\026\026\026\026\026\026\026\075\026\026\026\026\026\026\
20036\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
20037\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20038\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20039\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20040\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20041\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20042\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20043\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20044\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
20045),
20046 (75,
20047"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20048\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20049\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
20050\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
20051\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20052\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
20053\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\076\026\
20054\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
20055\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20056\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20057\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20058\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20059\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20060\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20061\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20062\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
20063),
20064 (76,
20065"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20066\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20067\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
20068\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
20069\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20070\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
20071\\000\026\026\026\026\026\026\077\026\026\026\026\026\026\026\026\
20072\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
20073\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20074\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20075\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20076\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20077\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20078\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20079\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20080\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
20081),
20082 (78,
20083"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20084\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20085\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
20086\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
20087\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20088\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
20089\\000\081\026\026\026\079\026\026\026\026\026\026\026\026\026\026\
20090\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
20091\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20092\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20093\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20094\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20095\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20096\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20097\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20098\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
20099),
20100 (79,
20101"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20102\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20103\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
20104\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
20105\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20106\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
20107\\000\026\026\080\026\026\026\026\026\026\026\026\026\026\026\026\
20108\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
20109\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20110\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20111\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20112\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20113\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20114\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20115\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20116\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
20117),
20118 (81,
20119"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20120\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20121\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
20122\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
20123\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20124\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
20125\\000\026\026\026\026\026\026\026\026\082\026\026\026\026\026\026\
20126\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
20127\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20128\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20129\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20130\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20131\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20132\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20133\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20134\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
20135),
20136 (82,
20137"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20138\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20139\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
20140\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
20141\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20142\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
20143\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20144\\026\026\026\083\026\026\026\026\026\026\026\000\000\000\000\000\
20145\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20146\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20147\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20148\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20149\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20150\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20151\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20152\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
20153),
20154 (83,
20155"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20156\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20157\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
20158\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
20159\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20160\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
20161\\000\026\026\026\026\084\026\026\026\026\026\026\026\026\026\026\
20162\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
20163\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20164\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20165\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20166\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20167\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20168\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20169\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20170\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
20171),
20172 (85,
20173"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20174\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20175\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
20176\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
20177\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20178\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
20179\\000\026\026\026\026\026\094\026\026\026\026\026\026\026\026\026\
20180\\091\026\086\026\026\026\026\026\026\026\026\000\000\000\000\000\
20181\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20182\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20183\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20184\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20185\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20186\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20187\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20188\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
20189),
20190 (86,
20191"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20192\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20193\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
20194\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
20195\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20196\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
20197\\000\026\026\026\026\087\026\026\026\026\026\026\026\026\026\026\
20198\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
20199\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20200\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20201\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20202\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20203\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20204\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20205\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20206\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
20207),
20208 (87,
20209"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20210\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20211\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
20212\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
20213\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20214\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
20215\\000\026\026\026\026\026\026\026\026\026\026\026\088\026\026\026\
20216\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
20217\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20218\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20219\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20220\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20221\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20222\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20223\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20224\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
20225),
20226 (88,
20227"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20228\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20229\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
20230\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
20231\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20232\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
20233\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20234\\026\026\026\089\026\026\026\026\026\026\026\000\000\000\000\000\
20235\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20236\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20237\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20238\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20239\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20240\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20241\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20242\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
20243),
20244 (89,
20245"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20246\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20247\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
20248\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
20249\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20250\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
20251\\000\026\026\026\026\090\026\026\026\026\026\026\026\026\026\026\
20252\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
20253\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20254\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20255\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20256\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20257\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20258\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20259\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20260\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
20261),
20262 (91,
20263"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20264\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20265\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
20266\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
20267\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20268\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
20269\\000\026\026\026\026\092\026\026\026\026\026\026\026\026\026\026\
20270\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
20271\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20272\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20273\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20274\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20275\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20276\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20277\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20278\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
20279),
20280 (92,
20281"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20282\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20283\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
20284\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
20285\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20286\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
20287\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\093\026\
20288\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
20289\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20290\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20291\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20292\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20293\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20294\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20295\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20296\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
20297),
20298 (95,
20299"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20300\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20301\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
20302\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
20303\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20304\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
20305\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\096\
20306\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
20307\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20308\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20309\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20310\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20311\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20312\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20313\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20314\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
20315),
20316 (96,
20317"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20318\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20319\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
20320\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
20321\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20322\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
20323\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\097\026\
20324\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
20325\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20326\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20327\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20328\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20329\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20330\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20331\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20332\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
20333),
20334 (97,
20335"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20336\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20337\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
20338\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
20339\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20340\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
20341\\000\026\026\026\026\026\098\026\026\026\026\026\026\026\026\026\
20342\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
20343\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20344\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20345\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20346\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20347\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20348\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20349\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20350\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
20351),
20352 (98,
20353"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20354\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20355\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
20356\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
20357\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20358\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
20359\\000\026\026\026\026\026\026\026\026\099\026\026\026\026\026\026\
20360\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
20361\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20362\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20363\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20364\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20365\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20366\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20367\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20368\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
20369),
20370 (99,
20371"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20372\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20373\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
20374\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
20375\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20376\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
20377\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20378\\026\026\026\026\026\026\026\026\100\026\026\000\000\000\000\000\
20379\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20380\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20381\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20382\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20383\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20384\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20385\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20386\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
20387),
20388 (101,
20389"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20390\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20391\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
20392\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
20393\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20394\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
20395\\000\026\026\026\026\106\026\026\026\026\026\026\026\026\026\102\
20396\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
20397\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20398\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20399\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20400\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20401\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20402\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20403\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20404\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
20405),
20406 (102,
20407"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20408\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20409\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
20410\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
20411\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20412\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
20413\\000\026\026\103\026\026\026\026\026\026\026\026\026\026\026\026\
20414\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
20415\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20416\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20417\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20418\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20419\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20420\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20421\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20422\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
20423),
20424 (103,
20425"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20426\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20427\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
20428\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
20429\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20430\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
20431\\000\104\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20432\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
20433\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20434\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20435\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20436\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20437\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20438\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20439\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20440\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
20441),
20442 (104,
20443"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20444\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20445\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
20446\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
20447\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20448\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
20449\\000\026\026\026\026\026\026\026\026\026\026\026\105\026\026\026\
20450\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
20451\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20452\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20453\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20454\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20455\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20456\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20457\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20458\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
20459),
20460 (106,
20461"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20462\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20463\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
20464\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
20465\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20466\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
20467\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20468\\026\026\026\026\107\026\026\026\026\026\026\000\000\000\000\000\
20469\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20470\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20471\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20472\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20473\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20474\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20475\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20476\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
20477),
20478 (108,
20479"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20480\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20481\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
20482\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
20483\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20484\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
20485\\000\026\026\026\026\026\119\026\026\026\026\026\026\026\109\026\
20486\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
20487\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20488\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20489\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20490\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20491\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20492\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20493\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20494\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
20495),
20496 (109,
20497"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20498\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20499\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
20500\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
20501\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20502\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
20503\\000\026\026\114\026\026\110\026\026\026\026\026\026\026\026\026\
20504\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
20505\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20506\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20507\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20508\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20509\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20510\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20511\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20512\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
20513),
20514 (110,
20515"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20516\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20517\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
20518\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
20519\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20520\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
20521\\000\026\026\026\026\026\026\026\026\111\026\026\026\026\026\026\
20522\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
20523\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20524\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20525\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20526\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20527\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20528\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20529\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20530\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
20531),
20532 (111,
20533"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20534\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20535\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
20536\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
20537\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20538\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
20539\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20540\\026\026\026\026\026\026\026\026\112\026\026\000\000\000\000\000\
20541\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20542\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20543\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20544\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20545\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20546\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20547\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20548\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
20549),
20550 (112,
20551"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20552\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20553\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
20554\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
20555\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20556\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
20557\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20558\\026\026\113\026\026\026\026\026\026\026\026\000\000\000\000\000\
20559\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20560\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20561\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20562\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20563\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20564\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20565\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20566\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
20567),
20568 (114,
20569"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20570\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20571\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
20572\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
20573\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20574\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
20575\\000\026\026\026\026\026\026\026\026\026\026\026\115\026\026\026\
20576\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
20577\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20578\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20579\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20580\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20581\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20582\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20583\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20584\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
20585),
20586 (115,
20587"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20588\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20589\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
20590\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
20591\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20592\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
20593\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20594\\026\026\026\026\026\116\026\026\026\026\026\000\000\000\000\000\
20595\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20596\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20597\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20598\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20599\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20600\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20601\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20602\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
20603),
20604 (116,
20605"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20606\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20607\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
20608\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
20609\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20610\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
20611\\000\026\026\026\117\026\026\026\026\026\026\026\026\026\026\026\
20612\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
20613\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20614\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20615\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20616\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20617\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20618\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20619\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20620\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
20621),
20622 (117,
20623"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20624\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20625\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
20626\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
20627\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20628\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
20629\\000\026\026\026\026\118\026\026\026\026\026\026\026\026\026\026\
20630\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
20631\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20632\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20633\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20634\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20635\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20636\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20637\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20638\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
20639),
20640 (120,
20641"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20642\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20643\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
20644\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
20645\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20646\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
20647\\000\121\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20648\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
20649\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20650\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20651\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20652\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20653\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20654\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20655\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20656\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
20657),
20658 (121,
20659"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20660\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20661\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
20662\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
20663\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20664\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
20665\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\122\026\
20666\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
20667\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20668\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20669\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20670\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20671\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20672\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20673\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20674\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
20675),
20676 (122,
20677"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20678\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20679\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
20680\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
20681\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20682\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
20683\\000\026\026\026\123\026\026\026\026\026\026\026\026\026\026\026\
20684\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
20685\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20686\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20687\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20688\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20689\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20690\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20691\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20692\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
20693),
20694 (123,
20695"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20696\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20697\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
20698\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
20699\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20700\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
20701\\000\026\026\026\026\026\026\026\026\026\026\026\124\026\026\026\
20702\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
20703\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20704\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20705\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20706\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20707\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20708\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20709\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20710\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
20711),
20712 (124,
20713"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20714\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20715\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
20716\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
20717\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20718\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
20719\\000\026\026\026\026\125\026\026\026\026\026\026\026\026\026\026\
20720\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
20721\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20722\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20723\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20724\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20725\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20726\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20727\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20728\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
20729),
20730 (126,
20731"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20732\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20733\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
20734\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
20735\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20736\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
20737\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\133\026\
20738\\026\026\026\026\026\127\026\026\026\026\026\000\000\000\000\000\
20739\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20740\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20741\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20742\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20743\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20744\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20745\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20746\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
20747),
20748 (127,
20749"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20750\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20751\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
20752\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
20753\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20754\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
20755\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\128\026\
20756\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
20757\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20758\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20759\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20760\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20761\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20762\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20763\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20764\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
20765),
20766 (128,
20767"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20768\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20769\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
20770\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
20771\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20772\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
20773\\000\026\026\129\026\026\026\026\026\026\026\026\026\026\026\026\
20774\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
20775\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20776\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20777\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20778\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20779\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20780\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20781\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20782\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
20783),
20784 (129,
20785"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20786\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20787\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
20788\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
20789\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20790\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
20791\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20792\\026\026\026\026\130\026\026\026\026\026\026\000\000\000\000\000\
20793\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20794\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20795\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20796\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20797\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20798\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20799\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20800\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
20801),
20802 (130,
20803"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20804\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20805\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
20806\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
20807\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20808\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
20809\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\131\
20810\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
20811\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20812\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20813\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20814\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20815\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20816\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20817\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20818\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
20819),
20820 (131,
20821"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20822\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20823\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
20824\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
20825\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20826\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
20827\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20828\\026\026\132\026\026\026\026\026\026\026\026\000\000\000\000\000\
20829\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20830\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20831\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20832\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20833\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20834\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20835\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20836\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
20837),
20838 (134,
20839"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20840\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20841\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
20842\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
20843\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20844\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
20845\\000\026\026\026\026\026\026\026\026\026\026\026\150\026\148\026\
20846\\026\143\026\026\026\026\026\026\135\026\026\000\000\000\000\000\
20847\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20848\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20849\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20850\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20851\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20852\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20853\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20854\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
20855),
20856 (135,
20857"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20858\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20859\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
20860\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
20861\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20862\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
20863\\000\026\026\136\026\026\026\026\026\026\026\026\026\026\026\026\
20864\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
20865\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20866\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20867\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20868\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20869\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20870\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20871\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20872\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
20873),
20874 (136,
20875"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20876\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20877\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
20878\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
20879\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20880\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
20881\\000\026\026\026\026\137\026\026\026\026\026\026\026\026\026\026\
20882\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
20883\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20884\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20885\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20886\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20887\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20888\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20889\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20890\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
20891),
20892 (137,
20893"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20894\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20895\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
20896\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
20897\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20898\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
20899\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20900\\138\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
20901\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20902\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20903\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20904\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20905\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20906\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20907\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20908\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
20909),
20910 (138,
20911"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20912\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20913\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
20914\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
20915\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20916\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
20917\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20918\\026\026\026\026\139\026\026\026\026\026\026\000\000\000\000\000\
20919\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20920\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20921\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20922\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20923\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20924\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20925\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20926\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
20927),
20928 (139,
20929"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20930\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20931\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
20932\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
20933\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20934\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
20935\\000\026\026\026\026\026\026\026\026\140\026\026\026\026\026\026\
20936\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
20937\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20938\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20939\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20940\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20941\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20942\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20943\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20944\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
20945),
20946 (140,
20947"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20948\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20949\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
20950\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
20951\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20952\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
20953\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\141\
20954\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
20955\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20956\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20957\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20958\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20959\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20960\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20961\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20962\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
20963),
20964 (141,
20965"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20966\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20967\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
20968\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
20969\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20970\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
20971\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\142\026\
20972\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
20973\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20974\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20975\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20976\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20977\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20978\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20979\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20980\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
20981),
20982 (143,
20983"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20984\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20985\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
20986\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
20987\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20988\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
20989\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
20990\\026\026\026\026\144\026\026\026\026\026\026\000\000\000\000\000\
20991\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20992\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20993\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20994\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20995\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20996\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20997\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
20998\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
20999),
21000 (144,
21001"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21002\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21003\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
21004\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
21005\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
21006\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
21007\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
21008\\026\026\026\026\026\026\026\026\026\145\026\000\000\000\000\000\
21009\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21010\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21011\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21012\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21013\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21014\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21015\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21016\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
21017),
21018 (145,
21019"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21020\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21021\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
21022\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
21023\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
21024\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
21025\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
21026\\146\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
21027\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21028\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21029\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21030\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21031\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21032\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21033\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21034\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
21035),
21036 (146,
21037"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21038\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21039\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
21040\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
21041\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
21042\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
21043\\000\026\026\026\026\147\026\026\026\026\026\026\026\026\026\026\
21044\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
21045\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21046\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21047\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21048\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21049\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21050\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21051\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21052\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
21053),
21054 (148,
21055"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21056\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21057\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
21058\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
21059\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
21060\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
21061\\000\026\026\026\149\026\026\026\026\026\026\026\026\026\026\026\
21062\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
21063\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21064\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21065\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21066\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21067\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21068\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21069\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21070\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
21071),
21072 (150,
21073"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21074\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21075\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
21076\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
21077\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
21078\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
21079\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
21080\\026\026\026\151\026\026\026\026\026\026\026\000\000\000\000\000\
21081\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21082\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21083\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21084\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21085\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21086\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21087\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21088\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
21089),
21090 (151,
21091"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21092\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21093\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
21094\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
21095\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
21096\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
21097\\000\026\026\026\026\152\026\026\026\026\026\026\026\026\026\026\
21098\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
21099\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21100\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21101\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21102\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21103\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21104\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21105\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21106\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
21107),
21108 (153,
21109"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21110\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21111\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
21112\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
21113\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
21114\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
21115\\000\155\026\026\026\026\026\026\026\026\026\026\026\026\026\154\
21116\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
21117\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21118\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21119\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21120\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21121\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21122\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21123\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21124\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
21125),
21126 (155,
21127"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21128\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21129\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
21130\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
21131\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
21132\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
21133\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
21134\\026\026\026\026\156\026\026\026\026\026\026\000\000\000\000\000\
21135\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21136\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21137\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21138\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21139\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21140\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21141\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21142\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
21143),
21144 (156,
21145"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21146\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21147\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
21148\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
21149\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
21150\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
21151\\000\157\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
21152\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
21153\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21154\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21155\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21156\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21157\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21158\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21159\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21160\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
21161),
21162 (157,
21163"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21164\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21165\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
21166\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
21167\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
21168\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
21169\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
21170\\026\026\026\026\158\026\026\026\026\026\026\000\000\000\000\000\
21171\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21172\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21173\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21174\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21175\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21176\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21177\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21178\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
21179),
21180 (158,
21181"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21182\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21183\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
21184\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
21185\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
21186\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
21187\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
21188\\026\026\026\026\026\026\026\026\026\159\026\000\000\000\000\000\
21189\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21190\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21191\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21192\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21193\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21194\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21195\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21196\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
21197),
21198 (159,
21199"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21200\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21201\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
21202\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
21203\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
21204\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
21205\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
21206\\160\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
21207\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21208\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21209\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21210\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21211\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21212\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21213\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21214\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
21215),
21216 (160,
21217"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21218\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21219\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
21220\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
21221\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
21222\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
21223\\000\026\026\026\026\161\026\026\026\026\026\026\026\026\026\026\
21224\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
21225\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21226\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21227\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21228\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21229\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21230\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21231\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21232\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
21233),
21234 (162,
21235"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21236\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21237\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
21238\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
21239\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
21240\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
21241\\000\163\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
21242\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
21243\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21244\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21245\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21246\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21247\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21248\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21249\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21250\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
21251),
21252 (163,
21253"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21254\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21255\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
21256\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
21257\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
21258\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
21259\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
21260\\026\026\026\164\026\026\026\026\026\026\026\000\000\000\000\000\
21261\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21262\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21263\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21264\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21265\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21266\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21267\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21268\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
21269),
21270 (164,
21271"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21272\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21273\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
21274\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
21275\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
21276\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
21277\\000\026\026\026\026\165\026\026\026\026\026\026\026\026\026\026\
21278\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
21279\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21280\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21281\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21282\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21283\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21284\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21285\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21286\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
21287),
21288 (166,
21289"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21290\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21291\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
21292\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
21293\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
21294\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
21295\\000\026\174\026\026\026\026\026\026\026\026\026\026\026\168\026\
21296\\026\026\026\167\026\026\026\026\026\026\026\000\000\000\000\000\
21297\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21298\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21299\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21300\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21301\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21302\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21303\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21304\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
21305),
21306 (168,
21307"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21308\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21309\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
21310\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
21311\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
21312\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
21313\\000\026\026\026\169\026\026\026\026\026\026\026\026\026\026\026\
21314\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
21315\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21316\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21317\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21318\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21319\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21320\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21321\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21322\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
21323),
21324 (169,
21325"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21326\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21327\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
21328\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
21329\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
21330\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
21331\\000\170\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
21332\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
21333\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21334\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21335\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21336\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21337\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21338\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21339\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21340\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
21341),
21342 (170,
21343"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21344\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21345\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
21346\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
21347\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
21348\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
21349\\000\026\026\026\026\026\026\026\026\026\026\026\171\026\026\026\
21350\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
21351\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21352\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21353\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21354\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21355\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21356\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21357\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21358\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
21359),
21360 (171,
21361"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21362\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21363\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
21364\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
21365\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
21366\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
21367\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
21368\\026\026\026\172\026\026\026\026\026\026\026\000\000\000\000\000\
21369\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21370\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21371\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21372\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21373\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21374\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21375\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21376\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
21377),
21378 (172,
21379"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21380\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21381\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
21382\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
21383\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
21384\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
21385\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\173\
21386\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
21387\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21388\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21389\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21390\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21391\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21392\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21393\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21394\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
21395),
21396 (174,
21397"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21398\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21399\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
21400\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
21401\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
21402\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
21403\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
21404\\026\026\026\175\026\026\026\026\026\026\026\000\000\000\000\000\
21405\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21406\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21407\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21408\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21409\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21410\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21411\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21412\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
21413),
21414 (175,
21415"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21416\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21417\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
21418\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
21419\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
21420\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
21421\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
21422\\026\026\026\026\176\026\026\026\026\026\026\000\000\000\000\000\
21423\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21424\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21425\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21426\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21427\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21428\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21429\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21430\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
21431),
21432 (176,
21433"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21434\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21435\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
21436\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
21437\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
21438\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
21439\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
21440\\026\026\026\026\026\026\026\026\026\177\026\000\000\000\000\000\
21441\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21442\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21443\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21444\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21445\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21446\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21447\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21448\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
21449),
21450 (177,
21451"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21452\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21453\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
21454\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
21455\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
21456\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
21457\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
21458\\178\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
21459\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21460\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21461\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21462\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21463\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21464\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21465\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21466\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
21467),
21468 (178,
21469"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21470\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21471\\000\000\000\000\000\000\000\026\000\000\000\000\000\000\027\000\
21472\\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\000\
21473\\000\026\026\026\026\026\026\026\026\026\026\026\026\026\026\026\
21474\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\026\
21475\\000\026\026\026\026\179\026\026\026\026\026\026\026\026\026\026\
21476\\026\026\026\026\026\026\026\026\026\026\026\000\000\000\000\000\
21477\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21478\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21479\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21480\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21481\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21482\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21483\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21484\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
21485),
21486 (184,
21487"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21488\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21489\\000\007\000\007\007\007\007\000\000\000\007\007\000\007\000\007\
21490\\000\000\000\000\000\000\000\000\000\000\007\000\007\007\185\007\
21491\\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21492\\000\000\000\000\000\000\000\000\000\000\000\000\007\000\007\000\
21493\\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21494\\000\000\000\000\000\000\000\000\000\000\000\000\007\000\007\000\
21495\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21496\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21497\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21498\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21499\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21500\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21501\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21502\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
21503),
21504 (187,
21505"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21506\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21507\\000\007\000\007\007\007\007\000\000\000\007\007\000\007\000\007\
21508\\000\000\000\000\000\000\000\000\000\000\007\000\007\007\188\007\
21509\\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21510\\000\000\000\000\000\000\000\000\000\000\000\000\007\000\007\000\
21511\\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21512\\000\000\000\000\000\000\000\000\000\000\000\000\007\000\007\000\
21513\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21514\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21515\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21516\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21517\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21518\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21519\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21520\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
21521),
21522 (189,
21523"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21524\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21525\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\013\000\
21526\\190\190\190\190\190\190\190\190\190\190\000\000\000\000\000\000\
21527\\000\000\000\000\000\009\000\000\000\000\000\000\000\000\000\000\
21528\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21529\\000\000\000\000\000\009\000\000\000\000\000\000\000\000\000\000\
21530\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21531\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21532\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21533\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21534\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21535\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21536\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21537\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21538\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
21539),
21540 (191,
21541"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21542\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21543\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\013\000\
21544\\198\198\198\198\198\198\198\198\198\198\000\000\000\000\000\000\
21545\\000\000\000\000\000\009\000\000\000\000\000\000\000\000\000\000\
21546\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21547\\000\000\000\000\000\009\000\000\000\000\000\000\000\000\000\000\
21548\\000\000\000\000\000\000\000\194\192\000\000\000\000\000\000\000\
21549\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21550\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21551\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21552\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21553\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21554\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21555\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21556\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
21557),
21558 (192,
21559"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21560\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21561\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21562\\193\193\193\193\193\193\193\193\193\193\000\000\000\000\000\000\
21563\\000\193\193\193\193\193\193\000\000\000\000\000\000\000\000\000\
21564\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21565\\000\193\193\193\193\193\193\000\000\000\000\000\000\000\000\000\
21566\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21567\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21568\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21569\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21570\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21571\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21572\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21573\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21574\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
21575),
21576 (194,
21577"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21578\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21579\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21580\\197\197\197\197\197\197\197\197\197\197\000\000\000\000\000\000\
21581\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21582\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21583\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21584\\000\000\000\000\000\000\000\000\195\000\000\000\000\000\000\000\
21585\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21586\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21587\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21588\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21589\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21590\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21591\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21592\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
21593),
21594 (195,
21595"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21596\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21597\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21598\\196\196\196\196\196\196\196\196\196\196\000\000\000\000\000\000\
21599\\000\196\196\196\196\196\196\000\000\000\000\000\000\000\000\000\
21600\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21601\\000\196\196\196\196\196\196\000\000\000\000\000\000\000\000\000\
21602\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21603\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21604\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21605\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21606\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21607\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21608\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21609\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21610\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
21611),
21612 (197,
21613"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21614\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21615\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21616\\197\197\197\197\197\197\197\197\197\197\000\000\000\000\000\000\
21617\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21618\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21619\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21620\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21621\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21622\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21623\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21624\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21625\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21626\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21627\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21628\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
21629),
21630 (198,
21631"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21632\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21633\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\013\000\
21634\\198\198\198\198\198\198\198\198\198\198\000\000\000\000\000\000\
21635\\000\000\000\000\000\009\000\000\000\000\000\000\000\000\000\000\
21636\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21637\\000\000\000\000\000\009\000\000\000\000\000\000\000\000\000\000\
21638\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21639\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21640\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21641\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21642\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21643\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21644\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21645\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21646\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
21647),
21648 (199,
21649"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21650\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21651\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\200\000\
21652\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21653\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21654\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21655\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21656\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21657\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21658\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21659\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21660\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21661\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21662\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21663\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21664\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
21665),
21666 (200,
21667"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21668\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21669\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\201\000\
21670\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21671\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21672\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21673\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21674\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21675\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21676\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21677\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21678\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21679\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21680\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21681\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21682\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
21683),
21684 (202,
21685"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21686\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21687\\000\007\000\007\007\007\007\000\000\000\007\007\000\007\000\007\
21688\\000\000\000\000\000\000\000\000\000\000\007\000\007\007\203\007\
21689\\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21690\\000\000\000\000\000\000\000\000\000\000\000\000\007\000\007\000\
21691\\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21692\\000\000\000\000\000\000\000\000\000\000\000\000\007\000\007\000\
21693\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21694\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21695\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21696\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21697\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21698\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21699\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21700\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
21701),
21702 (207,
21703"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21704\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21705\\000\000\000\000\000\000\000\000\000\000\208\000\000\000\000\000\
21706\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21707\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21708\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21709\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21710\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21711\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21712\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21713\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21714\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21715\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21716\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21717\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21718\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
21719),
21720 (209,
21721"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21722\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21723\\000\000\000\000\000\000\000\210\000\000\000\000\000\000\000\000\
21724\\210\210\210\210\210\210\210\210\210\210\000\000\000\000\000\000\
21725\\000\210\210\210\210\210\210\210\210\210\210\210\210\210\210\210\
21726\\210\210\210\210\210\210\210\210\210\210\210\000\000\000\000\210\
21727\\000\210\210\210\210\210\210\210\210\210\210\210\210\210\210\210\
21728\\210\210\210\210\210\210\210\210\210\210\210\000\000\000\000\000\
21729\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21730\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21731\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21732\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21733\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21734\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21735\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21736\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
21737),
21738 (211,
21739"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21740\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21741\\000\007\212\007\007\007\007\000\000\000\007\007\000\007\000\007\
21742\\000\000\000\000\000\000\000\000\000\000\007\000\007\007\007\007\
21743\\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21744\\000\000\000\000\000\000\000\000\000\000\000\000\007\000\007\000\
21745\\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21746\\000\000\000\000\000\000\000\000\000\000\000\000\007\000\007\000\
21747\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21748\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21749\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21750\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21751\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21752\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21753\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21754\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
21755),
21756 (212,
21757"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21758\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21759\\212\212\222\212\212\212\212\212\212\212\212\212\212\212\212\212\
21760\\212\212\212\212\212\212\212\212\212\212\212\212\212\212\212\212\
21761\\212\212\212\212\212\212\212\212\212\212\212\212\212\212\212\212\
21762\\212\212\212\212\212\212\212\212\212\212\212\212\213\212\212\212\
21763\\212\212\212\212\212\212\212\212\212\212\212\212\212\212\212\212\
21764\\212\212\212\212\212\212\212\212\212\212\212\212\212\212\212\000\
21765\\212\212\212\212\212\212\212\212\212\212\212\212\212\212\212\212\
21766\\212\212\212\212\212\212\212\212\212\212\212\212\212\212\212\212\
21767\\212\212\212\212\212\212\212\212\212\212\212\212\212\212\212\212\
21768\\212\212\212\212\212\212\212\212\212\212\212\212\212\212\212\212\
21769\\212\212\212\212\212\212\212\212\212\212\212\212\212\212\212\212\
21770\\212\212\212\212\212\212\212\212\212\212\212\212\212\212\212\212\
21771\\212\212\212\212\212\212\212\212\212\212\212\212\212\212\212\212\
21772\\212\212\212\212\212\212\212\212\212\212\212\212\212\212\212\212"
21773),
21774 (213,
21775"\000\000\000\000\000\000\000\000\000\221\221\221\221\221\000\000\
21776\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21777\\221\000\212\000\000\000\000\000\000\000\000\000\000\000\000\000\
21778\\219\219\219\219\219\219\219\219\219\219\000\000\000\000\000\000\
21779\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21780\\000\000\000\000\000\000\000\000\000\000\000\000\212\000\218\000\
21781\\000\212\212\000\000\000\212\000\000\000\000\000\000\000\212\000\
21782\\000\000\212\000\212\214\212\000\000\000\000\000\000\000\000\000\
21783\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21784\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21785\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21786\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21787\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21788\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21789\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21790\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
21791),
21792 (214,
21793"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21794\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21795\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21796\\215\215\215\215\215\215\215\215\215\215\000\000\000\000\000\000\
21797\\000\215\215\215\215\215\215\000\000\000\000\000\000\000\000\000\
21798\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21799\\000\215\215\215\215\215\215\000\000\000\000\000\000\000\000\000\
21800\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21801\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21802\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21803\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21804\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21805\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21806\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21807\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21808\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
21809),
21810 (215,
21811"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21812\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21813\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21814\\216\216\216\216\216\216\216\216\216\216\000\000\000\000\000\000\
21815\\000\216\216\216\216\216\216\000\000\000\000\000\000\000\000\000\
21816\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21817\\000\216\216\216\216\216\216\000\000\000\000\000\000\000\000\000\
21818\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21819\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21820\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21821\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21822\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21823\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21824\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21825\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21826\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
21827),
21828 (216,
21829"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21830\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21831\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21832\\217\217\217\217\217\217\217\217\217\217\000\000\000\000\000\000\
21833\\000\217\217\217\217\217\217\000\000\000\000\000\000\000\000\000\
21834\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21835\\000\217\217\217\217\217\217\000\000\000\000\000\000\000\000\000\
21836\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21837\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21838\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21839\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21840\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21841\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21842\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21843\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21844\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
21845),
21846 (217,
21847"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21848\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21849\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21850\\212\212\212\212\212\212\212\212\212\212\000\000\000\000\000\000\
21851\\000\212\212\212\212\212\212\000\000\000\000\000\000\000\000\000\
21852\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21853\\000\212\212\212\212\212\212\000\000\000\000\000\000\000\000\000\
21854\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21855\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21856\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21857\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21858\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21859\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21860\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21861\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21862\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
21863),
21864 (218,
21865"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21866\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21867\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21868\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21869\\212\212\212\212\212\212\212\212\212\212\212\212\212\212\212\212\
21870\\212\212\212\212\212\212\212\212\212\212\212\212\212\212\212\212\
21871\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21872\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21873\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21874\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21875\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21876\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21877\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21878\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21879\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21880\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
21881),
21882 (219,
21883"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21884\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21885\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21886\\220\220\220\220\220\220\220\220\220\220\000\000\000\000\000\000\
21887\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21888\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21889\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21890\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21891\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21892\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21893\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21894\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21895\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21896\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21897\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21898\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
21899),
21900 (220,
21901"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21902\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21903\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21904\\212\212\212\212\212\212\212\212\212\212\000\000\000\000\000\000\
21905\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21906\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21907\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21908\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21909\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21910\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21911\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21912\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21913\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21914\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21915\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21916\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
21917),
21918 (221,
21919"\000\000\000\000\000\000\000\000\000\221\221\221\221\221\000\000\
21920\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21921\\221\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21922\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21923\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21924\\000\000\000\000\000\000\000\000\000\000\000\000\212\000\000\000\
21925\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21926\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21927\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21928\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21929\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21930\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21931\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21932\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21933\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21934\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
21935),
21936 (223,
21937"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21938\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21939\\224\224\234\224\224\224\224\224\224\224\224\224\224\224\224\224\
21940\\224\224\224\224\224\224\224\224\224\224\224\224\224\224\224\224\
21941\\224\224\224\224\224\224\224\224\224\224\224\224\224\224\224\224\
21942\\224\224\224\224\224\224\224\224\224\224\224\224\225\224\224\224\
21943\\224\224\224\224\224\224\224\224\224\224\224\224\224\224\224\224\
21944\\224\224\224\224\224\224\224\224\224\224\224\224\224\224\224\000\
21945\\224\224\224\224\224\224\224\224\224\224\224\224\224\224\224\224\
21946\\224\224\224\224\224\224\224\224\224\224\224\224\224\224\224\224\
21947\\224\224\224\224\224\224\224\224\224\224\224\224\224\224\224\224\
21948\\224\224\224\224\224\224\224\224\224\224\224\224\224\224\224\224\
21949\\224\224\224\224\224\224\224\224\224\224\224\224\224\224\224\224\
21950\\224\224\224\224\224\224\224\224\224\224\224\224\224\224\224\224\
21951\\224\224\224\224\224\224\224\224\224\224\224\224\224\224\224\224\
21952\\224\224\224\224\224\224\224\224\224\224\224\224\224\224\224\224"
21953),
21954 (225,
21955"\000\000\000\000\000\000\000\000\000\233\233\233\233\233\000\000\
21956\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21957\\233\000\224\000\000\000\000\000\000\000\000\000\000\000\000\000\
21958\\231\231\231\231\231\231\231\231\231\231\000\000\000\000\000\000\
21959\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21960\\000\000\000\000\000\000\000\000\000\000\000\000\224\000\230\000\
21961\\000\224\224\000\000\000\224\000\000\000\000\000\000\000\224\000\
21962\\000\000\224\000\224\226\224\000\000\000\000\000\000\000\000\000\
21963\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21964\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21965\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21966\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21967\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21968\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21969\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21970\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
21971),
21972 (226,
21973"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21974\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21975\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21976\\227\227\227\227\227\227\227\227\227\227\000\000\000\000\000\000\
21977\\000\227\227\227\227\227\227\000\000\000\000\000\000\000\000\000\
21978\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21979\\000\227\227\227\227\227\227\000\000\000\000\000\000\000\000\000\
21980\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21981\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21982\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21983\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21984\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21985\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21986\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21987\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21988\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
21989),
21990 (227,
21991"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21992\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21993\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21994\\228\228\228\228\228\228\228\228\228\228\000\000\000\000\000\000\
21995\\000\228\228\228\228\228\228\000\000\000\000\000\000\000\000\000\
21996\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21997\\000\228\228\228\228\228\228\000\000\000\000\000\000\000\000\000\
21998\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
21999\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22000\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22001\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22002\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22003\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22004\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22005\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22006\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
22007),
22008 (228,
22009"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22010\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22011\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22012\\229\229\229\229\229\229\229\229\229\229\000\000\000\000\000\000\
22013\\000\229\229\229\229\229\229\000\000\000\000\000\000\000\000\000\
22014\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22015\\000\229\229\229\229\229\229\000\000\000\000\000\000\000\000\000\
22016\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22017\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22018\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22019\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22020\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22021\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22022\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22023\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22024\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
22025),
22026 (229,
22027"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22028\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22029\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22030\\224\224\224\224\224\224\224\224\224\224\000\000\000\000\000\000\
22031\\000\224\224\224\224\224\224\000\000\000\000\000\000\000\000\000\
22032\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22033\\000\224\224\224\224\224\224\000\000\000\000\000\000\000\000\000\
22034\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22035\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22036\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22037\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22038\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22039\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22040\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22041\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22042\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
22043),
22044 (230,
22045"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22046\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22047\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22048\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22049\\224\224\224\224\224\224\224\224\224\224\224\224\224\224\224\224\
22050\\224\224\224\224\224\224\224\224\224\224\224\224\224\224\224\224\
22051\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22052\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22053\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22054\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22055\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22056\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22057\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22058\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22059\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22060\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
22061),
22062 (231,
22063"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22064\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22065\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22066\\232\232\232\232\232\232\232\232\232\232\000\000\000\000\000\000\
22067\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22068\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22069\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22070\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22071\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22072\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22073\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22074\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22075\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22076\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22077\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22078\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
22079),
22080 (232,
22081"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22082\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22083\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22084\\224\224\224\224\224\224\224\224\224\224\000\000\000\000\000\000\
22085\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22086\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22087\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22088\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22089\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22090\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22091\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22092\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22093\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22094\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22095\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22096\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
22097),
22098 (233,
22099"\000\000\000\000\000\000\000\000\000\233\233\233\233\233\000\000\
22100\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22101\\233\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22102\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22103\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22104\\000\000\000\000\000\000\000\000\000\000\000\000\224\000\000\000\
22105\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22106\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22107\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22108\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22109\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22110\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22111\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22112\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22113\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22114\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
22115),
22116 (235,
22117"\000\000\000\000\000\000\000\000\000\236\236\236\236\236\000\000\
22118\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22119\\236\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22120\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22121\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22122\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22123\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22124\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22125\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22126\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22127\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22128\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22129\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22130\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22131\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22132\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
22133),
22134 (238,
22135"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22136\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22137\\000\000\000\000\000\000\000\000\000\239\000\000\000\000\000\000\
22138\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22139\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22140\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22141\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22142\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22143\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22144\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22145\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22146\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22147\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22148\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22149\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22150\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
22151),
22152 (240,
22153"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22154\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22155\\000\000\000\000\000\000\000\000\000\000\241\000\000\000\000\000\
22156\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22157\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22158\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22159\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22160\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22161\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22162\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22163\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22164\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22165\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22166\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22167\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
22168\\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
22169),
22170(0, "")]
22171fun f x = x
22172val s = map f (rev (tl (rev s)))
22173exception LexHackingError
22174fun look ((j,x)::r, i) = if i = j then x else look(r, i)
22175 | look ([], i) = raise LexHackingError
22176fun g {fin=x, trans=i} = {fin=x, trans=look(s,i)}
22177in Vector.fromList(map g
22178[{fin = [], trans = 0},
22179{fin = [], trans = 1},
22180{fin = [], trans = 1},
22181{fin = [], trans = 3},
22182{fin = [], trans = 3},
22183{fin = [(N 472)], trans = 0},
22184{fin = [(N 436),(N 472)], trans = 6},
22185{fin = [(N 436)], trans = 7},
22186{fin = [(N 304)], trans = 8},
22187{fin = [], trans = 9},
22188{fin = [], trans = 10},
22189{fin = [(N 342)], trans = 10},
22190{fin = [(N 342)], trans = 12},
22191{fin = [], trans = 13},
22192{fin = [(N 342)], trans = 14},
22193{fin = [], trans = 15},
22194{fin = [], trans = 16},
22195{fin = [(N 342)], trans = 16},
22196{fin = [(N 342)], trans = 18},
22197{fin = [(N 304)], trans = 19},
22198{fin = [], trans = 20},
22199{fin = [(N 304)], trans = 20},
22200{fin = [(N 43),(N 472)], trans = 0},
22201{fin = [(N 41),(N 436),(N 472)], trans = 7},
22202{fin = [(N 39),(N 472)], trans = 0},
22203{fin = [(N 433),(N 472)], trans = 25},
22204{fin = [(N 433)], trans = 25},
22205{fin = [], trans = 27},
22206{fin = [(N 455)], trans = 28},
22207{fin = [(N 455)], trans = 29},
22208{fin = [(N 433),(N 472)], trans = 30},
22209{fin = [(N 433)], trans = 31},
22210{fin = [(N 433)], trans = 32},
22211{fin = [(N 273),(N 433)], trans = 33},
22212{fin = [(N 433)], trans = 34},
22213{fin = [(N 433)], trans = 35},
22214{fin = [(N 433)], trans = 36},
22215{fin = [(N 282),(N 433)], trans = 25},
22216{fin = [(N 433)], trans = 38},
22217{fin = [(N 433)], trans = 39},
22218{fin = [(N 433)], trans = 40},
22219{fin = [(N 268),(N 433)], trans = 25},
22220{fin = [(N 433)], trans = 42},
22221{fin = [(N 433)], trans = 43},
22222{fin = [(N 262),(N 433)], trans = 25},
22223{fin = [(N 433),(N 472)], trans = 45},
22224{fin = [(N 433)], trans = 46},
22225{fin = [(N 256),(N 433)], trans = 25},
22226{fin = [(N 433),(N 472)], trans = 48},
22227{fin = [(N 433)], trans = 49},
22228{fin = [(N 433)], trans = 50},
22229{fin = [(N 252),(N 433)], trans = 25},
22230{fin = [(N 433)], trans = 52},
22231{fin = [(N 433)], trans = 53},
22232{fin = [(N 247),(N 433)], trans = 25},
22233{fin = [(N 433),(N 472)], trans = 55},
22234{fin = [(N 433)], trans = 56},
22235{fin = [(N 433)], trans = 57},
22236{fin = [(N 433)], trans = 58},
22237{fin = [(N 433)], trans = 59},
22238{fin = [(N 232),(N 433)], trans = 60},
22239{fin = [(N 433)], trans = 61},
22240{fin = [(N 433)], trans = 62},
22241{fin = [(N 242),(N 433)], trans = 25},
22242{fin = [(N 433)], trans = 64},
22243{fin = [(N 215),(N 433)], trans = 65},
22244{fin = [(N 433)], trans = 66},
22245{fin = [(N 433)], trans = 67},
22246{fin = [(N 433)], trans = 68},
22247{fin = [(N 433)], trans = 69},
22248{fin = [(N 433)], trans = 70},
22249{fin = [(N 225),(N 433)], trans = 25},
22250{fin = [(N 433)], trans = 72},
22251{fin = [(N 433)], trans = 73},
22252{fin = [(N 433)], trans = 74},
22253{fin = [(N 433)], trans = 75},
22254{fin = [(N 433)], trans = 76},
22255{fin = [(N 211),(N 433)], trans = 25},
22256{fin = [(N 433),(N 472)], trans = 78},
22257{fin = [(N 433)], trans = 79},
22258{fin = [(N 203),(N 433)], trans = 25},
22259{fin = [(N 433)], trans = 81},
22260{fin = [(N 433)], trans = 82},
22261{fin = [(N 433)], trans = 83},
22262{fin = [(N 199),(N 433)], trans = 25},
22263{fin = [(N 433),(N 472)], trans = 85},
22264{fin = [(N 433)], trans = 86},
22265{fin = [(N 433)], trans = 87},
22266{fin = [(N 433)], trans = 88},
22267{fin = [(N 433)], trans = 89},
22268{fin = [(N 193),(N 433)], trans = 25},
22269{fin = [(N 181),(N 433)], trans = 91},
22270{fin = [(N 433)], trans = 92},
22271{fin = [(N 186),(N 433)], trans = 25},
22272{fin = [(N 178),(N 433)], trans = 25},
22273{fin = [(N 433),(N 472)], trans = 95},
22274{fin = [(N 433)], trans = 96},
22275{fin = [(N 433)], trans = 97},
22276{fin = [(N 433)], trans = 98},
22277{fin = [(N 433)], trans = 99},
22278{fin = [(N 175),(N 433)], trans = 25},
22279{fin = [(N 433),(N 472)], trans = 101},
22280{fin = [(N 433)], trans = 102},
22281{fin = [(N 433)], trans = 103},
22282{fin = [(N 433)], trans = 104},
22283{fin = [(N 168),(N 433)], trans = 25},
22284{fin = [(N 433)], trans = 106},
22285{fin = [(N 162),(N 433)], trans = 25},
22286{fin = [(N 433),(N 472)], trans = 108},
22287{fin = [(N 137),(N 433)], trans = 109},
22288{fin = [(N 433)], trans = 110},
22289{fin = [(N 433)], trans = 111},
22290{fin = [(N 151),(N 433)], trans = 112},
22291{fin = [(N 158),(N 433)], trans = 25},
22292{fin = [(N 433)], trans = 114},
22293{fin = [(N 433)], trans = 115},
22294{fin = [(N 433)], trans = 116},
22295{fin = [(N 433)], trans = 117},
22296{fin = [(N 145),(N 433)], trans = 25},
22297{fin = [(N 134),(N 433)], trans = 25},
22298{fin = [(N 433),(N 472)], trans = 120},
22299{fin = [(N 433)], trans = 121},
22300{fin = [(N 433)], trans = 122},
22301{fin = [(N 433)], trans = 123},
22302{fin = [(N 433)], trans = 124},
22303{fin = [(N 131),(N 433)], trans = 25},
22304{fin = [(N 433),(N 472)], trans = 126},
22305{fin = [(N 433)], trans = 127},
22306{fin = [(N 116),(N 433)], trans = 128},
22307{fin = [(N 433)], trans = 129},
22308{fin = [(N 433)], trans = 130},
22309{fin = [(N 433)], trans = 131},
22310{fin = [(N 124),(N 433)], trans = 25},
22311{fin = [(N 112),(N 433)], trans = 25},
22312{fin = [(N 433),(N 472)], trans = 134},
22313{fin = [(N 433)], trans = 135},
22314{fin = [(N 433)], trans = 136},
22315{fin = [(N 433)], trans = 137},
22316{fin = [(N 433)], trans = 138},
22317{fin = [(N 433)], trans = 139},
22318{fin = [(N 433)], trans = 140},
22319{fin = [(N 433)], trans = 141},
22320{fin = [(N 109),(N 433)], trans = 25},
22321{fin = [(N 433)], trans = 143},
22322{fin = [(N 433)], trans = 144},
22323{fin = [(N 433)], trans = 145},
22324{fin = [(N 433)], trans = 146},
22325{fin = [(N 99),(N 433)], trans = 25},
22326{fin = [(N 433)], trans = 148},
22327{fin = [(N 92),(N 433)], trans = 25},
22328{fin = [(N 433)], trans = 150},
22329{fin = [(N 433)], trans = 151},
22330{fin = [(N 88),(N 433)], trans = 25},
22331{fin = [(N 433),(N 472)], trans = 153},
22332{fin = [(N 83),(N 433)], trans = 25},
22333{fin = [(N 433)], trans = 155},
22334{fin = [(N 433)], trans = 156},
22335{fin = [(N 433)], trans = 157},
22336{fin = [(N 433)], trans = 158},
22337{fin = [(N 433)], trans = 159},
22338{fin = [(N 433)], trans = 160},
22339{fin = [(N 80),(N 433)], trans = 25},
22340{fin = [(N 433),(N 472)], trans = 162},
22341{fin = [(N 433)], trans = 163},
22342{fin = [(N 433)], trans = 164},
22343{fin = [(N 71),(N 433)], trans = 25},
22344{fin = [(N 433),(N 472)], trans = 166},
22345{fin = [(N 66),(N 433)], trans = 25},
22346{fin = [(N 433)], trans = 168},
22347{fin = [(N 55),(N 433)], trans = 169},
22348{fin = [(N 433)], trans = 170},
22349{fin = [(N 433)], trans = 171},
22350{fin = [(N 433)], trans = 172},
22351{fin = [(N 63),(N 433)], trans = 25},
22352{fin = [(N 433)], trans = 174},
22353{fin = [(N 433)], trans = 175},
22354{fin = [(N 433)], trans = 176},
22355{fin = [(N 433)], trans = 177},
22356{fin = [(N 433)], trans = 178},
22357{fin = [(N 51),(N 433)], trans = 25},
22358{fin = [(N 436),(N 472)], trans = 7},
22359{fin = [(N 37),(N 472)], trans = 0},
22360{fin = [(N 35),(N 472)], trans = 0},
22361{fin = [(N 33),(N 472)], trans = 0},
22362{fin = [(N 28),(N 436),(N 472)], trans = 184},
22363{fin = [(N 31),(N 436)], trans = 7},
22364{fin = [(N 26),(N 472)], trans = 0},
22365{fin = [(N 21),(N 436),(N 472)], trans = 187},
22366{fin = [(N 24),(N 436)], trans = 7},
22367{fin = [(N 286),(N 289),(N 304),(N 472)], trans = 189},
22368{fin = [(N 289),(N 304)], trans = 189},
22369{fin = [(N 284),(N 304),(N 472)], trans = 191},
22370{fin = [], trans = 192},
22371{fin = [(N 304)], trans = 192},
22372{fin = [], trans = 194},
22373{fin = [], trans = 195},
22374{fin = [(N 314)], trans = 195},
22375{fin = [(N 314)], trans = 197},
22376{fin = [(N 304)], trans = 198},
22377{fin = [(N 472)], trans = 199},
22378{fin = [], trans = 200},
22379{fin = [(N 19)], trans = 0},
22380{fin = [(N 436),(N 472)], trans = 202},
22381{fin = [(N 15),(N 436)], trans = 7},
22382{fin = [(N 12),(N 472)], trans = 0},
22383{fin = [(N 10),(N 436),(N 472)], trans = 7},
22384{fin = [(N 8),(N 472)], trans = 0},
22385{fin = [(N 6),(N 472)], trans = 207},
22386{fin = [(N 458)], trans = 0},
22387{fin = [(N 428),(N 472)], trans = 209},
22388{fin = [(N 428)], trans = 209},
22389{fin = [(N 4),(N 436),(N 472)], trans = 211},
22390{fin = [], trans = 212},
22391{fin = [], trans = 213},
22392{fin = [], trans = 214},
22393{fin = [], trans = 215},
22394{fin = [], trans = 216},
22395{fin = [], trans = 217},
22396{fin = [], trans = 218},
22397{fin = [], trans = 219},
22398{fin = [], trans = 220},
22399{fin = [], trans = 221},
22400{fin = [(N 423)], trans = 0},
22401{fin = [(N 470),(N 472)], trans = 223},
22402{fin = [], trans = 223},
22403{fin = [], trans = 225},
22404{fin = [], trans = 226},
22405{fin = [], trans = 227},
22406{fin = [], trans = 228},
22407{fin = [], trans = 229},
22408{fin = [], trans = 230},
22409{fin = [], trans = 231},
22410{fin = [], trans = 232},
22411{fin = [], trans = 233},
22412{fin = [(N 382)], trans = 0},
22413{fin = [(N 2),(N 472)], trans = 235},
22414{fin = [(N 2)], trans = 235},
22415{fin = [(N 466)], trans = 0},
22416{fin = [(N 466)], trans = 238},
22417{fin = [(N 464)], trans = 0},
22418{fin = [(N 466)], trans = 240},
22419{fin = [(N 461)], trans = 0},
22420{fin = [(N 468)], trans = 0}])
22421end
22422structure StartStates =
22423 struct
22424 datatype yystartstate = STARTSTATE of int
22425
22426(* start state definitions *)
22427
22428val COMMENT = STARTSTATE 3;
22429val INITIAL = STARTSTATE 1;
22430
22431end
22432type result = UserDeclarations.lexresult
22433 exception LexerError (* raised if illegal leaf action tried *)
22434end
22435
22436type int = Int.int
22437fun makeLexer (yyinput: int -> string) =
22438let val yygone0:int=1
22439 val yyb = ref "\n" (* buffer *)
22440 val yybl: int ref = ref 1 (*buffer length *)
22441 val yybufpos: int ref = ref 1 (* location of next character to use *)
22442 val yygone: int ref = ref yygone0 (* position in file of beginning of buffer *)
22443 val yydone = ref false (* eof found yet? *)
22444 val yybegin: int ref = ref 1 (*Current 'start state' for lexer *)
22445
22446 val YYBEGIN = fn (Internal.StartStates.STARTSTATE x) =>
22447 yybegin := x
22448
22449fun lex () : Internal.result =
22450let fun continue() = lex() in
22451 let fun scan (s,AcceptingLeaves : Internal.yyfinstate list list,l,i0: int) =
22452 let fun action (i: int,nil) = raise LexError
22453 | action (i,nil::l) = action (i-1,l)
22454 | action (i,(node::acts)::l) =
22455 case node of
22456 Internal.N yyk =>
22457 (let fun yymktext() = String.substring(!yyb,i0,i-i0)
22458 val yypos: int = i0+ !yygone
22459 open UserDeclarations Internal.StartStates
22460 in (yybufpos := i; case yyk of
22461
22462 (* Application actions *)
22463
22464 10 => let val yytext=yymktext() in token(STAR, yypos, yytext) end
22465| 109 => let val yytext=yymktext() in token(EXCEPTION, yypos, yytext) end
22466| 112 => let val yytext=yymktext() in token(FN, yypos, yytext) end
22467| 116 => let val yytext=yymktext() in token(FUN, yypos, yytext) end
22468| 12 => let val yytext=yymktext() in token(COMMA, yypos, yytext) end
22469| 124 => let val yytext=yymktext() in token(FUNCTOR, yypos, yytext) end
22470| 131 => let val yytext=yymktext() in token(HANDLE, yypos, yytext) end
22471| 134 => let val yytext=yymktext() in token(IF, yypos, yytext) end
22472| 137 => let val yytext=yymktext() in token(IN, yypos, yytext) end
22473| 145 => let val yytext=yymktext() in token(INCLUDE, yypos, yytext) end
22474| 15 => let val yytext=yymktext() in token(ARROW, yypos, yytext) end
22475| 151 => let val yytext=yymktext() in token(INFIX, yypos, yytext) end
22476| 158 => let val yytext=yymktext() in token(INFIXR, yypos, yytext) end
22477| 162 => let val yytext=yymktext() in token(LET, yypos, yytext) end
22478| 168 => let val yytext=yymktext() in token(LOCAL, yypos, yytext) end
22479| 175 => let val yytext=yymktext() in token(NONFIX, yypos, yytext) end
22480| 178 => let val yytext=yymktext() in token(OF, yypos, yytext) end
22481| 181 => let val yytext=yymktext() in token(OP, yypos, yytext) end
22482| 186 => let val yytext=yymktext() in token(OPEN, yypos, yytext) end
22483| 19 => let val yytext=yymktext() in token(DOTS, yypos, yytext) end
22484| 193 => let val yytext=yymktext() in token(ORELSE, yypos, yytext) end
22485| 199 => let val yytext=yymktext() in token(RAISE, yypos, yytext) end
22486| 2 => ( continue() )
22487| 203 => let val yytext=yymktext() in token(REC, yypos, yytext) end
22488| 21 => let val yytext=yymktext() in token(COLON, yypos, yytext) end
22489| 211 => let val yytext=yymktext() in token(SHARING, yypos, yytext) end
22490| 215 => let val yytext=yymktext() in token(SIG, yypos, yytext) end
22491| 225 => let val yytext=yymktext() in token(SIGNATURE, yypos, yytext) end
22492| 232 => let val yytext=yymktext() in token(STRUCT, yypos, yytext) end
22493| 24 => let val yytext=yymktext() in token(COLONGREATER, yypos, yytext) end
22494| 242 => let val yytext=yymktext() in token(STRUCTURE, yypos, yytext) end
22495| 247 => let val yytext=yymktext() in token(THEN, yypos, yytext) end
22496| 252 => let val yytext=yymktext() in token(TYPE, yypos, yytext) end
22497| 256 => let val yytext=yymktext() in token(VAL, yypos, yytext) end
22498| 26 => let val yytext=yymktext() in token(SEMICOLON, yypos, yytext) end
22499| 262 => let val yytext=yymktext() in token(WHERE, yypos, yytext) end
22500| 268 => let val yytext=yymktext() in token(WHILE, yypos, yytext) end
22501| 273 => let val yytext=yymktext() in token(WITH, yypos, yytext) end
22502| 28 => let val yytext=yymktext() in token(EQUALS, yypos, yytext) end
22503| 282 => let val yytext=yymktext() in token(WITHTYPE, yypos, yytext) end
22504| 284 => let val yytext=yymktext() in token (ZERO, yypos, yytext) end
22505| 286 => let val yytext=yymktext() in tokenOf(DIGIT, toInt, yypos, yytext) end
22506| 289 => let val yytext=yymktext() in tokenOf(NUMERIC, toInt, yypos, yytext) end
22507| 304 => let val yytext=yymktext() in tokenOf(INT, toInt, yypos, yytext) end
22508| 31 => let val yytext=yymktext() in token(DARROW, yypos, yytext) end
22509| 314 => let val yytext=yymktext() in tokenOf(WORD, toWord, yypos, yytext) end
22510| 33 => let val yytext=yymktext() in token(LBRACK, yypos, yytext) end
22511| 342 => let val yytext=yymktext() in tokenOf(REAL, toReal, yypos, yytext) end
22512| 35 => let val yytext=yymktext() in token(RBRACK, yypos, yytext) end
22513| 37 => let val yytext=yymktext() in token(UNDERBAR, yypos, yytext) end
22514| 382 => let val yytext=yymktext() in tokenOf(STRING, toString, yypos, yytext) end
22515| 39 => let val yytext=yymktext() in token(LBRACE, yypos, yytext) end
22516| 4 => let val yytext=yymktext() in token(HASH, yypos, yytext) end
22517| 41 => let val yytext=yymktext() in token(BAR, yypos, yytext) end
22518| 423 => let val yytext=yymktext() in tokenOf(CHAR, toChar, yypos, yytext) end
22519| 428 => let val yytext=yymktext() in tokenOf(TYVAR, toId, yypos, yytext) end
22520| 43 => let val yytext=yymktext() in token(RBRACE, yypos, yytext) end
22521| 433 => let val yytext=yymktext() in tokenOf(ALPHA, toId, yypos, yytext) end
22522| 436 => let val yytext=yymktext() in tokenOf(SYMBOL, toId, yypos, yytext) end
22523| 455 => let val yytext=yymktext() in tokenOf(LONGID, toLongId, yypos, yytext) end
22524| 458 => ( nesting := 1 ; YYBEGIN COMMENT ; continue() )
22525| 461 => ( nesting := !nesting+1 ; continue() )
22526| 464 => ( nesting := !nesting-1 ;
22527 if !nesting = 0 then YYBEGIN INITIAL else () ;
22528 continue() )
22529| 466 => ( continue() )
22530| 468 => ( continue() )
22531| 470 => let val yytext=yymktext() in error(yypos, yytext, "invalid string") end
22532| 472 => let val yytext=yymktext() in invalid(yypos, yytext) end
22533| 51 => let val yytext=yymktext() in token(ABSTYPE, yypos, yytext) end
22534| 55 => let val yytext=yymktext() in token(AND, yypos, yytext) end
22535| 6 => let val yytext=yymktext() in token(LPAR, yypos, yytext) end
22536| 63 => let val yytext=yymktext() in token(ANDALSO, yypos, yytext) end
22537| 66 => let val yytext=yymktext() in token(AS, yypos, yytext) end
22538| 71 => let val yytext=yymktext() in token(CASE, yypos, yytext) end
22539| 8 => let val yytext=yymktext() in token(RPAR, yypos, yytext) end
22540| 80 => let val yytext=yymktext() in token(DATATYPE, yypos, yytext) end
22541| 83 => let val yytext=yymktext() in token(DO, yypos, yytext) end
22542| 88 => let val yytext=yymktext() in token(ELSE, yypos, yytext) end
22543| 92 => let val yytext=yymktext() in token(END, yypos, yytext) end
22544| 99 => let val yytext=yymktext() in token(EQTYPE, yypos, yytext) end
22545| _ => raise Internal.LexerError
22546
22547 ) end )
22548
22549 val {fin,trans} = Vector.sub(Internal.tab, s)
22550 val NewAcceptingLeaves = fin::AcceptingLeaves
22551 in if l = !yybl then
22552 if trans = #trans(Vector.sub(Internal.tab,0))
22553 then action(l,NewAcceptingLeaves
22554) else let val newchars= if !yydone then "" else yyinput 1024
22555 in if (String.size newchars)=0
22556 then (yydone := true;
22557 if (l=i0) then UserDeclarations.eof ()
22558 else action(l,NewAcceptingLeaves))
22559 else (if i0=l then yyb := newchars
22560 else yyb := String.substring(!yyb,i0,l-i0)^newchars;
22561 yygone := !yygone+i0;
22562 yybl := String.size (!yyb);
22563 scan (s,AcceptingLeaves,l-i0,0))
22564 end
22565 else let val NewChar = Char.ord(CharVector.sub(!yyb,l))
22566 val NewState = Char.ord(CharVector.sub(trans,NewChar))
22567 in if NewState=0 then action(l,NewAcceptingLeaves)
22568 else scan(NewState,NewAcceptingLeaves,l+1,i0)
22569 end
22570 end
22571(*
22572 val start= if String.substring(!yyb,!yybufpos-1,1)="\n"
22573then !yybegin+1 else !yybegin
22574*)
22575 in scan(!yybegin (* start *),nil,!yybufpos,!yybufpos)
22576 end
22577end
22578 in lex
22579 end
22580end
22581(* stop of Lexer.lex.sml *)
22582(* start of PARSE.sml *)
22583signature PARSE =
22584 sig
22585
22586 (* Import *)
22587
22588 type source = Source.source
22589 type InfEnv = Infix.InfEnv
22590 type Program = GrammarProgram.Program
22591
22592
22593 (* Export *)
22594
22595 val parse: InfEnv * source -> InfEnv * Program
22596
22597 end
22598(* stop of PARSE.sml *)
22599(* start of Parse.sml *)
22600structure Parse :> PARSE =
22601 struct
22602
22603 (* Import *)
22604
22605 type source = Source.source
22606 type InfEnv = Infix.InfEnv
22607 type Program = GrammarProgram.Program
22608
22609
22610 (* Build Yacc parser *)
22611
22612 structure LrVals = LrValsFn(structure Token = LrParser.Token)
22613 structure Lexer = LexerFn (structure Tokens = LrVals.Tokens)
22614 structure Parser = Join (structure LrParser = LrParser
22615 structure ParserData = LrVals.ParserData
22616 structure Lex = Lexer)
22617
22618
22619 (* The actual parsing function *)
22620
22621 fun parse(J, source) =
22622 let
22623 val yyread = ref false
22624 fun yyinput _ =
22625 if !yyread then
22626 ""
22627 else
22628 ( yyread := true; source )
22629
22630 val lexer = Parser.makeLexer yyinput
22631
22632 fun onError(s, pos1, pos2) = Error.error((pos1,pos2), s)
22633
22634 val ((program,J'), lexer') = Parser.parse(0, lexer, onError, J)
22635 in
22636 (J',program)
22637 end
22638
22639 end
22640(* stop of Parse.sml *)
22641(* start of SML.sml *)
22642(*
22643 * Standard ML implementation main structure
22644 *)
22645
22646signature SML =
22647 sig
22648
22649 val parseString: string -> unit (* Parse only *)
22650 val elabString: string -> unit (* Parse and elaborate *)
22651 val evalString: string -> unit (* Parse and evaluate *)
22652 val execString: string -> unit (* Parse, elaborate, and evaluate *)
22653
22654 val parseFile: string -> unit
22655 val elabFile: string -> unit
22656 val evalFile: string -> unit
22657 val execFile: string -> unit
22658
22659 val parseFiles: string -> unit
22660 val elabFiles: string -> unit
22661 val evalFiles: string -> unit
22662 val execFiles: string -> unit
22663
22664 val parseSession: unit -> unit
22665 val elabSession: unit -> unit
22666 val evalSession: unit -> unit
22667 val execSession: unit -> unit
22668
22669 end
22670(* stop of SML.sml *)
22671(* start of Sml.sml *)
22672(*
22673 * Standard ML implementation main structure
22674 *)
22675
22676structure Sml :> SML =
22677 struct
22678
22679 (* Initial arguments *)
22680
22681 val J0 = InitialInfixEnv.J0
22682 val B_STAT0 = InitialStaticBasis.B0
22683 val B_DYN0 = InitialDynamicBasis.B0
22684 val B0 = (B_STAT0, B_DYN0)
22685 val s0 = InitialDynamicBasis.s
22686
22687
22688 (* Parsing only *)
22689
22690 fun parse J source =
22691 let
22692 val (J',program) = Parse.parse(J, source)
22693 val _ = TextIO.output(TextIO.stdOut, "OK\n")
22694 in
22695 J'
22696 end
22697
22698 val parseInitialArg = J0
22699 val parseInitial = parse parseInitialArg
22700
22701
22702 (* Parsing and elaboration *)
22703
22704 val elabInitialArg = (J0, B_STAT0)
22705
22706 fun elab (J, B_STAT) source =
22707 let
22708 val (J',program) = Parse.parse(J, source)
22709 val B_STAT' = Program.elabProgram(B_STAT, program)
22710 in
22711 (J', B_STAT')
22712 end
22713
22714
22715 (* Parsing and evaluation *)
22716
22717 val evalInitialArg = (J0, B_DYN0, s0)
22718
22719 fun eval (J, B_DYN, s) source =
22720 let
22721 val (J',program) = Parse.parse(J, source)
22722 val s' = ref s
22723 val B_DYN' = Program.evalProgram(s', B_DYN, program)
22724 in
22725 (J', B_DYN', !s')
22726 end
22727
22728
22729 (* Parsing, elaboration, and evaluation *)
22730
22731 val execInitialArg = (J0, B0, s0)
22732
22733 fun exec (J, B, s) source =
22734 let
22735 val (J',program) = Parse.parse(J, source)
22736 val s' = ref s
22737 val B' = Program.execProgram(s', B, program)
22738 in
22739 (J', B', !s' )
22740 end
22741
22742
22743 (* Processing of strings *)
22744
22745 fun processString (process, arg) source =
22746 ignore(process arg source)
22747 handle Error.Error _ => () (* Syntax error *)
22748
22749 val parseString = processString(parse, parseInitialArg)
22750 val elabString = processString(elab, elabInitialArg)
22751 val evalString = processString(eval, evalInitialArg)
22752 val execString = processString(exec, execInitialArg)
22753
22754
22755 (* Processing of files *)
22756
22757 fun processFile (process, arg) name =
22758 let
22759 val file = TextIO.openIn name
22760 val source = TextIO.inputAll file
22761 val _ = TextIO.closeIn file
22762 in
22763 ignore(process arg source)
22764 handle Error.Error _ => () (* Syntax error *)
22765 end
22766
22767 val parseFile = processFile(parse, parseInitialArg)
22768 val elabFile = processFile(elab, elabInitialArg)
22769 val evalFile = processFile(eval, evalInitialArg)
22770 val execFile = processFile(exec, execInitialArg)
22771
22772
22773 (* Processing several files mentioned in a list file *)
22774
22775 fun processFiles (process, initialArg) name =
22776 let
22777 val file = TextIO.openIn name
22778 val content = TextIO.inputAll file
22779 val _ = TextIO.closeIn file
22780
22781 val _ = Stamp.reset()
22782
22783 fun loop(arg, [] ) = ()
22784 | loop(arg, "" ::names) = loop(arg, names)
22785 | loop(arg, name::names) =
22786 let
22787 val file = TextIO.openIn name
22788 val source = TextIO.inputAll file
22789 val _ = TextIO.closeIn file
22790 val _ = TextIO.output(TextIO.stdOut,
22791 ">> File \"" ^ name ^ "\":\n")
22792 in
22793 loop(process arg source, names)
22794 handle Error.Error _ => (* Syntax error *)
22795 loop(arg, names)
22796 end
22797 in
22798 loop(initialArg, String.fields Char.isSpace content)
22799 end
22800
22801 val parseFiles = processFiles(parse, parseInitialArg)
22802 val elabFiles = processFiles(elab, elabInitialArg)
22803 val evalFiles = processFiles(eval, evalInitialArg)
22804 val execFiles = processFiles(exec, execInitialArg)
22805
22806
22807 (* Session *)
22808
22809 fun processSession(process, initialArg) =
22810 let
22811 val ins = !ins
22812 fun loop arg =
22813 let
22814 val _ = TextIO.output(TextIO.stdOut, "SML> ")
22815 val _ = TextIO.flushOut TextIO.stdOut
22816 in
22817 case TextIO.inputLine ins of
22818 NONE => ()
22819 | SOME source =>
22820 loop(process arg source)
22821 handle Error.Error _ => (* Syntax error *)
22822 loop arg
22823 end
22824 in
22825 loop initialArg
22826 end
22827
22828 fun parseSession() = processSession(parse, parseInitialArg)
22829 fun elabSession() = processSession(elab, elabInitialArg)
22830 fun evalSession() = processSession(eval, evalInitialArg)
22831 fun execSession() = processSession(exec, execInitialArg)
22832
22833 end
22834(* stop of Sml.sml *)
22835(* start of Main.sml *)
22836(*
22837 * Standard ML implementation stand-alone
22838 *)
22839
22840structure Main =
22841 struct
22842
22843 val version = "0.5"
22844
22845 fun usage() =
22846 ( TextIO.output(TextIO.stdErr,
22847 "Usage: hamlet -<mode>\n\
22848 \where <mode> is one of:\n\
22849 \ h help: print this message\n\
22850 \ p parse mode: just parse input\n\
22851 \ l elab mode: parse and elaborate\n\
22852 \ v eval mode: parse and evaluate (no type checking!)\n\
22853 \ x exec mode: parse, elaborate, and evaluate\n"
22854 )
22855 ; TextIO.flushOut TextIO.stdErr
22856 ; OS.Process.failure
22857 )
22858
22859 fun start process =
22860 ( TextIO.output(TextIO.stdOut, "HaMLet " ^ version ^
22861 " - to be or not to be SML\n")
22862 ; TextIO.flushOut TextIO.stdOut
22863 ; process()
22864 ; TextIO.output(TextIO.stdOut, "\n")
22865 ; TextIO.flushOut TextIO.stdOut
22866 ; OS.Process.success
22867 )
22868
22869 fun main' ["-h"] = ( usage() ; OS.Process.success )
22870 | main' ["-p"] = start Sml.parseSession
22871 | main' ["-l"] = start Sml.elabSession
22872 | main' ["-v"] = start Sml.evalSession
22873 | main' ["-x"] = start Sml.execSession
22874 | main' _ = usage()
22875
22876 fun main() = OS.Process.exit(main'(CommandLine.arguments()))
22877
22878 end
22879(* stop of Main.sml *)
22880
22881(* Here begins the simple test case. *)
22882
22883structure Main =
22884 struct
22885 fun doit size =
22886 let
22887 open TextIO
22888 fun loop n =
22889 if n < 0
22890 then ()
22891 else
22892 let
22893 val _ = ins := openIn "DATA/hamlet-input.sml"
22894 val _ = Main.main' ["-x"]
22895 val _ = closeIn (!ins)
22896 in loop (n - 1)
22897 end
22898 in
22899 loop size
22900 end
22901 end