17dea675c95c010ea17f79c9401da38ba4e11a4f
[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 zero : value_type
35 method floor : value_type
36 method int : value_type
37 method sin : value_type
38 method cos : value_type
39 method atan : value_type
40 method sqrt : value_type
41 method atan2 : value_type -> value_type
42 method _mod : value_type -> value_type
43 method larger : value_type -> value_type
44 method smaller : value_type -> value_type
45 end;;
46
47
48 type symbol = Add
49 | Sub
50 | Mul
51 | Div
52 | Pass
53 | Stop
54 | Mem
55 | Delay
56 | Floor
57 | Int
58 | Sin
59 | Cos
60 | Atan
61 | Atan2
62 | Sqrt
63 | Rdtable
64 | Mod
65 | Vectorize
66 | Vconcat
67 | Vpick
68 | Serialize
69 | Larger
70 | Smaller
71 | Prefix
72 | Select2
73 | Select3
74
75
76 type faust_exp =
77 Const of basic
78 | Ident of symbol
79 | Par of faust_exp * faust_exp
80 | Seq of faust_exp * faust_exp
81 | Rec of faust_exp * faust_exp
82 | Split of faust_exp * faust_exp
83 | Merge of faust_exp * faust_exp
84
85
86 class type signal_type =
87 object
88 method frequency : int
89 method at : time -> value_type
90 method add_memory : int -> unit
91 method add : signal_type -> signal_type
92 method neg : signal_type
93 method sub : signal_type -> signal_type
94 method mul : signal_type -> signal_type
95 method div : signal_type -> signal_type
96 method delay : signal_type -> signal_type
97 method mem : signal_type
98 method vectorize : signal_type -> signal_type
99 method serialize : signal_type
100 method vconcat : signal_type -> signal_type
101 method vpick : signal_type -> signal_type
102 method floor : signal_type
103 method int : signal_type
104 method sin : signal_type
105 method cos : signal_type
106 method atan : signal_type
107 method atan2 : signal_type -> signal_type
108 method sqrt : signal_type
109 method _mod : signal_type -> signal_type
110 method larger : signal_type -> signal_type
111 method smaller : signal_type -> signal_type
112 method rdtable : signal_type -> signal_type -> signal_type
113 method select2 : signal_type -> signal_type -> signal_type
114 method select3 : signal_type -> signal_type -> signal_type -> signal_type
115 method prefix : signal_type -> signal_type
116 end;;
117
118
119 class type beam_type =
120 object
121 method get : signal_type array
122 method width : int
123 method sub : int -> int -> beam_type
124 method cut : int -> beam_type * beam_type
125 method append : beam_type -> beam_type
126 method matching : int -> beam_type
127 method at : time -> value_type array
128 method output : int -> float array array array
129 method frequency : int array
130 end;;
131
132
133 class type dimension_type =
134 object
135 method input : int
136 method output : int
137 method par : dimension_type -> dimension_type
138 method seq : dimension_type -> dimension_type
139 method split : dimension_type -> dimension_type
140 method merge : dimension_type -> dimension_type
141 method _rec : dimension_type -> dimension_type
142 end;;
143
144
145 class type process_type =
146 object
147 method exp : faust_exp
148 method dim : dimension_type
149 method delay : int
150 method eval : beam_type -> beam_type
151 end;;
152
153
154 class type io_type =
155 object
156 method read : string array -> beam_type
157 method write : int array -> float array array array -> string array
158 end;;