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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 113 - (view) (download)
Original Path: sml/branches/SMLNJ/src/compiler/FLINT/plambda/plambda.sml

1 : monnier 16 (* COPYRIGHT (c) 1997 YALE FLINT PROJECT *)
2 :     (* plambda.sml *)
3 :    
4 :     structure PLambda : PLAMBDA =
5 :     struct
6 :    
7 :     local structure A = Access
8 :     structure LK = PLambdaType
9 :     structure LV = LambdaVar
10 :     structure PO = PrimOp
11 :     structure S = Symbol
12 :     in
13 :    
14 :     type tkind = LK.tkind
15 :     type tyc = LK.tyc
16 :     type lty = LK.lty
17 :    
18 :     type lvar = LV.lvar
19 :    
20 :     (*
21 :     * dataconstr records the name of the constructor, the corresponding conrep,
22 :     * and the lambda type lty; value carrying data constructors would have
23 :     * arrow type.
24 :     *)
25 :     type dataconstr = S.symbol * A.conrep * lty
26 :    
27 :     (*
28 :     * con: used to specify all possible switching statements. Efficient switch
29 :     * generation can be applied to DATAcon and INTcon. Otherwise, it is just a
30 :     * shorthand for binary branch trees. In the future, we probably should make
31 :     * it more general, including constants of any numerical types.
32 :     *)
33 :     datatype con
34 :     = DATAcon of dataconstr * tyc list * lvar
35 :     | INTcon of int
36 :     | INT32con of Int32.int
37 :     | WORDcon of word
38 :     | WORD32con of Word32.word
39 :     | REALcon of string
40 :     | STRINGcon of string
41 :     | VLENcon of int
42 :    
43 :     (*
44 :     * lexp: the universal typed intermediate language. TFN, TAPP is abstraction
45 :     * and application on type constructors. Structure abstractions and functor
46 :     * abstractions are represented as normal structure and functor definitions
47 :     * with its component properly PACKed. FN defines normal function, FIX defines
48 :     * a set of recursive functions, LET(v,e1,e2) is a syntactic sugar for exprs
49 :     * of forms like APP(FN(v,_,e2), e1); the type of v will be that of e1.
50 :     * APP is the function application. STRECD and STRSEL are structure record
51 :     * selection, VECTOR and VCTSEL are vector record and vector selection.
52 :     * ETAG, RAISE, and HANDLE are for exceptions.
53 :     *)
54 :     datatype lexp
55 :     = VAR of lvar
56 :     | INT of int
57 :     | INT32 of Int32.int
58 :     | WORD of word
59 :     | WORD32 of Word32.word
60 :     | REAL of string
61 :     | STRING of string
62 :     | PRIM of PO.primop * lty * tyc list
63 :     | GENOP of dict * PO.primop * lty * tyc list
64 :    
65 :     | FN of lvar * lty * lexp
66 :     | FIX of lvar list * lty list * lexp list * lexp
67 :     | APP of lexp * lexp
68 :     | LET of lvar * lexp * lexp
69 :    
70 :     | TFN of tkind list * lexp
71 :     | TAPP of lexp * tyc list
72 :    
73 :     | RAISE of lexp * lty
74 :     | HANDLE of lexp * lexp
75 :     | ETAG of lexp * lty
76 :    
77 :     | CON of dataconstr * tyc list * lexp
78 :     | SWITCH of lexp * A.consig * (con * lexp) list * lexp option
79 :    
80 :     | VECTOR of lexp list * tyc
81 :     | RECORD of lexp list
82 :     | SRECORD of lexp list
83 :     | SELECT of int * lexp
84 :    
85 :     | PACK of lty * tyc list * tyc list * lexp
86 :     | WRAP of tyc * bool * lexp
87 :     | UNWRAP of tyc * bool * lexp
88 :    
89 :     withtype dict = {default: lexp, table: (tyc list * lexp) list}
90 :    
91 :     end (* local *)
92 :     end (* structure PLambda *)
93 :    
94 : monnier 93
95 :     (*
96 : monnier 113 * $Log$
97 : monnier 93 *)

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