let rec dim exp_faust =
(** val dimension_constructor : ((int * int) -> (int * int) -> (int * int)) -> faust_exp -> faust_exp -> dimension, returns the dimension tree of constructor(e1, e2).*) |
let dimension_constructor = fun constructor -> fun e1 -> fun e2 ->
let subtree1 = dim e1 in
let subtree2 = dim e2 in
let root = constructor (get_root subtree1) (get_root subtree2) in
Tree (root, (subtree1, subtree2)) in
match exp_faust with
|Const v -> End (0, 1)
|Ident s ->
(
match s with
|Add -> End (2, 1)
|Sup -> End (2, 1)
|Mul -> End (2, 1)
|Div -> End (2, 1)
|Pass -> End (1, 1)
|Stop -> End (1, 0)
|Mem -> End (1, 1)
|Delay -> End (2, 1)
|Floor -> End (1, 1)
|Int -> End (1, 1)
|Sin -> End (1, 1)
|Cos -> End (1, 1)
|Atan -> End (1, 1)
|Atantwo -> End (2, 1)
|Sqrt -> End (1, 1)
|Rdtable -> End (3, 1)
|Mod -> End (2, 1)
|Vectorize -> End (2, 1)
|Concat -> End (2, 1)
|Nth -> End (2, 1)
|Serialize -> End (1, 1)
|Larger -> End (2, 1)
|Smaller -> End (2, 1)
|Prefix -> End (2, 1)
|Selecttwo -> End (3, 1)
|Selectthree -> End (4, 1)
)
|Par (e1, e2) -> dimension_constructor d_par e1 e2
|Seq (e1, e2) -> dimension_constructor d_seq e1 e2
|Split (e1, e2) -> dimension_constructor d_split e1 e2
|Merge (e1, e2) -> dimension_constructor d_merge e1 e2
|Rec (e1, e2) -> dimension_constructor d_rec e1 e2