68e550c523d81796f82d77c61f854edd3e33a791
[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 expo : value_type
52 method sqrt : value_type
53 method ln : value_type
54 method log10 : value_type
55 method fmod : value_type -> value_type
56 method _mod : value_type -> value_type
57 method remainder : value_type -> value_type
58 method greater : value_type -> value_type
59 method less : value_type -> value_type
60 method gore : value_type -> value_type
61 method lore : value_type -> value_type
62 method equal : value_type -> value_type
63 method different : value_type -> value_type
64 method max : value_type -> value_type
65 method min : value_type -> value_type
66 end;;
67
68
69 type symbol = Add
70 | Sub
71 | Mul
72 | Div
73 | Power
74 | Pass
75 | Stop
76 | And
77 | Or
78 | Xor
79 | Mem
80 | Delay
81 | Floor
82 | Ceil
83 | Rint
84 | Int
85 | Float
86 | Sin
87 | Asin
88 | Cos
89 | Acos
90 | Tan
91 | Atan
92 | Atan2
93 | Exp
94 | Sqrt
95 | Ln
96 | Log10
97 | Abs
98 | Fmod
99 | Mod
100 | Remainder
101 | Vectorize
102 | Vconcat
103 | Vpick
104 | Serialize
105 | Greater
106 | Less
107 | Gore
108 | Lore
109 | Equal
110 | Different
111 | Max
112 | Min
113 | Prefix
114 | Select2
115 | Select3
116 | Rdtable
117 | Rwtable
118
119 type faust_exp =
120 Const of basic
121 | Ident of symbol
122 | Par of faust_exp * faust_exp
123 | Seq of faust_exp * faust_exp
124 | Rec of faust_exp * faust_exp
125 | Split of faust_exp * faust_exp
126 | Merge of faust_exp * faust_exp
127
128
129 class type rate_type =
130 object
131 method to_int : int
132 method to_float : float
133 method to_string : string
134 method num : int
135 method denom : int
136 method equal : rate_type -> bool
137 method mul : int -> rate_type
138 method div : int -> rate_type
139 end
140
141 class type signal_type =
142 object
143 method frequency : rate_type
144 method at : time -> value_type
145 method add_memory : int -> unit
146 method add : signal_type -> signal_type
147 method neg : signal_type
148 method sub : signal_type -> signal_type
149 method mul : signal_type -> signal_type
150 method div : signal_type -> signal_type
151 method power : signal_type -> signal_type
152 method _and : signal_type -> signal_type
153 method _or : signal_type -> signal_type
154 method _xor : signal_type -> signal_type
155 method delay : signal_type -> signal_type
156 method mem : signal_type
157 method vectorize : signal_type -> signal_type
158 method serialize : signal_type
159 method vconcat : signal_type -> signal_type
160 method vpick : signal_type -> signal_type
161 method floor : signal_type
162 method ceil : signal_type
163 method rint : signal_type
164 method int : signal_type
165 method float : signal_type
166 method sin : signal_type
167 method asin : signal_type
168 method cos : signal_type
169 method acos : signal_type
170 method tan : signal_type
171 method atan : signal_type
172 method atan2 : signal_type -> signal_type
173 method expo : signal_type
174 method sqrt : signal_type
175 method ln : signal_type
176 method log10 : signal_type
177 method abs : signal_type
178 method fmod : signal_type -> signal_type
179 method _mod : signal_type -> signal_type
180 method remainder : signal_type -> signal_type
181 method greater : signal_type -> signal_type
182 method less : signal_type -> signal_type
183 method gore : signal_type -> signal_type
184 method lore : signal_type -> signal_type
185 method equal : signal_type -> signal_type
186 method different : signal_type -> signal_type
187 method max : signal_type -> signal_type
188 method min : signal_type -> signal_type
189 method rdtable : signal_type -> signal_type -> signal_type
190 method rwtable : signal_type -> signal_type ->
191 signal_type -> signal_type -> signal_type
192 method select2 : signal_type -> signal_type -> signal_type
193 method select3 : signal_type -> signal_type -> signal_type -> signal_type
194 method prefix : signal_type -> signal_type
195 end;;
196
197 type matrix = float array array;;
198
199 type data = float array array array;;
200
201 class type beam_type =
202 object
203 method get : signal_type array
204 method width : int
205 method sub : int -> int -> beam_type
206 method cut : int -> beam_type * beam_type
207 method append : beam_type -> beam_type
208 method matching : int -> beam_type
209 method at : time -> value_type array
210 method output : int -> data
211 method frequency : rate_type array
212 end;;
213
214
215 class type dimension_type =
216 object
217 method input : int
218 method output : int
219 method par : dimension_type -> dimension_type
220 method seq : dimension_type -> dimension_type
221 method split : dimension_type -> dimension_type
222 method merge : dimension_type -> dimension_type
223 method _rec : dimension_type -> dimension_type
224 end;;
225
226
227 class type process_type =
228 object
229 method exp : faust_exp
230 method dim : dimension_type
231 method delay : int
232 method eval : beam_type -> beam_type
233 end;;
234
235
236 class type io_type =
237 object
238 method set : string -> string -> unit
239 method read : string array -> beam_type
240 method write : rate_type array -> data -> string array
241 end;;