OOP initial commit with new traces.
[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 to_string : string
26 method normalize : unit
27 method add : value_type -> value_type
28 method neg : value_type
29 method sub : value_type -> value_type
30 method mul : value_type -> value_type
31 method recip : value_type
32 method div : value_type -> value_type
33 method zero : value_type
34 method floor : value_type
35 method int : value_type
36 method sin : value_type
37 method cos : value_type
38 method atan : value_type
39 method sqrt : value_type
40 method atan2 : value_type -> value_type
41 method _mod : value_type -> value_type
42 method larger : value_type -> value_type
43 method smaller : value_type -> value_type
44 end;;
45
46
47 type symbol = Add
48 | Sup
49 | Mul
50 | Div
51 | Pass
52 | Stop
53 | Mem
54 | Delay
55 | Floor
56 | Int
57 | Sin
58 | Cos
59 | Atan
60 | Atantwo
61 | Sqrt
62 | Rdtable
63 | Mod
64 | Vectorize
65 | Vconcat
66 | Vpick
67 | Serialize
68 | Larger
69 | Smaller
70 | Prefix
71 | Selecttwo
72 | Selectthree
73
74
75 type faust_exp =
76 Const of basic
77 | Ident of symbol
78 | Par of faust_exp * faust_exp
79 | Seq of faust_exp * faust_exp
80 | Rec of faust_exp * faust_exp
81 | Split of faust_exp * faust_exp
82 | Merge of faust_exp * faust_exp
83
84
85 class type signal_type =
86 object
87 method frequency : int
88 method at : time -> value_type
89 method add : signal_type -> signal_type
90 method neg : signal_type
91 method sub : signal_type -> signal_type
92 method mul : signal_type -> signal_type
93 method div : signal_type -> signal_type
94 method delay : signal_type -> signal_type
95 method mem : signal_type
96 method vectorize : signal_type -> signal_type
97 method serialize : signal_type
98 method vconcat : signal_type -> signal_type
99 method vpick : signal_type -> signal_type
100 method floor : signal_type
101 method int : signal_type
102 method sin : signal_type
103 method cos : signal_type
104 method atan : signal_type
105 method atan2 : signal_type -> signal_type
106 method sqrt : signal_type
107 method _mod : signal_type -> signal_type
108 method larger : signal_type -> signal_type
109 method smaller : signal_type -> signal_type
110 method rdtable : signal_type -> signal_type -> signal_type
111 method select2 : signal_type -> signal_type -> signal_type
112 method select3 : signal_type -> signal_type -> signal_type -> signal_type
113 method prefix : signal_type -> signal_type
114 end;;
115
116
117 class type beam_type =
118 object
119 method length : int
120 method sub : start: int -> length: int -> beam_type
121 method append : beam_type -> beam_type
122 method matching : size: int -> beam_type
123 method time : time -> basic list
124 method output : length: int -> (int list) * (float array list)
125 end;;
126
127
128 class type dimension_type =
129 object
130 method input : int
131 method output : int
132 end;;
133
134
135 class type expression_type =
136 object
137 method get_exp : faust_exp
138 method get_dim : dimension_type
139 method get_delay : int
140 method to_string : string
141 method evaluate : beam_type -> beam_type
142 end;;