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 3349 - (view) (download)

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

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