+and proc_merge : faust_exp -> process_type =
+ fun (exp_init : faust_exp) ->
+ object (self)
+ val _exp = exp_init
+ val _exp_left =
+ match exp_init with
+ | Merge (e1, e2) -> e1
+ | _ -> raise (Process_error "merge process constructor.")
+ val _exp_right =
+ match exp_init with
+ | Merge (e1, e2) -> e2
+ | _ -> raise (Process_error "merge process constructor.")
+
+ val proc_left = (new proc_factory)#make _exp_left
+ val proc_right = (new proc_factory)#make _exp_right
+
+ val _dim = (proc_left#dim)#merge proc_right#dim
+ val _delay = proc_left#delay + proc_right#delay
+
+ method exp = _exp
+ method dim = _dim
+ method delay = _delay
+
+ method eval : beam_type -> beam_type =
+ fun (input : beam_type) ->
+ let mid_output = proc_left#eval input in
+ let mid_input = mid_output#matching proc_right#dim#input in
+ proc_right#eval mid_input
+
+ end
+
+and proc_seq : faust_exp -> process_type =
+ fun (exp_init : faust_exp) ->
+ object (self)
+ val _exp = exp_init
+ val _exp_left =
+ match exp_init with
+ | Seq (e1, e2) -> e1
+ | _ -> raise (Process_error "seq process constructor.")
+ val _exp_right =
+ match exp_init with
+ | Seq (e1, e2) -> e2
+ | _ -> raise (Process_error "seq process constructor.")
+
+ val proc_left = (new proc_factory)#make _exp_left
+ val proc_right = (new proc_factory)#make _exp_right
+
+ val _dim = (proc_left#dim)#seq proc_right#dim
+ val _delay = proc_left#delay + proc_right#delay
+
+ method exp = _exp
+ method dim = _dim
+ method delay = _delay
+
+ method eval : beam_type -> beam_type =
+ fun (input : beam_type) ->
+ let mid_output = proc_left#eval input in
+ proc_right#eval mid_output
+ end
+
+and proc_rec : faust_exp -> process_type =
+ fun (exp_init : faust_exp) ->
+ object (self)
+ val _exp = exp_init
+ val _exp_left =
+ match exp_init with
+ | Rec (e1, e2) -> e1
+ | _ -> raise (Process_error "rec process constructor.")
+ val _exp_right =
+ match exp_init with
+ | Rec (e1, e2) -> e2
+ | _ -> raise (Process_error "rec process constructor.")
+
+ val proc_left = (new proc_factory)#make _exp_left
+ val proc_right = (new proc_factory)#make _exp_right
+
+ val _dim = (proc_left#dim)#_rec proc_right#dim
+ val _delay = proc_left#delay
+
+ method exp = _exp
+ method dim = _dim
+ method delay = _delay
+
+ method eval : beam_type -> beam_type =
+ fun (input : beam_type) ->
+ let mid_output = proc_left#eval input in
+ proc_right#eval mid_output
+
+
+ end
+
+and proc_factory =
+ object
+ method make : faust_exp -> process_type =
+ fun (exp : faust_exp) ->
+ match exp with
+ | Const b -> new proc_const exp
+ | Ident s -> new proc_ident exp
+ | Par (e1, e2) -> new proc_par exp
+ | Seq (e1, e2) -> new proc_seq exp
+ | Split (e1, e2) -> new proc_split exp
+ | Merge (e1, e2) -> new proc_merge exp
+ | Rec (e1, e2) -> new proc_rec exp
+ end;;