type value = N of int
           | R of float
           | Vec of int * (int -> value)
	   | Zero
           | W

(** type symbol, defines valid identifiers in faust expressions.*)
type symbol = Add
  	    | Sup
	    | Mul
	    | Div
	    | Pass
	    | Stop
	    | Mem
	    | Delay
	    | Floor
	    | Int
	    | Sin
	    | Cos
	    | Atan
	    | Atantwo
	    | Sqrt
	    | Rdtable
	    | Mod
	    | Vectorize
	    | Concat
	    | Nth
	    | Serialize
	    | Larger
	    | Smaller
	    | Prefix
	    | Selecttwo
	    | Selectthree

exception Symbol_not_defined;;

let symbol_of_string = fun s ->
                        match s with
    			|"+"			->	Add
			|"-"			->	Sup		
			|"*"			->	Mul
			|"/"			->	Div
			|"_"			->	Pass
			|"!"			->	Stop
			|"mem"			->	Mem
			|"@"			->	Delay
			|"floor"		->	Floor
			|"int"			->	Int
			|"sin"			->	Sin
			|"cos"                  ->      Cos
			|"atan"                 ->      Atan
			|"atantwo"              ->      Atantwo
			|"sqrt"                 ->      Sqrt
			|"rdtable"		->	Rdtable
			|"%"			->	Mod
			|"vectorize"		->	Vectorize
			|"#"			->	Concat
			|"[]"			->	Nth
			|"serialize"		->	Serialize
			|">"			->	Larger
			|"<"			->	Smaller
			|"prefix"		->	Prefix
			|"selecttwo"		->	Selecttwo
			|"selectthree"		->	Selectthree
			| _                     ->      raise Symbol_not_defined



type signal = int * (int -> value)


type faust_exp =
         Const of value
       | Ident of symbol
       | Par   of faust_exp * faust_exp
       | Seq   of faust_exp * faust_exp
       | Rec   of faust_exp * faust_exp
       | Split of faust_exp * faust_exp
       | Merge of faust_exp * faust_exp


type dimension = End of (int * int)
               | Tree of (int * int) * (dimension * dimension)