Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Tracker SCM

SCM Repository

[smlnj] Diff of /sml/branches/SMLNJ/src/compiler/FLINT/flint/flint.sml
ViewVC logotype

Diff of /sml/branches/SMLNJ/src/compiler/FLINT/flint/flint.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 44, Sun Mar 22 20:10:57 1998 UTC revision 45, Sun Mar 22 20:11:09 1998 UTC
# Line 6  Line 6 
6    
7  local structure A  = Access   (* should go away soon *)  local structure A  = Access   (* should go away soon *)
8        structure LD = LtyDef        structure LD = LtyDef
9          structure LB = LtyBasic
10        structure LV = LambdaVar        structure LV = LambdaVar
11        structure PO = PrimOp        structure PO = PrimOp
12        structure S  = Symbol        structure S  = Symbol
# Line 14  Line 15 
15  type tkind = LD.tkind  type tkind = LD.tkind
16  type tyc = LD.tyc  type tyc = LD.tyc
17  type lty = LD.lty  type lty = LD.lty
18  type tvar = LV.lvar  
19    type tvar = LD.tvar
20  type lvar = LV.lvar  type lvar = LV.lvar
21    
22    type fflag = LD.fflag
23    type rflag = LD.rflag
24    
25  (** classifying various kinds of functions *)  (** classifying various kinds of functions *)
26  type fkind =  datatype fkind
27    {isrec : lty list option,    = FK_FCT
28     raw   : LD.rawflag,    | FK_FUN of
29     isfct : bool}        {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 *)  (** classifying various kinds of records *)
35  datatype rkind  datatype rkind
36    = RK_VECTOR of tyc  (* vector: all elements have same type *)    = RK_VECTOR of tyc  (* vector: all elements have same type *)
   | RK_RECORD         (* tuple: all elements are monomorphic *)  
37    | RK_STRUCT         (* module: elements may be polymorphic *)    | 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   * dcon records the name of the constructor (for debugging), the
42   * corresponding conrep, and the lambda type lty; the value carrying   * corresponding conrep, and the flint type lty (which must be an
43   * data constructors must have the arrow type.   * arrow type).
44   *)   *)
45  type dcon = S.symbol * A.conrep * lty  type dcon = S.symbol * A.conrep * lty
46    
# Line 40  Line 48 
48   * con: used to specify all possible switching statements. Efficient switch   * con: used to specify all possible switching statements. Efficient switch
49   * generation can be applied to DATAcon and INTcon. Otherwise, the switch is   * 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   * just a short-hand of the binary branch trees. Some of these instances
51   * such as REALcon probably should go away.   * such as REALcon and VLENcon will go away soon.
52   *)   *)
53  datatype con  datatype con
54    = DATAcon of dcon * tyc list * lvar list    = DATAcon of dcon * tyc list * lvar
55    | INTcon of int                          (* should use InfInf.int *)    | INTcon of int                          (* should use InfInf.int *)
56    | INT32con of Int32.int    | INT32con of Int32.int
57    | WORDcon of word    | WORDcon of word
# Line 74  Line 82 
82    | TAPP of value * tyc list    | TAPP of value * tyc list
83    
84    | SWITCH of value * A.consig * (con * lexp) list * lexp option    | SWITCH of value * A.consig * (con * lexp) list * lexp option
85    | CON of dcon * tyc list * value list * lvar * lexp    | CON of dcon * tyc list * value * lvar * lexp
86    
87    | RECORD of rkind * value list * lvar * lexp    | RECORD of rkind * value list * lvar * lexp
88    | SELECT of value * int * lvar * lexp          (* add rkind ? *)    | SELECT of value * int * lvar * lexp          (* add rkind ? *)
89    
90    | RAISE of value * lty list    | RAISE of value * lty list
91    | HANDLE of lexp * value    | HANDLE of lexp * value
   | ETAG of tyc * value * lvar * lexp  
92    
93      | BRANCH of primop * value list * lexp * lexp
94    | PRIMOP of primop * value list * lvar * lexp    | PRIMOP of primop * value list * lvar * lexp
   | GENOP of dict * primop * value list * lvar * lexp  
   
   | WRAP of tyc * value * lvar * lexp  
   | UNWRAP of tyc * value * lvar * lexp  
 (*  
  * | PACK of lty * tyc list * tyc list * value * lvar * lexp  
  * | BRANCH of primop * value list * lexp * lexp   (* comparison *)  
  * | ARITH of primop  * value list * lvar * lexp   (* arithmetic *)  
  * | SETTER of primop * value list * lexp          (* mutator *)  
  * | LOOKER of primop * value list * lvar * lexp   (* selector *)  
  * | PURE of primop * value list * lvar * lexp     (* constructor? *)  
  *)  
95    
96  withtype fundec = fkind * lvar * (lvar * lty) list * lexp  withtype fundec = fkind * lvar * (lvar * lty) list * lexp
97  and tfundec = lvar * (tvar * tkind) list * lexp  and tfundec = lvar * (tvar * tkind) list * lexp
 and primop = PO.primop * lty * tyc list  
98  and dict = {default: lvar, table: (tyc list * lvar) list}  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" *)  type prog = fundec                       (* was "lvar * lty * lexp" *)
103    
 (*  
  * TODO: 0. what can we expect from the use of "tvar" ?  
  *       1. organize the set of valid primops and primtycs  
  *       2. organize the set of standard constants and constructors  
  *       3. what is the std way of adding pre-defined GENOP ?  
  *       4. how to clean up pack, wrap, and unwrap ?  
  *       5. how to standardize the fkind and rkind ?  
  *       6. how to handle the wrappers in CON and DECON (SWITCH) ?  
  *       7. how to avoid the use of conrep ? what about exceptions ?  
  *)  
   
104  end (* local *)  end (* local *)
105  end (* structure FLINT *)  end (* structure FLINT *)

Legend:
Removed from v.44  
changed lines
  Added in v.45

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