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/FLINT/flint/flint.sml
ViewVC logotype

Annotation of /sml/trunk/src/compiler/FLINT/flint/flint.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 16 - (view) (download)

1 : monnier 16 (* COPYRIGHT (c) 1997 YALE FLINT PROJECT *)
2 :     (* flint.sml *)
3 :    
4 :     structure FLINT : FLINT =
5 :     struct
6 :    
7 :     local structure A = Access (* should go away soon *)
8 :     structure LD = LtyDef
9 :     structure LB = LtyBasic
10 :     structure LV = LambdaVar
11 :     structure PO = PrimOp
12 :     structure S = Symbol
13 :     in
14 :    
15 :     type tkind = LD.tkind
16 :     type tyc = LD.tyc
17 :     type lty = LD.lty
18 :    
19 :     type tvar = LD.tvar
20 :     type lvar = LV.lvar
21 :    
22 :     type fflag = LD.fflag
23 :     type rflag = LD.rflag
24 :    
25 :     (** classifying various kinds of functions *)
26 :     datatype fkind
27 :     = FK_FCT
28 :     | FK_FUN of
29 :     {isrec : lty list option, (* is this function recursive ? *)
30 :     fixed : fflag, (* is calling convention fixed ? *)
31 :     known : bool, (* is this function known, default: false *)
32 :     inline: bool} (* is this inlinable, default: not isrec *)
33 :    
34 :     (** classifying various kinds of records *)
35 :     datatype rkind
36 :     = RK_VECTOR of tyc (* vector: all elements have same type *)
37 :     | RK_STRUCT (* module: elements may be polymorphic *)
38 :     | RK_TUPLE of rflag (* tuple: all elements are monomorphic *)
39 :    
40 :     (*
41 :     * dcon records the name of the constructor (for debugging), the
42 :     * corresponding conrep, and the flint type lty (which must be an
43 :     * arrow type).
44 :     *)
45 :     type dcon = S.symbol * A.conrep * lty
46 :    
47 :     (*
48 :     * con: used to specify all possible switching statements. Efficient switch
49 :     * generation can be applied to DATAcon and INTcon. Otherwise, the switch is
50 :     * just a short-hand of the binary branch trees. Some of these instances
51 :     * such as REALcon and VLENcon will go away soon.
52 :     *)
53 :     datatype con
54 :     = DATAcon of dcon * tyc list * lvar
55 :     | INTcon of int (* should use InfInf.int *)
56 :     | INT32con of Int32.int
57 :     | WORDcon of word
58 :     | WORD32con of Word32.word
59 :     | REALcon of string
60 :     | STRINGcon of string
61 :     | VLENcon of int
62 :    
63 :     (** simple values, including variables and static constants. *)
64 :     datatype value
65 :     = VAR of lvar
66 :     | INT of int (* should use InfInf.int *)
67 :     | INT32 of Int32.int
68 :     | WORD of word
69 :     | WORD32 of Word32.word
70 :     | REAL of string
71 :     | STRING of string
72 :    
73 :     (** the definitions of the lambda expressions *)
74 :     datatype lexp
75 :     = RET of value list
76 :     | LET of lvar list * lexp * lexp
77 :    
78 :     | FIX of fundec list * lexp
79 :     | APP of value * value list
80 :    
81 :     | TFN of tfundec * lexp
82 :     | TAPP of value * tyc list
83 :    
84 :     | SWITCH of value * A.consig * (con * lexp) list * lexp option
85 :     | CON of dcon * tyc list * value * lvar * lexp
86 :    
87 :     | RECORD of rkind * value list * lvar * lexp
88 :     | SELECT of value * int * lvar * lexp (* add rkind ? *)
89 :    
90 :     | RAISE of value * lty list
91 :     | HANDLE of lexp * value
92 :    
93 :     | BRANCH of primop * value list * lexp * lexp
94 :     | PRIMOP of primop * value list * lvar * lexp
95 :    
96 :     withtype fundec = fkind * lvar * (lvar * lty) list * lexp
97 :     and tfundec = lvar * (tvar * tkind) list * lexp
98 :     and dict = {default: lvar, table: (tyc list * lvar) list}
99 :     and primop = dict option * PO.primop * lty * tyc list
100 :     (* Invariant: primop's lty is always fully closed *)
101 :    
102 :     type prog = fundec (* was "lvar * lty * lexp" *)
103 :    
104 :     end (* local *)
105 :     end (* structure FLINT *)

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