type token = | EQUAL | BAR | STAR | LPAREN | RPAREN | COMMA | DOT | MINUSGREATER | EOF | UIDENT of (string) | LIDENT of (string) open Parsing;; # 2 "algdt_parser_y.mly" (* File: algdt_parser_y.mly AIFAD - Automated Induction of Functions over Algebraic Datatypes Author: Markus Mottl email: markus.mottl@gmail.com WWW: http://www.ocaml.info Copyright (C) 2002 Austrian Research Institute for Artificial Intelligence Copyright (C) 2003- Markus Mottl This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *) (* $Id: algdt_parser_y.mly,v 1.3 2006/01/17 00:23:37 mottl Exp $ *) open Utils open Algdt_types let make_prod_els prods prod = ProdEls (array_of_rev_list (prod :: prods)) # 49 "algdt_parser_y.ml" let yytransl_const = [| 257 (* EQUAL *); 258 (* BAR *); 259 (* STAR *); 260 (* LPAREN *); 261 (* RPAREN *); 262 (* COMMA *); 263 (* DOT *); 264 (* MINUSGREATER *); 0 (* EOF *); 0|] let yytransl_block = [| 265 (* UIDENT *); 266 (* LIDENT *); 0|] let yylhs = "\255\255\ \001\000\006\000\006\000\007\000\008\000\008\000\009\000\009\000\ \011\000\011\000\010\000\010\000\012\000\012\000\013\000\013\000\ \002\000\002\000\003\000\003\000\004\000\004\000\005\000\005\000\ \015\000\015\000\014\000\014\000\017\000\017\000\016\000\016\000\ \000\000\000\000\000\000\000\000\000\000" let yylen = "\002\000\ \002\000\001\000\002\000\004\000\001\000\001\000\001\000\005\000\ \001\000\003\000\001\000\002\000\001\000\003\000\001\000\002\000\ \002\000\001\000\004\000\001\000\001\000\004\000\001\000\004\000\ \005\000\001\000\002\000\001\000\004\000\001\000\003\000\001\000\ \002\000\002\000\002\000\002\000\002\000" let yydefred = "\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\033\000\ \000\000\002\000\000\000\018\000\000\000\034\000\000\000\028\000\ \020\000\035\000\000\000\021\000\036\000\000\000\023\000\037\000\ \000\000\000\000\001\000\003\000\032\000\000\000\000\000\026\000\ \030\000\027\000\017\000\000\000\000\000\000\000\000\000\000\000\ \000\000\007\000\000\000\005\000\006\000\000\000\013\000\000\000\ \000\000\000\000\000\000\000\000\000\000\009\000\000\000\016\000\ \004\000\000\000\000\000\000\000\019\000\022\000\024\000\000\000\ \014\000\025\000\029\000\000\000\008\000" let yydgoto = "\006\000\ \008\000\014\000\018\000\021\000\024\000\009\000\010\000\043\000\ \044\000\045\000\055\000\046\000\047\000\029\000\016\000\030\000\ \034\000" let yysindex = "\029\000\ \248\254\003\000\004\000\003\000\003\000\000\000\014\255\000\000\ \001\000\000\000\008\255\000\000\012\255\000\000\019\255\000\000\ \000\000\000\000\027\255\000\000\000\000\017\255\000\000\000\000\ \037\255\009\255\000\000\000\000\000\000\042\255\018\255\000\000\ \000\000\000\000\000\000\008\255\008\255\008\255\040\255\010\255\ \010\255\000\000\043\255\000\000\000\000\049\255\000\000\008\255\ \012\255\045\255\047\255\048\255\049\255\000\000\053\255\000\000\ \000\000\040\255\052\255\054\255\000\000\000\000\000\000\010\255\ \000\000\000\000\000\000\055\255\000\000" let yyrindex = "\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\032\255\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \021\255\000\000\000\000\000\000\000\000\051\255\000\000\000\000\ \056\255\000\000\000\000\000\000\057\255\000\000\000\000\000\000\ \000\000\000\000\059\255\060\255\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\058\255\000\000" let yygindex = "\000\000\ \000\000\042\000\000\000\000\000\000\000\000\000\054\000\000\000\ \221\255\000\000\000\000\028\000\010\000\005\000\243\255\000\000\ \020\000" let yytablesize = 269 let yytable = "\033\000\ \027\000\007\000\012\000\017\000\054\000\056\000\015\000\019\000\ \022\000\025\000\039\000\011\000\040\000\040\000\026\000\031\000\ \013\000\041\000\042\000\042\000\032\000\011\000\015\000\035\000\ \037\000\035\000\049\000\015\000\068\000\001\000\002\000\003\000\ \004\000\005\000\036\000\033\000\026\000\026\000\026\000\026\000\ \050\000\051\000\052\000\035\000\038\000\020\000\023\000\048\000\ \041\000\057\000\058\000\061\000\059\000\062\000\063\000\064\000\ \066\000\011\000\067\000\069\000\010\000\026\000\028\000\012\000\ \031\000\027\000\053\000\065\000\060\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\011\000\011\000\ \000\000\000\000\007\000\013\000\013\000" let yycheck = "\013\000\ \000\000\010\001\000\000\000\000\040\000\041\000\002\000\003\000\ \004\000\005\000\002\001\004\001\004\001\004\001\001\001\004\001\ \009\001\009\001\010\001\010\001\009\001\004\001\002\001\007\001\ \008\001\007\001\009\001\007\001\064\000\001\000\002\000\003\000\ \004\000\005\000\008\001\049\000\005\001\006\001\007\001\008\001\ \036\000\037\000\038\000\007\001\008\001\004\000\005\000\006\001\ \009\001\007\001\002\001\007\001\048\000\007\001\007\001\003\001\ \005\001\007\001\005\001\005\001\003\001\006\001\009\000\007\001\ \006\001\006\001\039\000\058\000\049\000\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\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\004\001\ \255\255\255\255\010\001\009\001\009\001" let yynames_const = "\ EQUAL\000\ BAR\000\ STAR\000\ LPAREN\000\ RPAREN\000\ COMMA\000\ DOT\000\ MINUSGREATER\000\ EOF\000\ " let yynames_block = "\ UIDENT\000\ LIDENT\000\ " let yyact = [| (fun _ -> failwith "parser") ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 1 : 'type_defs) in Obj.repr( # 67 "algdt_parser_y.mly" ( array_of_rev_list _1 ) # 221 "algdt_parser_y.ml" : (Algdt_types.tp_name, Algdt_types.cnstr_name) Algdt_types.type_defs)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 0 : 'type_def) in Obj.repr( # 70 "algdt_parser_y.mly" ( [_1] ) # 228 "algdt_parser_y.ml" : 'type_defs)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 1 : 'type_defs) in let _2 = (Parsing.peek_val __caml_parser_env 0 : 'type_def) in Obj.repr( # 71 "algdt_parser_y.mly" ( _2 :: _1 ) # 236 "algdt_parser_y.ml" : 'type_defs)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 3 : string) in let _3 = (Parsing.peek_val __caml_parser_env 1 : 'rhs) in Obj.repr( # 73 "algdt_parser_y.mly" ( _1, _3 ) # 244 "algdt_parser_y.ml" : 'type_def)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 0 : 'prod_el) in Obj.repr( # 76 "algdt_parser_y.mly" ( Prod _1 ) # 251 "algdt_parser_y.ml" : 'rhs)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 0 : 'sum) in Obj.repr( # 77 "algdt_parser_y.mly" ( Sums (array_of_rev_list _1) ) # 258 "algdt_parser_y.ml" : 'rhs)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 0 : string) in Obj.repr( # 80 "algdt_parser_y.mly" ( TpVal _1 ) # 265 "algdt_parser_y.ml" : 'prod_el)) ; (fun __caml_parser_env -> let _2 = (Parsing.peek_val __caml_parser_env 3 : 'prods) in let _4 = (Parsing.peek_val __caml_parser_env 1 : 'prod_el) in Obj.repr( # 81 "algdt_parser_y.mly" ( make_prod_els _2 _4 ) # 273 "algdt_parser_y.ml" : 'prod_el)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 0 : 'prod_el) in Obj.repr( # 84 "algdt_parser_y.mly" ( [_1] ) # 280 "algdt_parser_y.ml" : 'prods)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 2 : 'prods) in let _3 = (Parsing.peek_val __caml_parser_env 0 : 'prod_el) in Obj.repr( # 85 "algdt_parser_y.mly" ( _3 :: _1 ) # 288 "algdt_parser_y.ml" : 'prods)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 0 : 'sums) in Obj.repr( # 88 "algdt_parser_y.mly" ( _1 ) # 295 "algdt_parser_y.ml" : 'sum)) ; (fun __caml_parser_env -> let _2 = (Parsing.peek_val __caml_parser_env 0 : 'sums) in Obj.repr( # 89 "algdt_parser_y.mly" ( _2 ) # 302 "algdt_parser_y.ml" : 'sum)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 0 : 'sum_el) in Obj.repr( # 92 "algdt_parser_y.mly" ( [_1] ) # 309 "algdt_parser_y.ml" : 'sums)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 2 : 'sums) in let _3 = (Parsing.peek_val __caml_parser_env 0 : 'sum_el) in Obj.repr( # 93 "algdt_parser_y.mly" ( _3 :: _1 ) # 317 "algdt_parser_y.ml" : 'sums)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 0 : string) in Obj.repr( # 96 "algdt_parser_y.mly" ( Atom _1 ) # 324 "algdt_parser_y.ml" : 'sum_el)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 1 : string) in let _2 = (Parsing.peek_val __caml_parser_env 0 : 'prod_el) in Obj.repr( # 97 "algdt_parser_y.mly" ( Strct (_1, _2) ) # 332 "algdt_parser_y.ml" : 'sum_el)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 1 : 'data_el) in Obj.repr( # 103 "algdt_parser_y.mly" ( Some _1 ) # 339 "algdt_parser_y.ml" : Algdt_types.cnstr_name Algdt_types.data option)) ; (fun __caml_parser_env -> Obj.repr( # 104 "algdt_parser_y.mly" ( None ) # 345 "algdt_parser_y.ml" : Algdt_types.cnstr_name Algdt_types.data option)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 3 : 'data_el) in let _3 = (Parsing.peek_val __caml_parser_env 1 : 'data_el) in Obj.repr( # 107 "algdt_parser_y.mly" ( Some (_1, _3) ) # 353 "algdt_parser_y.ml" : Algdt_types.cnstr_name Algdt_types.data_sample option)) ; (fun __caml_parser_env -> Obj.repr( # 108 "algdt_parser_y.mly" ( None ) # 359 "algdt_parser_y.ml" : Algdt_types.cnstr_name Algdt_types.data_sample option)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 0 : Algdt_types.cnstr_name Algdt_types.data option) in Obj.repr( # 111 "algdt_parser_y.mly" ( _1 ) # 366 "algdt_parser_y.ml" : Algdt_types.cnstr_name Algdt_types.data option)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 3 : 'data_el) in let _3 = (Parsing.peek_val __caml_parser_env 1 : 'data_el) in Obj.repr( # 112 "algdt_parser_y.mly" ( Some _1 ) # 374 "algdt_parser_y.ml" : Algdt_types.cnstr_name Algdt_types.data option)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 0 : Algdt_types.cnstr_name Algdt_types.data option) in Obj.repr( # 115 "algdt_parser_y.mly" ( _1 ) # 381 "algdt_parser_y.ml" : Algdt_types.cnstr_name Algdt_types.data option)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 3 : 'data_el) in let _3 = (Parsing.peek_val __caml_parser_env 1 : 'data_el) in Obj.repr( # 116 "algdt_parser_y.mly" ( Some _3 ) # 389 "algdt_parser_y.ml" : Algdt_types.cnstr_name Algdt_types.data option)) ; (fun __caml_parser_env -> let _2 = (Parsing.peek_val __caml_parser_env 3 : 'data_prods) in let _4 = (Parsing.peek_val __caml_parser_env 1 : 'data_el) in Obj.repr( # 119 "algdt_parser_y.mly" ( make_prod_els _2 _4 ) # 397 "algdt_parser_y.ml" : 'data_part)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 0 : string) in Obj.repr( # 120 "algdt_parser_y.mly" ( TpVal (DAtom _1) ) # 404 "algdt_parser_y.ml" : 'data_part)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 1 : string) in let _2 = (Parsing.peek_val __caml_parser_env 0 : 'data_arg) in Obj.repr( # 123 "algdt_parser_y.mly" ( TpVal (DStrct (_1, _2)) ) # 412 "algdt_parser_y.ml" : 'data_el)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 0 : 'data_part) in Obj.repr( # 124 "algdt_parser_y.mly" ( _1 ) # 419 "algdt_parser_y.ml" : 'data_el)) ; (fun __caml_parser_env -> let _2 = (Parsing.peek_val __caml_parser_env 2 : string) in let _3 = (Parsing.peek_val __caml_parser_env 1 : 'data_arg) in Obj.repr( # 127 "algdt_parser_y.mly" ( TpVal (DStrct (_2, _3)) ) # 427 "algdt_parser_y.ml" : 'data_arg)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 0 : 'data_part) in Obj.repr( # 128 "algdt_parser_y.mly" ( _1 ) # 434 "algdt_parser_y.ml" : 'data_arg)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 2 : 'data_prods) in let _3 = (Parsing.peek_val __caml_parser_env 0 : 'data_el) in Obj.repr( # 131 "algdt_parser_y.mly" ( _3 :: _1 ) # 442 "algdt_parser_y.ml" : 'data_prods)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 0 : 'data_el) in Obj.repr( # 132 "algdt_parser_y.mly" ( [_1] ) # 449 "algdt_parser_y.ml" : 'data_prods)) (* Entry spec *) ; (fun __caml_parser_env -> raise (Parsing.YYexit (Parsing.peek_val __caml_parser_env 0))) (* Entry data *) ; (fun __caml_parser_env -> raise (Parsing.YYexit (Parsing.peek_val __caml_parser_env 0))) (* Entry data_sample *) ; (fun __caml_parser_env -> raise (Parsing.YYexit (Parsing.peek_val __caml_parser_env 0))) (* Entry lhs_data *) ; (fun __caml_parser_env -> raise (Parsing.YYexit (Parsing.peek_val __caml_parser_env 0))) (* Entry rhs_data *) ; (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 spec (lexfun : Lexing.lexbuf -> token) (lexbuf : Lexing.lexbuf) = (Parsing.yyparse yytables 1 lexfun lexbuf : (Algdt_types.tp_name, Algdt_types.cnstr_name) Algdt_types.type_defs) let data (lexfun : Lexing.lexbuf -> token) (lexbuf : Lexing.lexbuf) = (Parsing.yyparse yytables 2 lexfun lexbuf : Algdt_types.cnstr_name Algdt_types.data option) let data_sample (lexfun : Lexing.lexbuf -> token) (lexbuf : Lexing.lexbuf) = (Parsing.yyparse yytables 3 lexfun lexbuf : Algdt_types.cnstr_name Algdt_types.data_sample option) let lhs_data (lexfun : Lexing.lexbuf -> token) (lexbuf : Lexing.lexbuf) = (Parsing.yyparse yytables 4 lexfun lexbuf : Algdt_types.cnstr_name Algdt_types.data option) let rhs_data (lexfun : Lexing.lexbuf -> token) (lexbuf : Lexing.lexbuf) = (Parsing.yyparse yytables 5 lexfun lexbuf : Algdt_types.cnstr_name Algdt_types.data option)