From: WANG Date: Mon, 29 Jul 2013 16:12:51 +0000 (+0200) Subject: OOP initial commit with new tracked files. X-Git-Url: https://scm.cri.ensmp.fr/git/Faustine.git/commitdiff_plain/e1705e136ab823be2e76e63728db1a5359d5d443?hp=440ca0ba93966e89b68dc54207c461afc0d56264 OOP initial commit with new tracked files. --- diff --git a/interpretor/basic.ml b/interpretor/basic.ml new file mode 100644 index 0000000..cda0c6b --- /dev/null +++ b/interpretor/basic.ml @@ -0,0 +1,383 @@ +(** + Module: Basic + Description: basic data type in the vectorial faust interpreter. + @author WANG Haisheng + Created: 31/05/2013 Modified: 17/07/2013 +*) + +open Types;; + +exception Convert_Error of string;; +exception Basic_operation of string;; + + +(* MACRO *) + +let faust_max = 2147483647;; +let faust_min = -2147483648;; +let faust_bits = 32;; + +(* Functional operations *) + +let fun_unary oper f = fun x -> oper (f x);; +let fun_binary oper f g = fun x -> oper (f x) (g x);; +let fun_ternary oper f g h = fun x -> oper (f x) (g x) (h x);; + +(* basic operations *) + +let memorize : int -> (index -> basic) -> (index -> basic) = + fun size -> + fun vec -> + let memory_array = Array.create size Error in + let index_array = Array.create size false in + let vec_mem : index -> basic = + fun i -> + if i >= 0 && i < size then ( + if index_array.(i) then + memory_array.(i) + else + let result = vec i in + let () = memory_array.(i) <- result in + let () = index_array.(i) <- true in + result) + else raise (Invalid_argument "vector overflow.") in + vec_mem;; + +class vector : int -> (index -> basic) -> vector_type = + fun (size_init : int) -> + fun (vec_init : index -> basic) -> + object + val s = size_init + val vec = memorize size_init vec_init + method size = s + method nth = vec + end;; + +let rec basic_to_int : basic -> int = + fun v -> + match v with + |N i -> i + |R f -> int_of_float f + |Vec vec -> + raise (Convert_Error "basic_to_int : vector.") + |Zero -> 0 + |Error -> raise (Convert_Error "basic_to_int : Error");; + + +let basic_to_float : basic -> float = + fun v -> + match v with + |N i -> float_of_int i + |R f -> f + |Vec vec -> + raise (Convert_Error "basic_to_float : vector.") + |Zero -> 0. + |Error -> 0.;; + + +let basic_to_float_array : basic -> float array = + fun v -> + match v with + |Vec vec -> + let result : basic array = + Array.init vec#size vec#nth in + Array.map basic_to_float result + |_ -> [| (basic_to_float v)|];; + + +let basic_to_string : basic -> string = + fun (v : basic) -> + match v with + |N i1 -> "N " ^ (string_of_int i1) + |R f1 -> "R " ^ (string_of_float f1) + |Vec vec -> "Vec" + |Zero -> "Zero" + |Error -> "Error";; + +(* VALUE OPERATIONS *) + +let rec basic_normalize : basic -> basic = + fun b -> + let n = 2. ** float_of_int (faust_bits) in + match b with + |N i -> + if i > faust_max then + N (i - int_of_float + (n *. floor (((float_of_int i) +. n/.2.)/.n))) + else if i < faust_min then + N (i + int_of_float + (n *. floor ((n/.2. -. (float_of_int i) -. 1.)/.n))) + else N i + |R f -> + if f > float_of_int (faust_max) then + R (f -. (n *. floor ((f +. n/.2.)/.n))) + else if f < float_of_int (faust_min) then + R (f +. (n *. floor ((n/.2. -. f -. 1.)/.n))) + else R f + |Vec vec -> + Vec (new vector vec#size + (fun_unary basic_normalize vec#nth)) + |Zero -> Zero + |Error -> Error;; + + +let rec basic_add : basic -> basic -> basic = + fun b1 -> fun b2 -> + match (b1, b2) with + | (Zero, _) -> b2 + | (_, Zero) -> b1 + + | (Vec vec1, Vec vec2) -> + if vec1#size = vec2#size then + Vec (new vector vec1#size + (fun_binary basic_add vec1#nth vec2#nth)) + else raise (Basic_operation "vector size not matched.") + | (Vec vec1, _) -> raise (Basic_operation "vec1 +~ sca2") + + | (N i1, N i2) -> basic_normalize (N (i1 + i2)) + | (N i1, R f2) -> basic_normalize (R ((float_of_int i1) +. f2)) + | (N i1, Vec vec2) -> raise (Basic_operation "i1 +~ vec2") + | (N i1, Error) -> Error + + | (R f1, N i2) -> basic_normalize (R (f1 +. (float_of_int i2))) + | (R f1, R f2) -> basic_normalize (R (f1 +. f2)) + | (R f1, Vec vec2) -> raise (Basic_operation "f1 +~ vec2") + | (R f1, Error) -> Error + + | (Error, Vec vec2) -> raise (Basic_operation "Error +~ vec2") + | (Error, _) -> Error;; + + +let (+~) b1 b2 = basic_add b1 b2;; + + +let rec basic_neg : basic -> basic = + fun b -> + match b with + |N i -> N (-i) + |R f -> R (-.f) + |Vec vec -> Vec (new vector vec#size (fun_unary basic_neg vec#nth)) + |Zero -> Zero + |Error -> Error;; + + +let basic_sub : basic -> basic -> basic = + fun b1 -> + fun b2 -> + basic_add b1 (basic_neg b2);; + + +let (-~) b1 b2 = basic_sub b1 b2;; + + +let rec basic_mul : basic -> basic -> basic = + fun b1 -> + fun b2 -> + match (b1, b2) with + | (Vec vec1, Vec vec2) -> + if vec1#size = vec2#size then + Vec (new vector vec1#size + (fun_binary basic_mul vec1#nth vec2#nth)) + else raise (Basic_operation "vector size not matched.") + | (Vec vec1, Zero) -> + Vec (new vector vec1#size + (fun_unary (basic_mul Zero) vec1#nth)) + | (Vec vec1, _) -> raise (Basic_operation "vec1 *~ sca2") + + | (N i1, N i2) -> basic_normalize (N (i1 * i2)) + | (N i1, R f2) -> basic_normalize (R ((float_of_int i1) *. f2)) + | (N i1, Vec vec2) -> raise (Basic_operation "i1 *~ vec2") + | (N i1, Zero) -> N 0 + | (N i1, Error) -> Error + + | (R f1, N i2) -> basic_normalize (R (f1 *. (float_of_int i2))) + | (R f1, R f2) -> basic_normalize (R (f1 *. f2)) + | (R f1, Vec vec2) -> raise (Basic_operation "f1 *~ vec2") + | (R f1, Zero) -> R 0. + | (R f1, Error) -> Error + + | (Zero, N i2) -> N 0 + | (Zero, R f2) -> R 0. + | (Zero, Vec vec2) -> + Vec (new vector vec2#size + (fun i -> basic_mul Zero (vec2#nth i))) + | (Zero, Zero) -> Zero + | (Zero, Error) -> Error + + | (Error, Vec vec2) -> raise (Basic_operation "Error +~ vec2") + | (Error, _) -> Error;; + + +let ( *~ ) b1 b2 = basic_mul b1 b2;; + + +let rec basic_recip : basic -> basic = + fun v -> + match v with + |N i -> basic_recip (R (float_of_int i)) + |R f -> if f = 0. then Error else R (1./.f) + |Vec vec -> Vec (new vector vec#size + (fun_unary basic_recip vec#nth)) + |Zero -> Error + |Error -> R 0.;; + + +let basic_div : basic -> basic -> basic = + fun b1 -> + fun b2 -> + basic_mul b1 (basic_recip b2);; + + +let (/~) b1 b2 = basic_div b1 b2;; + + +let rec basic_zero : basic -> basic = + fun v -> + match v with + |N i -> N 0 + |R f -> R 0. + |Vec vec -> Vec (new vector vec#size + (fun_unary basic_zero vec#nth)) + |Zero -> Zero + |Error -> R 0.;; + + +let rec basic_floor : basic -> basic = + fun v -> + match v with + |N i -> R (float_of_int i) + |R f -> R (floor f) + |Vec vec -> Vec (new vector vec#size + (fun_unary basic_floor vec#nth)) + |Zero -> R 0. + |Error -> Error;; + + +let rec basic_int : basic -> basic = + fun v -> + match v with + |N i -> v + |R f -> N (int_of_float f) + |Vec vec -> Vec (new vector vec#size + (fun_unary basic_int vec#nth)) + |Zero -> N 0 + |Error -> Error;; + + +let rec basic_unary : (float -> float) -> basic -> basic = + fun oper -> + fun b -> + match b with + |N i -> R (oper (float_of_int i)) + |R f -> R (oper f) + |Vec vec -> Vec (new vector vec#size + (fun_unary (basic_unary oper) vec#nth)) + |Zero -> R (oper 0.) + |Error -> Error;; + + +let basic_sin : basic -> basic = basic_unary sin;; +let basic_cos : basic -> basic = basic_unary cos;; +let basic_atan : basic -> basic = basic_unary atan;; + + +let rec basic_atan2 : basic -> basic -> basic = + fun v1 -> + fun v2 -> + match (v1, v2) with + | (N i1, N i2) -> basic_atan2 + (R (float_of_int i1)) (R (float_of_int i2)) + | (N i1, R f2) -> basic_atan2 (R (float_of_int i1)) v2 + | (N i1, Zero) -> basic_atan2 (R (float_of_int i1)) (R 0.) + | (N i1, Vec vec2) -> raise (Basic_operation "atan2 sca vec.") + | (N i1, Error) -> Error + + | (R f1, N i2) -> basic_atan2 v1 (R (float_of_int i2)) + | (R f1, R f2) -> R (atan2 f1 f2) + | (R f1, Zero) -> basic_atan2 v1 (R 0.) + | (R f1, Vec vec2) -> raise (Basic_operation "atan2 sca vec.") + | (R f1, Error) -> Error + + | (Vec vec1, Vec vec2) -> Vec (new vector vec1#size + (fun_binary basic_atan2 vec1#nth vec2#nth)) + | (Vec vec1, Zero) -> Vec (new vector vec1#size + (fun i -> basic_atan2 (vec1#nth i) Zero)) + | (Vec vec1, _) -> raise (Basic_operation "atan2 vec sca.") + + | (Zero, N i2) -> basic_atan2 (R 0.) (R (float_of_int i2)) + | (Zero, R f2) -> basic_atan2 (R 0.) v2 + | (Zero, Vec vec2) -> Vec (new vector vec2#size + (fun_unary (basic_atan2 Zero) vec2#nth)) + | (Zero, Zero) -> basic_atan2 (R 0.) (R 0.) + | (Zero, Error) -> Error + + | (Error, Vec vec2) -> raise (Basic_operation "atan2 sca vec.") + | (Error, _) -> Error;; + + +let rec basic_sqrt v = match v with + |N i -> + if i >= 0 then R (sqrt (float_of_int i)) + else raise (Basic_operation "sqrt parameter < 0.") + |R f -> + if f >= 0. then R (sqrt f) + else raise (Basic_operation "sqrt parameter < 0.") + |Vec vec -> Vec (new vector vec#size (fun_unary basic_sqrt vec#nth)) + |Zero -> R (sqrt 0.) + |Error -> Error;; + + +let rec basic_mod : basic -> basic -> basic = + fun b1 -> + fun b2 -> + match (b1, b2) with + | (N i1, N i2) -> N (i1 mod i2) + | (N i1, R f2) -> basic_mod b1 (N (int_of_float f2)) + | (N i1, Vec vec2) -> + raise (Basic_operation "Scalaire_Vector: int mod vec.") + | (_, Zero) -> + raise (Basic_operation "b1 mod b2: b2 cannot be zero.") + | (N i1, Error) -> Error + + | (R f1, _) -> basic_mod (N (int_of_float f1)) b2 + + | (Vec vec1, Vec vec2) -> + if vec1#size = vec2#size then + Vec (new vector vec1#size (fun_binary basic_mod vec1#nth vec2#nth)) + else raise (Basic_operation "vector size not matched.") + | (Vec vec1, _) -> + raise (Basic_operation "Vector_Scalaire: vec mod int.") + + | (Zero, Vec vec2) -> + basic_mod (Vec (new vector vec2#size (fun i -> Zero))) b2 + | (Zero, _) -> basic_mod (N 0) b2 + + | (Error, Vec vec2) -> + raise (Basic_operation "Scalaire_Vector: int mod vec.") + | (Error, _) -> Error;; + + +let rec basic_larger_than_zero : basic -> basic = + fun v -> + match v with + |N i -> if i > 0 then N 1 else N 0 + |R f -> if f > 0. then N 1 else N 0 + |Vec vec -> + Vec (new vector vec#size + (fun_unary basic_larger_than_zero vec#nth )) + |Zero -> N 0 + |Error -> Error;; + + +let basic_larger : basic -> basic -> basic = + fun b1 -> + fun b2 -> + basic_larger_than_zero (b1 -~ b2);; + + +let basic_smaller : basic -> basic -> basic = + fun b1 -> + fun b2 -> + basic_larger_than_zero (b2 -~ b1);; + + diff --git a/interpretor/beam.ml b/interpretor/beam.ml new file mode 100644 index 0000000..33fb08e --- /dev/null +++ b/interpretor/beam.ml @@ -0,0 +1,41 @@ +(** + Module: Beam + Description: beam definition and operations + @author WANG Haisheng + Created: 21/07/2013 Modified: 21/07/2013 +*) + +exception Beam_matching of string;; + +open Signal;; + +class beam : signal_type array -> beam_type = + fun (sa_init : signal_type array) -> + object (self) + val sa = sa_init + val l = Array.length sa + + method get = sa + + method length = l + + method sub : int -> int -> beam_type = + fun start -> + fun len -> + new beam (Array.sub self#get start len) + + method append : beam_type -> beam_type = + fun b -> + new beam (Array.append self#get b) + + method matching : int -> beam_type + fun size -> + if size = self#length then self + else if size > self#length && size mod self#length = 0 then + + else if size < self#length && self#length mod size = 0 then + + else raise (Beam_matching "matching size error") + + + end diff --git a/interpretor/parser.ml b/interpretor/parser.ml new file mode 100644 index 0000000..feec7e2 --- /dev/null +++ b/interpretor/parser.ml @@ -0,0 +1,265 @@ +type token = + | CONST of (string) + | IDENT of (string) + | LPAR + | RPAR + | SEQ + | SPLIT + | MERGE + | PAR + | REC + | EOF + | POINT + +open Parsing;; +# 1 "parser.mly" + + open Types +# 19 "parser.ml" +let yytransl_const = [| + 259 (* LPAR *); + 260 (* RPAR *); + 261 (* SEQ *); + 262 (* SPLIT *); + 263 (* MERGE *); + 264 (* PAR *); + 265 (* REC *); + 0 (* EOF *); + 266 (* POINT *); + 0|] + +let yytransl_block = [| + 257 (* CONST *); + 258 (* IDENT *); + 0|] + +let yylhs = "\255\255\ +\001\000\002\000\002\000\002\000\002\000\002\000\002\000\002\000\ +\002\000\002\000\002\000\000\000" + +let yylen = "\002\000\ +\002\000\001\000\002\000\003\000\001\000\003\000\003\000\003\000\ +\003\000\003\000\003\000\002\000" + +let yydefred = "\000\000\ +\000\000\000\000\000\000\005\000\000\000\012\000\000\000\000\000\ +\000\000\000\000\000\000\000\000\000\000\000\000\001\000\004\000\ +\006\000\000\000\000\000\000\000\000\000\011\000" + +let yydgoto = "\002\000\ +\006\000\007\000" + +let yysindex = "\255\255\ +\008\255\000\000\024\255\000\000\008\255\000\000\012\000\032\255\ +\023\255\008\255\008\255\008\255\008\255\008\255\000\000\000\000\ +\000\000\016\255\253\254\253\254\011\255\000\000" + +let yyrindex = "\000\000\ +\000\000\000\000\001\000\000\000\000\000\000\000\000\000\007\000\ +\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ +\000\000\022\000\023\000\026\000\018\000\000\000" + +let yygindex = "\000\000\ +\000\000\003\000" + +let yytablesize = 286 +let yytable = "\001\000\ +\002\000\010\000\011\000\012\000\013\000\014\000\003\000\009\000\ +\003\000\004\000\005\000\015\000\018\000\019\000\020\000\021\000\ +\022\000\007\000\013\000\014\000\010\000\010\000\008\000\013\000\ +\014\000\009\000\017\000\010\000\011\000\012\000\013\000\014\000\ +\016\000\008\000\000\000\000\000\000\000\000\000\000\000\000\000\ +\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ +\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ +\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ +\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ +\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ +\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ +\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ +\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ +\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ +\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ +\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ +\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ +\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ +\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ +\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ +\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ +\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ +\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ +\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ +\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ +\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ +\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ +\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ +\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ +\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ +\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ +\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ +\000\000\000\000\000\000\000\000\002\000\002\000\002\000\002\000\ +\002\000\002\000\003\000\003\000\003\000\003\000\003\000\003\000\ +\010\000\011\000\012\000\013\000\014\000\007\000\007\000\007\000\ +\007\000\010\000\008\000\010\000\010\000\009\000" + +let yycheck = "\001\000\ +\000\000\005\001\006\001\007\001\008\001\009\001\000\000\005\000\ +\001\001\002\001\003\001\000\000\010\000\011\000\012\000\013\000\ +\014\000\000\000\008\001\009\001\005\001\000\000\000\000\008\001\ +\009\001\000\000\004\001\005\001\006\001\007\001\008\001\009\001\ +\001\001\010\001\255\255\255\255\255\255\255\255\255\255\255\255\ +\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ +\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ +\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ +\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ +\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ +\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ +\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ +\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ +\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ +\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ +\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ +\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ +\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ +\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ +\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ +\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ +\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ +\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ +\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ +\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ +\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ +\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ +\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ +\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ +\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ +\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ +\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ +\255\255\255\255\255\255\255\255\004\001\005\001\006\001\007\001\ +\008\001\009\001\004\001\005\001\006\001\007\001\008\001\009\001\ +\005\001\006\001\007\001\008\001\009\001\004\001\005\001\006\001\ +\007\001\004\001\004\001\006\001\007\001\004\001" + +let yynames_const = "\ + LPAR\000\ + RPAR\000\ + SEQ\000\ + SPLIT\000\ + MERGE\000\ + PAR\000\ + REC\000\ + EOF\000\ + POINT\000\ + " + +let yynames_block = "\ + CONST\000\ + IDENT\000\ + " + +let yyact = [| + (fun _ -> failwith "parser") +; (fun __caml_parser_env -> + let _1 = (Parsing.peek_val __caml_parser_env 1 : 'faust_exp) in + Obj.repr( +# 16 "parser.mly" + ( _1 ) +# 167 "parser.ml" + : Types.faust_exp)) +; (fun __caml_parser_env -> + let _1 = (Parsing.peek_val __caml_parser_env 0 : string) in + Obj.repr( +# 17 "parser.mly" + ( Const(N (int_of_string _1)) ) +# 174 "parser.ml" + : 'faust_exp)) +; (fun __caml_parser_env -> + let _1 = (Parsing.peek_val __caml_parser_env 1 : string) in + Obj.repr( +# 18 "parser.mly" + ( Const(R (float_of_string _1)) ) +# 181 "parser.ml" + : 'faust_exp)) +; (fun __caml_parser_env -> + let _1 = (Parsing.peek_val __caml_parser_env 2 : string) in + let _3 = (Parsing.peek_val __caml_parser_env 0 : string) in + Obj.repr( +# 19 "parser.mly" + ( Const(R (float_of_string (_1 ^ "." ^ _3))) ) +# 189 "parser.ml" + : 'faust_exp)) +; (fun __caml_parser_env -> + let _1 = (Parsing.peek_val __caml_parser_env 0 : string) in + Obj.repr( +# 20 "parser.mly" + ( Ident(symbol_of_string _1) ) +# 196 "parser.ml" + : 'faust_exp)) +; (fun __caml_parser_env -> + let _2 = (Parsing.peek_val __caml_parser_env 1 : 'faust_exp) in + Obj.repr( +# 21 "parser.mly" + ( _2 ) +# 203 "parser.ml" + : 'faust_exp)) +; (fun __caml_parser_env -> + let _1 = (Parsing.peek_val __caml_parser_env 2 : 'faust_exp) in + let _3 = (Parsing.peek_val __caml_parser_env 0 : 'faust_exp) in + Obj.repr( +# 22 "parser.mly" + ( Par(_1,_3) ) +# 211 "parser.ml" + : 'faust_exp)) +; (fun __caml_parser_env -> + let _1 = (Parsing.peek_val __caml_parser_env 2 : 'faust_exp) in + let _3 = (Parsing.peek_val __caml_parser_env 0 : 'faust_exp) in + Obj.repr( +# 23 "parser.mly" + ( Split(_1,_3) ) +# 219 "parser.ml" + : 'faust_exp)) +; (fun __caml_parser_env -> + let _1 = (Parsing.peek_val __caml_parser_env 2 : 'faust_exp) in + let _3 = (Parsing.peek_val __caml_parser_env 0 : 'faust_exp) in + Obj.repr( +# 24 "parser.mly" + ( Merge(_1,_3) ) +# 227 "parser.ml" + : 'faust_exp)) +; (fun __caml_parser_env -> + let _1 = (Parsing.peek_val __caml_parser_env 2 : 'faust_exp) in + let _3 = (Parsing.peek_val __caml_parser_env 0 : 'faust_exp) in + Obj.repr( +# 25 "parser.mly" + ( Seq(_1,_3) ) +# 235 "parser.ml" + : 'faust_exp)) +; (fun __caml_parser_env -> + let _1 = (Parsing.peek_val __caml_parser_env 2 : 'faust_exp) in + let _3 = (Parsing.peek_val __caml_parser_env 0 : 'faust_exp) in + Obj.repr( +# 26 "parser.mly" + ( Rec(_1,_3) ) +# 243 "parser.ml" + : 'faust_exp)) +(* Entry main *) +; (fun __caml_parser_env -> raise (Parsing.YYexit (Parsing.peek_val __caml_parser_env 0))) +|] +let yytables = + { Parsing.actions=yyact; + Parsing.transl_const=yytransl_const; + Parsing.transl_block=yytransl_block; + Parsing.lhs=yylhs; + Parsing.len=yylen; + Parsing.defred=yydefred; + Parsing.dgoto=yydgoto; + Parsing.sindex=yysindex; + Parsing.rindex=yyrindex; + Parsing.gindex=yygindex; + Parsing.tablesize=yytablesize; + Parsing.table=yytable; + Parsing.check=yycheck; + Parsing.error_function=parse_error; + Parsing.names_const=yynames_const; + Parsing.names_block=yynames_block } +let main (lexfun : Lexing.lexbuf -> token) (lexbuf : Lexing.lexbuf) = + (Parsing.yyparse yytables 1 lexfun lexbuf : Types.faust_exp)