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 /sml/trunk/src/compiler/Semant/statenv/bindings.sml
ViewVC logotype

Annotation of /sml/trunk/src/compiler/Semant/statenv/bindings.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 587 - (view) (download)

1 : monnier 249 (* Copyright 1996 by AT&T Bell Laboratories *)
2 :     (* bindings.sml *)
3 :    
4 :     signature BINDINGS =
5 :     sig
6 :    
7 :     datatype binding
8 :     = VALbind of VarCon.var
9 :     | CONbind of VarCon.datacon
10 :     | TYCbind of Types.tycon
11 :     | SIGbind of Modules.Signature
12 :     | STRbind of Modules.Structure
13 :     | FSGbind of Modules.fctSig
14 :     | FCTbind of Modules.Functor
15 :     | FIXbind of Fixity.fixity
16 :    
17 :     val binderGt : (Symbol.symbol * binding) * (Symbol.symbol * binding) -> bool
18 :    
19 :     end (* signature BINDINGS *)
20 :    
21 :    
22 :     structure Bindings : BINDINGS =
23 :     struct
24 :    
25 :     local structure S = Symbol
26 :     structure T = Types
27 :     structure V = VarCon
28 :     structure M = Modules
29 :     in
30 :    
31 :     fun err s = ErrorMsg.impossible ("Bindings: "^s)
32 :    
33 :     datatype binding
34 :     = VALbind of V.var
35 :     | CONbind of V.datacon
36 :     | TYCbind of T.tycon
37 :     | SIGbind of M.Signature
38 :     | STRbind of M.Structure
39 :     | FSGbind of M.fctSig
40 :     | FCTbind of M.Functor
41 :     | FIXbind of Fixity.fixity
42 :    
43 :     (* used for statenv sorting in env/statenv.sml *)
44 : blume 587 fun binderGt ((s1, rb1), (s2, rb2)) = let
45 :     (* hopefully the following gets optimized into an identity function
46 :     * on tags... *)
47 :     fun bnum (VALbind _) = 0
48 :     | bnum (CONbind _) = 1
49 :     | bnum (TYCbind _) = 2
50 :     | bnum (SIGbind _) = 3
51 :     | bnum (STRbind _) = 4
52 :     | bnum (FSGbind _) = 5
53 :     | bnum (FCTbind _) = 6
54 :     | bnum (FIXbind _) = 7
55 :     in
56 :     case Int.compare (bnum rb1, bnum rb2) of
57 :     EQUAL => S.symbolGt (s1, s2)
58 :     | GREATER => true
59 :     | LESS => false
60 :     end
61 : monnier 249
62 :     end (* local *)
63 :     end (* structure Bindings *)

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