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

SCM Repository

[smlnj] Annotation of /pgraph/releases/release-110.64/generic-ops.sml
ViewVC logotype

Annotation of /pgraph/releases/release-110.64/generic-ops.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 977 - (view) (download)
Original Path: sml/trunk/src/cm/pgraph/generic-ops.sml

1 : blume 977 (* generic-ops.sml
2 :     *
3 :     * (C) 2001 Lucent Technologies, Bell Labs
4 :     *
5 :     * author: Matthias Blume (blume@research.bell-labs.com)
6 :     *)
7 :     signature PG_OPS = sig
8 :    
9 :     type ('lib, 'env, 'sym, 'syms, 'export, 'misc) context
10 :    
11 :     val sym : ('lib, 'env, 'sym, 'syms, 'export, 'misc) context
12 :     -> string -> string
13 :     -> ('lib, 'env, 'sym, 'syms, 'export, 'misc) context * 'sym
14 :     val syms : ('lib, 'env, 'sym, 'syms, 'export, 'misc) context
15 :     -> 'sym list
16 :     -> ('lib, 'env, 'sym, 'syms, 'export, 'misc) context * 'syms
17 :     val import : ('lib, 'env, 'sym, 'syms, 'export, 'misc) context
18 :     -> 'lib -> 'syms
19 :     -> ('lib, 'env, 'sym, 'syms, 'export, 'misc) context * 'env
20 :     val compile : ('lib, 'env, 'sym, 'syms, 'export, 'misc) context
21 :     -> string -> 'env -> 'syms
22 :     -> ('lib, 'env, 'sym, 'syms, 'export, 'misc) context * 'env
23 :     val ncompile : ('lib, 'env, 'sym, 'syms, 'export, 'misc) context
24 :     -> string -> 'env -> 'syms
25 :     -> ('lib, 'env, 'sym, 'syms, 'export, 'misc) context * 'env
26 :     val merge : ('lib, 'env, 'sym, 'syms, 'export, 'misc) context
27 :     -> 'env list
28 :     -> ('lib, 'env, 'sym, 'syms, 'export, 'misc) context * 'env
29 :     val filter : ('lib, 'env, 'sym, 'syms, 'export, 'misc) context
30 :     -> 'env -> 'syms
31 :     -> ('lib, 'env, 'sym, 'syms, 'export, 'misc) context * 'env
32 :     val export : ('lib, 'env, 'sym, 'syms, 'export, 'misc) context
33 :     -> 'env
34 :     -> 'export
35 :     end
36 :    
37 :     structure PGOps : PG_OPS = struct
38 :    
39 :     type ('lib, 'env, 'sym, 'syms, 'export, 'misc) context =
40 :     { Ops : { Sym: 'misc -> string * string -> 'misc * 'sym,
41 :     Imp: 'misc -> 'lib * 'syms -> 'misc * 'env,
42 :     Com: 'misc -> string * 'env * 'syms * bool -> 'misc * 'env,
43 :     Mer: 'misc -> 'env list -> 'misc * 'env,
44 :     Fil: 'misc -> 'env * 'syms -> 'misc * 'env,
45 :     Syms: 'misc -> 'sym list -> 'misc * 'syms,
46 :     Exp: 'misc -> 'env -> 'export },
47 :     Misc: 'misc }
48 :    
49 :     local
50 :     fun generic { Ops = Ops as { Sym, Imp, Com, Mer, Fil, Syms, Exp },
51 :     Misc }
52 :     sel args =
53 :     let val (Misc', res) = sel Ops Misc args
54 :     in ({ Ops = Ops, Misc = Misc' }, res)
55 :     end
56 :     in
57 :     fun sym c ns s = generic c #Sym (ns, s)
58 :     fun syms c sl = generic c #Syms sl
59 :     fun import c l ss = generic c #Imp (l, ss)
60 :     fun compile c s e ss = generic c #Com (s, e, ss, false)
61 :     fun ncompile c s e ss = generic c #Com (s, e, ss, true)
62 :     fun merge c el = generic c #Mer el
63 :     fun filter c e ss = generic c #Fil (e, ss)
64 :     fun export { Ops = { Sym, Imp, Com, Mer, Fil, Syms, Exp }, Misc } e =
65 :     Exp Misc e
66 :     end
67 :     end

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