dd82e7c86f8a711107018e2e0f05f4086a3fcd44
[Faustine.git] / interpretor / types.ml
1
2 type index = int;;
3
4 type time = int;;
5
6 type basic = N of int
7 | R of float
8 | Vec of vector
9 | Zero
10 | Error
11 and vector = < size : int; nth : (index -> basic) >;;
12
13 class type vector_type =
14 object
15 method size : int
16 method nth : index -> basic
17 end;;
18
19 class type value_type =
20 object
21 method get : basic
22 method to_int : int
23 method to_float : float
24 method to_float_array : float array
25 method of_float_array : float array -> value_type
26 method to_string : string
27 method normalize : unit
28 method add : value_type -> value_type
29 method neg : value_type
30 method sub : value_type -> value_type
31 method mul : value_type -> value_type
32 method recip : value_type
33 method div : value_type -> value_type
34 method power : value_type -> value_type
35 method _and : value_type -> value_type
36 method _or : value_type -> value_type
37 method _xor : value_type -> value_type
38 method zero : value_type
39 method floor : value_type
40 method ceil : value_type
41 method rint : value_type
42 method int : value_type
43 method float : value_type
44 method sin : value_type
45 method asin : value_type
46 method cos : value_type
47 method acos : value_type
48 method tan : value_type
49 method atan : value_type
50 method atan2 : value_type -> value_type
51 method exp : value_type
52 method sqrt : value_type
53 method ln : value_type
54 method lg : value_type
55 method abs : value_type
56 method fmod : value_type -> value_type
57 method _mod : value_type -> value_type
58 method remainder : value_type -> value_type
59 method gt : value_type -> value_type
60 method lt : value_type -> value_type
61 method geq : value_type -> value_type
62 method leq : value_type -> value_type
63 method eq : value_type -> value_type
64 method neq : value_type -> value_type
65 method shl : value_type -> value_type
66 method shr : value_type -> value_type
67 method max : value_type -> value_type
68 method min : value_type -> value_type
69 end;;
70
71
72 type symbol = Add
73 | Sub
74 | Mul
75 | Div
76 | Power
77 | Pass
78 | Stop
79 | And
80 | Or
81 | Xor
82 | Mem
83 | Delay
84 | Floor
85 | Ceil
86 | Rint
87 | Int
88 | Float
89 | Sin
90 | Asin
91 | Cos
92 | Acos
93 | Tan
94 | Atan
95 | Atan2
96 | Exp
97 | Sqrt
98 | Ln
99 | Lg
100 | Abs
101 | Fmod
102 | Mod
103 | Remainder
104 | Vectorize
105 | Vconcat
106 | Vpick
107 | Serialize
108 | Gt
109 | Lt
110 | Geq
111 | Leq
112 | Eq
113 | Neq
114 | Shl
115 | Shr
116 | Max
117 | Min
118 | Prefix
119 | Select2
120 | Select3
121 | Rdtable
122 | Rwtable
123
124 type faust_exp =
125 Const of basic
126 | Ident of symbol
127 | Par of faust_exp * faust_exp
128 | Seq of faust_exp * faust_exp
129 | Rec of faust_exp * faust_exp
130 | Split of faust_exp * faust_exp
131 | Merge of faust_exp * faust_exp
132
133
134 class type rate_type =
135 object
136 method to_int : int
137 method to_float : float
138 method to_string : string
139 method num : int
140 method denom : int
141 method equal : rate_type -> bool
142 method mul : int -> rate_type
143 method div : int -> rate_type
144 end
145
146 class type signal_type =
147 object
148 method frequency : rate_type
149 method at : time -> value_type
150 method add_memory : int -> unit
151 method add : signal_type -> signal_type
152 method neg : signal_type
153 method sub : signal_type -> signal_type
154 method mul : signal_type -> signal_type
155 method div : signal_type -> signal_type
156 method power : signal_type -> signal_type
157 method _and : signal_type -> signal_type
158 method _or : signal_type -> signal_type
159 method _xor : signal_type -> signal_type
160 method delay : signal_type -> signal_type
161 method mem : signal_type
162 method vectorize : signal_type -> signal_type
163 method serialize : signal_type
164 method vconcat : signal_type -> signal_type
165 method vpick : signal_type -> signal_type
166 method floor : signal_type
167 method ceil : signal_type
168 method rint : signal_type
169 method int : signal_type
170 method float : signal_type
171 method sin : signal_type
172 method asin : signal_type
173 method cos : signal_type
174 method acos : signal_type
175 method tan : signal_type
176 method atan : signal_type
177 method atan2 : signal_type -> signal_type
178 method exp : signal_type
179 method sqrt : signal_type
180 method ln : signal_type
181 method lg : signal_type
182 method abs : signal_type
183 method fmod : signal_type -> signal_type
184 method _mod : signal_type -> signal_type
185 method remainder : signal_type -> signal_type
186 method gt : signal_type -> signal_type
187 method lt : signal_type -> signal_type
188 method geq : signal_type -> signal_type
189 method leq : signal_type -> signal_type
190 method eq : signal_type -> signal_type
191 method neq : signal_type -> signal_type
192 method shl : signal_type -> signal_type
193 method shr : signal_type -> signal_type
194 method max : signal_type -> signal_type
195 method min : signal_type -> signal_type
196 method rdtable : signal_type -> signal_type -> signal_type
197 method rwtable : signal_type -> signal_type ->
198 signal_type -> signal_type -> signal_type
199 method select2 : signal_type -> signal_type -> signal_type
200 method select3 : signal_type -> signal_type -> signal_type -> signal_type
201 method prefix : signal_type -> signal_type
202 end;;
203
204 type matrix = float array array;;
205
206 type data = float array array array;;
207
208 class type beam_type =
209 object
210 method get : signal_type array
211 method width : int
212 method sub : int -> int -> beam_type
213 method cut : int -> beam_type * beam_type
214 method append : beam_type -> beam_type
215 method matching : int -> beam_type
216 method at : time -> value_type array
217 method output : int -> data
218 method frequency : rate_type array
219 end;;
220
221
222 class type dimension_type =
223 object
224 method input : int
225 method output : int
226 method par : dimension_type -> dimension_type
227 method seq : dimension_type -> dimension_type
228 method split : dimension_type -> dimension_type
229 method merge : dimension_type -> dimension_type
230 method _rec : dimension_type -> dimension_type
231 end;;
232
233
234 class type process_type =
235 object
236 method exp : faust_exp
237 method dim : dimension_type
238 method delay : int
239 method eval : beam_type -> beam_type
240 end;;
241
242
243 class type io_type =
244 object
245 method set : string -> string -> unit
246 method read : string array -> beam_type
247 method write : rate_type array -> data -> string array
248 end;;