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.66/generic-ops.sml
ViewVC logotype

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2760 - (view) (download)

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 : blume 1011 val sgn : ('lib, 'env, 'sym, 'syms, 'export, 'misc) context
12 :     -> string
13 : blume 977 -> ('lib, 'env, 'sym, 'syms, 'export, 'misc) context * 'sym
14 : blume 1011 val str : ('lib, 'env, 'sym, 'syms, 'export, 'misc) context
15 :     -> string
16 :     -> ('lib, 'env, 'sym, 'syms, 'export, 'misc) context * 'sym
17 :     val fct : ('lib, 'env, 'sym, 'syms, 'export, 'misc) context
18 :     -> string
19 :     -> ('lib, 'env, 'sym, 'syms, 'export, 'misc) context * 'sym
20 : blume 977 val syms : ('lib, 'env, 'sym, 'syms, 'export, 'misc) context
21 :     -> 'sym list
22 :     -> ('lib, 'env, 'sym, 'syms, 'export, 'misc) context * 'syms
23 :     val import : ('lib, 'env, 'sym, 'syms, 'export, 'misc) context
24 :     -> 'lib -> 'syms
25 :     -> ('lib, 'env, 'sym, 'syms, 'export, 'misc) context * 'env
26 :     val compile : ('lib, 'env, 'sym, 'syms, 'export, 'misc) context
27 :     -> string -> 'env -> 'syms
28 :     -> ('lib, 'env, 'sym, 'syms, 'export, 'misc) context * 'env
29 :     val ncompile : ('lib, 'env, 'sym, 'syms, 'export, 'misc) context
30 :     -> string -> 'env -> 'syms
31 :     -> ('lib, 'env, 'sym, 'syms, 'export, 'misc) context * 'env
32 :     val merge : ('lib, 'env, 'sym, 'syms, 'export, 'misc) context
33 :     -> 'env list
34 :     -> ('lib, 'env, 'sym, 'syms, 'export, 'misc) context * 'env
35 :     val filter : ('lib, 'env, 'sym, 'syms, 'export, 'misc) context
36 :     -> 'env -> 'syms
37 :     -> ('lib, 'env, 'sym, 'syms, 'export, 'misc) context * 'env
38 :     val export : ('lib, 'env, 'sym, 'syms, 'export, 'misc) context
39 :     -> 'env
40 :     -> 'export
41 :     end
42 :    
43 :     structure PGOps : PG_OPS = struct
44 :    
45 :     type ('lib, 'env, 'sym, 'syms, 'export, 'misc) context =
46 : blume 1011 { Ops : { Sgn: 'misc -> string -> 'misc * 'sym,
47 :     Str: 'misc -> string -> 'misc * 'sym,
48 :     Fct: 'misc -> string -> 'misc * 'sym,
49 : blume 977 Imp: 'misc -> 'lib * 'syms -> 'misc * 'env,
50 :     Com: 'misc -> string * 'env * 'syms * bool -> 'misc * 'env,
51 :     Mer: 'misc -> 'env list -> 'misc * 'env,
52 :     Fil: 'misc -> 'env * 'syms -> 'misc * 'env,
53 :     Syms: 'misc -> 'sym list -> 'misc * 'syms,
54 :     Exp: 'misc -> 'env -> 'export },
55 :     Misc: 'misc }
56 :    
57 :     local
58 : blume 1011 fun generic { Ops = Ops as { Sgn, Str, Fct,
59 :     Imp, Com, Mer, Fil, Syms, Exp },
60 : blume 977 Misc }
61 :     sel args =
62 :     let val (Misc', res) = sel Ops Misc args
63 :     in ({ Ops = Ops, Misc = Misc' }, res)
64 :     end
65 :     in
66 : blume 1011 fun sgn c s = generic c #Sgn s
67 :     fun str c s = generic c #Str s
68 :     fun fct c s = generic c #Fct s
69 : blume 977 fun syms c sl = generic c #Syms sl
70 :     fun import c l ss = generic c #Imp (l, ss)
71 :     fun compile c s e ss = generic c #Com (s, e, ss, false)
72 :     fun ncompile c s e ss = generic c #Com (s, e, ss, true)
73 :     fun merge c el = generic c #Mer el
74 :     fun filter c e ss = generic c #Fil (e, ss)
75 : blume 1011 fun export { Ops = { Sgn, Str, Fct, Imp, Com, Mer, Fil, Syms, Exp },
76 :     Misc } e =
77 : blume 977 Exp Misc e
78 :     end
79 :     end

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