Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Annotation of /branches/pure-cfg/src/compiler/parser/parse-tree.sml
ViewVC logotype

Annotation of /branches/pure-cfg/src/compiler/parser/parse-tree.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 822 - (view) (download)

1 : jhr 25 (* parse-tree.sml
2 :     *
3 : jhr 435 * COPYRIGHT (c) 2010 The Diderot Project (http://diderot-language.cs.uchicago.edu)
4 : jhr 25 * All rights reserved.
5 :     *
6 :     * Diderot parse-tree representation.
7 :     *)
8 :    
9 :     structure ParseTree =
10 :     struct
11 :    
12 : jhr 27 type 'a mark = 'a Error.mark
13 :    
14 : jhr 25 type var = Atom.atom
15 :     type dim = IntInf.int
16 :    
17 :     datatype program
18 : jhr 81 = Program of decl list mark
19 : jhr 25
20 :     and decl
21 :     = D_Mark of decl mark
22 : jhr 27 | D_Input of ty * var * expr option (* input variable decl with optional default *)
23 :     | D_Var of var_decl (* global variable decl *)
24 : jhr 499 | D_Strand of { (* strand decl *)
25 : jhr 27 name : var,
26 :     params : param list,
27 : jhr 164 state : (bool * var_decl) list, (* state variables; true means output *)
28 : jhr 27 methods : method list
29 :     }
30 : jhr 40 | D_InitialArray of create * iter list
31 :     | D_InitialCollection of create * iter list
32 : jhr 25
33 : jhr 30 and param
34 :     = P_Mark of param mark
35 :     | P_Param of ty * var
36 :    
37 : jhr 25 and ty
38 :     = T_Mark of ty mark
39 :     | T_Bool
40 :     | T_Int
41 :     | T_Real
42 :     | T_String
43 :     | T_Vec of dim
44 : jhr 26 | T_Kernel of dim
45 : jhr 70 | T_Field of {diff : dim, dim : dim, shape : dim list}
46 : jhr 26 | T_Tensor of dim list
47 : jhr 70 | T_Image of {dim : dim, shape : dim list}
48 : jhr 691 | T_Seq of ty * dim
49 : jhr 25
50 : jhr 27 and var_decl
51 :     = VD_Mark of var_decl mark
52 :     | VD_Decl of ty * var * expr
53 :    
54 : jhr 30 and method
55 :     = M_Mark of method mark
56 :     | M_Method of var * stmt
57 :    
58 : jhr 40 and create
59 :     = C_Mark of create mark
60 :     | C_Create of (var * expr list)
61 :    
62 :     and iter
63 :     = I_Mark of iter mark
64 :     | I_Range of var * expr * expr
65 :    
66 : jhr 25 and stmt
67 : jhr 27 = S_Mark of stmt mark
68 :     | S_Block of stmt list
69 :     | S_Decl of var_decl
70 :     | S_IfThen of expr * stmt
71 :     | S_IfThenElse of expr * stmt * stmt
72 :     | S_Assign of var * expr
73 :     | S_New of var * expr list
74 :     | S_Die
75 :     | S_Stabilize
76 : jhr 25
77 :     and expr
78 :     = E_Mark of expr mark
79 :     | E_Var of var
80 : jhr 27 | E_Lit of Literal.literal
81 : jhr 78 | E_OrElse of expr * expr
82 :     | E_AndAlso of expr * expr
83 : jhr 370 | E_Cond of expr * expr * expr (* e1 'if' e2 'else' e3 *)
84 : jhr 25 | E_BinOp of expr * var * expr
85 : jhr 27 | E_UnaryOp of var * expr
86 : jhr 685 | E_Slice of expr * expr option list (* tensor slicing *)
87 : jhr 691 | E_Subscript of expr * expr (* e "{" e' "}" -- sequence subscripting *)
88 : jhr 35 | E_Apply of var * expr list
89 : jhr 691 | E_Tuple of expr list (* tuple construction (not used yet) *)
90 :     | E_Sequence of expr list (* sequence construction *)
91 :     | E_Cons of expr list (* tensor construction *)
92 :     | E_Real of expr (* int to real conversion *)
93 : jhr 822 | E_Id of dim (* identity matrix *)
94 :     | E_Zero of dim list (* zero tensor *)
95 : jhr 25
96 :     end

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