5c2c29d8707cb4e629500a37b37012dfd5adb413
[Faustine.git] / interpretor / types.ml
1 type value = N of int
2 | R of float
3 | Vec of int * (int -> value)
4 | Zero
5 | W
6
7 (** type symbol, defines valid identifiers in faust expressions.*)
8 type symbol = Add
9 | Sup
10 | Mul
11 | Div
12 | Pass
13 | Stop
14 | Mem
15 | Delay
16 | Floor
17 | Int
18 | Sin
19 | Cos
20 | Atan
21 | Atantwo
22 | Sqrt
23 | Rdtable
24 | Mod
25 | Vectorize
26 | Concat
27 | Nth
28 | Serialize
29 | Larger
30 | Smaller
31 | Prefix
32 | Selecttwo
33 | Selectthree
34
35 exception Symbol_not_defined;;
36
37 let symbol_of_string = fun s ->
38 match s with
39 |"+" -> Add
40 |"-" -> Sup
41 |"*" -> Mul
42 |"/" -> Div
43 |"_" -> Pass
44 |"!" -> Stop
45 |"mem" -> Mem
46 |"@" -> Delay
47 |"floor" -> Floor
48 |"int" -> Int
49 |"sin" -> Sin
50 |"cos" -> Cos
51 |"atan" -> Atan
52 |"atantwo" -> Atantwo
53 |"sqrt" -> Sqrt
54 |"rdtable" -> Rdtable
55 |"%" -> Mod
56 |"vectorize" -> Vectorize
57 |"#" -> Concat
58 |"[]" -> Nth
59 |"serialize" -> Serialize
60 |">" -> Larger
61 |"<" -> Smaller
62 |"prefix" -> Prefix
63 |"selecttwo" -> Selecttwo
64 |"selectthree" -> Selectthree
65 | _ -> raise Symbol_not_defined
66
67
68
69 type signal = int * (int -> value)
70
71
72 type faust_exp =
73 Const of value
74 | Ident of symbol
75 | Par of faust_exp * faust_exp
76 | Seq of faust_exp * faust_exp
77 | Rec of faust_exp * faust_exp
78 | Split of faust_exp * faust_exp
79 | Merge of faust_exp * faust_exp
80
81
82 type dimension = End of (int * int)
83 | Tree of (int * int) * (dimension * dimension)