# LukasToma/Code

Simplified not expressions

1 parent b262b86 commit abdbb5a09ae4a2670b3c7804efde27048120f4d0 ckroxigor committed Jan 23, 2013
Showing with 247 additions and 208 deletions.
1. +30 −9 eval.ml
2. +35 −23 examples.lang
3. +182 −176 parser.ml
39 eval.ml
 @@ -386,6 +386,24 @@ let with_str = ref [];; let with_keys = ref[];; let solving_rels = ref["a"];; +let simplify_expression(comparisons, negations) = + let negations_result = ref [] in + let sub_nots = List.map (fun x -> extract_term_from_not x) negations.contents in + List.iter(fun x-> match x with + | Comp (s, c, i) -> + let new_sign = match c with + | "=" -> "<>" + | "<" -> ">=" + | ">" -> "<=" + | "<>" -> "=" + | ">=" -> "<" + | "<=" -> ">" + | _ -> raise (QueryError ("Operator "^c^" not expected in a negation.")) in + comparisons := List.append comparisons.contents [Comp(s,new_sign,i)] + | _ -> negations_result := List.append negations_result.contents [Not (x)]) sub_nots; + negations := negations_result.contents; +;; + (* Subquery generator *) let rec get_subquery_body e name col_names = let num_anonym_columns = List.length (List.filter(fun x -> (String.compare (match x with @@ -497,24 +515,27 @@ and gen_sub_tables e l sel sel_as name = num_table := num_table.contents + 1; vars_from := List.append vars_from.contents (List.filter(fun x -> match x with | ParamS s -> true | ParamI i -> false) col_names); done; + (*Extract negations*) + let nots = ref (List.filter (fun x -> match x with | Not t -> true | _ -> false) l) in (*Process the equalities*) - let comparisons = List.filter (fun x -> match x with + let comparisons = ref (List.filter (fun x -> match x with | Comp(s, c, i) -> true | BPred (x, vl) -> true - | _ -> false) l in - (*Printf.printf "Number of comparisions: %i\n" (List.length comparisons);*) - for nequ = 0 to List.length comparisons - 1 do - let info = prepare_literal(List.nth comparisons nequ) in + | _ -> false) l) in + (*Add negations to equalities*) + simplify_expression(comparisons, nots); + for nequ = 0 to List.length comparisons.contents - 1 do + let info = prepare_literal(List.nth comparisons.contents nequ) in let equ = (String.concat " " info) in - if match List.nth comparisons nequ with + if match List.nth comparisons.contents nequ with | Comp(s, c, i) -> List.for_all (fun p -> let p2 = param_to_string p in List.exists(fun x -> (String.compare p2 (param_to_string x)) == 0 || (match p with | ParamS s -> false | ParamI i -> true)) vars_from.contents) [s;i] | BPred (x, vl) -> List.for_all (fun p -> let p2 = param_to_string p in List.exists(fun x -> (String.compare p2 (param_to_string x)) == 0 || (match p with | ParamS s -> false | ParamI i -> true)) vars_from.contents) vl | Rel r -> raise (QueryError ("Relation not expected within comparisons.")) | Not t -> raise (QueryError ("Negation not expected within comparisons.")) then where := List.append where.contents [equ] else (let equ_elems = ( - match List.nth comparisons nequ with + match List.nth comparisons.contents nequ with | Comp(s, c, i) -> if (String.compare c "=") == 0 && (match s with | ParamS s -> true | ParamI i -> false) && @@ -534,8 +555,8 @@ and gen_sub_tables e l sel sel_as name = (*Printf.printf "Comparisions where: \"%s\"\n" (String.concat ";" where.contents);*) (*Printf.printf "Comparisions where_not_in: \"%s\"\n" (String.concat ";" where_not_in.contents);*) (*Process the negations*) - let nots = List.filter (fun x -> match x with | Not t -> true | _ -> false) l in - let sub_nots = List.map (fun x -> extract_term_from_not x) nots in + + let sub_nots = List.map (fun x -> extract_term_from_not x) nots.contents in List.iter(fun x-> match x with | Rel r -> not_in := List.append not_in.contents [(get_subquery e (get_predname(Rel r)) (get_varlist(Rel r)))^(string_of_int num_table.contents)]; num_table := num_table.contents + 1;
58 examples.lang
 @@ -256,10 +256,25 @@ Q(x,y,z,w):-Marks(x,y,z) and 50 < w. / Error => Variable 'w' is not safe. + +Q(x,y,z,w):-Marks(x,y,z) and not 50 <> w and not z <= 1 and not z < 3 and not z >= 50 and not z > 15. +?-Q(x,y,z). +/ + + Q(w):-w = 50. ?-Q(w). / +Q(w):-not w = 50. +?-Q(w). +/ +Error => Variable 'w' is not safe. + +Q(w):-not w <> 50. +?-Q(w). +/ + Q(w):-50 = w. ?-Q(w). / @@ -464,25 +479,6 @@ R(x,y,z,2):-Q(x,y,z). / Error ==> Relation 'R' is defined recursively involving different relations. -(*command examples*) - -#help select/ -#help from/ -#help where/ -#help wherenot/ -#help join/ -#help union/ -#help isodd/ -#help iseven/ -#tableinfo marks/ -#gettables/ -#getdb/ -#readscript in.dat/ -#changeout out.dat/ -#changeout stdout/ -#reconnect localhost 5432 postgres postgres test_db/ -#quit/ - Q(x,y,z):-Marks(x,y,z) and _divides(z,z). ?-Q(x,y,z). / @@ -503,10 +499,26 @@ Q(x,y,z):-Marks(x,y,z) and not _divides(z,z). ?-Q(x,y,z). / -Q(x,a,b):-Names(x,y,z) and Marks(x,a,b) and b = 75 and _hasLength(y,2). +Q(y,a,b):-Names(x,y,z) and Marks(x,a,b) and not _hasLength(y,2). ?-Q(x,a,b). / -Q(x,a):-Names(x,y,z) and Marks(x,a,75) and _hasLength(y,y).. -?-Q(x,a). -/ + +(*command examples*) + +#help select/ +#help from/ +#help where/ +#help wherenot/ +#help join/ +#help union/ +#help isodd/ +#help iseven/ +#tableinfo marks/ +#gettables/ +#getdb/ +#readscript in.dat/ +#changeout out.dat/ +#changeout stdout/ +#reconnect localhost 5432 postgres postgres test_db/ +#quit/
358 parser.ml
 @@ -99,116 +99,116 @@ let yylhs = "\255\255\ \001\000\001\000\001\000\002\000\003\000\004\000\004\000\006\000\ \006\000\006\000\005\000\005\000\005\000\005\000\005\000\005\000\ \005\000\005\000\005\000\005\000\013\000\013\000\013\000\013\000\ -\013\000\013\000\013\000\012\000\012\000\010\000\010\000\010\000\ -\011\000\011\000\011\000\011\000\011\000\009\000\007\000\014\000\ -\015\000\008\000\017\000\017\000\017\000\018\000\018\000\018\000\ -\018\000\018\000\018\000\016\000\019\000\021\000\020\000\025\000\ -\025\000\025\000\025\000\025\000\025\000\022\000\022\000\022\000\ -\023\000\023\000\023\000\024\000\024\000\026\000\026\000\026\000\ -\000\000" +\013\000\013\000\013\000\013\000\012\000\012\000\010\000\010\000\ +\010\000\011\000\011\000\011\000\011\000\011\000\009\000\007\000\ +\014\000\015\000\008\000\017\000\017\000\017\000\018\000\018\000\ +\018\000\018\000\018\000\018\000\016\000\019\000\021\000\020\000\ +\025\000\025\000\025\000\025\000\025\000\025\000\022\000\022\000\ +\022\000\023\000\023\000\023\000\024\000\024\000\026\000\026\000\ +\026\000\000\000" let yylen = "\002\000\ \001\000\002\000\002\000\001\000\001\000\001\000\002\000\001\000\ \001\000\001\000\002\000\006\000\002\000\002\000\001\000\001\000\ \001\000\001\000\002\000\002\000\001\000\001\000\001\000\001\000\ -\001\000\001\000\001\000\003\000\001\000\001\000\001\000\001\000\ -\001\000\001\000\001\000\001\000\001\000\001\000\004\000\001\000\ -\001\000\003\000\000\000\001\000\003\000\001\000\002\000\001\000\ -\002\000\001\000\002\000\004\000\004\000\004\000\003\000\001\000\ -\001\000\001\000\001\000\001\000\001\000\000\000\001\000\003\000\ -\000\000\001\000\003\000\001\000\001\000\001\000\001\000\001\000\ -\002\000" +\001\000\001\000\001\000\001\000\003\000\001\000\001\000\001\000\ +\001\000\001\000\001\000\001\000\001\000\001\000\001\000\004\000\ +\001\000\001\000\003\000\000\000\001\000\003\000\001\000\002\000\ +\001\000\002\000\001\000\002\000\004\000\004\000\004\000\003\000\ +\001\000\001\000\001\000\001\000\001\000\001\000\000\000\001\000\ +\003\000\000\000\001\000\003\000\001\000\001\000\001\000\001\000\ +\001\000\002\000" let yydefred = "\000\000\ -\000\000\000\000\000\000\000\000\001\000\038\000\000\000\000\000\ +\000\000\000\000\000\000\000\000\001\000\039\000\000\000\000\000\ \015\000\000\000\000\000\000\000\016\000\000\000\017\000\018\000\ -\073\000\000\000\000\000\000\000\005\000\006\000\008\000\009\000\ -\010\000\000\000\040\000\000\000\000\000\011\000\031\000\032\000\ -\030\000\000\000\000\000\013\000\014\000\027\000\021\000\022\000\ -\023\000\024\000\025\000\026\000\019\000\020\000\002\000\003\000\ -\007\000\000\000\069\000\068\000\000\000\000\000\042\000\000\000\ -\000\000\000\000\000\000\000\000\000\000\000\000\044\000\046\000\ -\048\000\050\000\000\000\052\000\000\000\000\000\028\000\000\000\ -\000\000\047\000\049\000\051\000\039\000\000\000\061\000\056\000\ -\057\000\058\000\059\000\060\000\000\000\064\000\034\000\035\000\ -\037\000\033\000\036\000\000\000\071\000\070\000\072\000\000\000\ -\000\000\000\000\045\000\055\000\012\000\053\000\000\000\054\000\ -\067\000" +\074\000\000\000\000\000\000\000\005\000\006\000\008\000\009\000\ +\010\000\000\000\041\000\000\000\000\000\011\000\032\000\033\000\ +\031\000\000\000\000\000\013\000\014\000\028\000\021\000\022\000\ +\023\000\024\000\025\000\026\000\027\000\019\000\020\000\002\000\ +\003\000\007\000\000\000\070\000\069\000\000\000\000\000\043\000\ +\000\000\000\000\000\000\000\000\000\000\000\000\000\000\045\000\ +\047\000\049\000\051\000\000\000\053\000\000\000\000\000\029\000\ +\000\000\000\000\048\000\050\000\052\000\040\000\000\000\062\000\ +\057\000\058\000\059\000\060\000\061\000\000\000\065\000\035\000\ +\036\000\038\000\034\000\037\000\000\000\072\000\071\000\073\000\ +\000\000\000\000\000\000\046\000\056\000\012\000\054\000\000\000\ +\055\000\068\000" let yydgoto = "\002\000\ \017\000\018\000\019\000\020\000\021\000\022\000\023\000\024\000\ -\025\000\035\000\092\000\036\000\045\000\026\000\061\000\027\000\ -\062\000\063\000\064\000\065\000\066\000\053\000\096\000\054\000\ -\085\000\097\000" +\025\000\035\000\093\000\036\000\046\000\026\000\062\000\027\000\ +\063\000\064\000\065\000\066\000\067\000\054\000\097\000\055\000\ +\086\000\098\000" -let yysindex = "\010\000\ -\023\255\000\000\006\255\024\255\000\000\000\000\029\255\002\255\ -\000\000\002\255\002\255\007\255\000\000\030\255\000\000\000\000\ -\000\000\009\255\010\255\004\255\000\000\000\000\000\000\000\000\ -\000\000\027\255\000\000\013\255\034\255\000\000\000\000\000\000\ -\000\000\046\255\060\255\000\000\000\000\000\000\000\000\000\000\ +let yysindex = "\007\000\ +\024\255\000\000\001\255\031\255\000\000\000\000\038\255\002\255\ +\000\000\002\255\002\255\007\255\000\000\044\255\000\000\000\000\ +\000\000\021\255\041\255\004\255\000\000\000\000\000\000\000\000\ +\000\000\063\255\000\000\033\255\066\255\000\000\000\000\000\000\ +\000\000\072\255\068\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\061\255\000\000\000\000\043\255\041\255\000\000\002\255\ -\002\255\045\255\054\255\042\255\071\255\072\255\000\000\000\000\ -\000\000\000\000\053\255\000\000\013\255\255\254\000\000\012\255\ -\013\255\000\000\000\000\000\000\000\000\061\255\000\000\000\000\ -\000\000\000\000\000\000\000\000\013\255\000\000\000\000\000\000\ -\000\000\000\000\000\000\002\255\000\000\000\000\000\000\056\255\ -\057\255\062\255\000\000\000\000\000\000\000\000\012\255\000\000\ -\000\000" +\000\000\000\000\062\255\000\000\000\000\050\255\051\255\000\000\ +\002\255\002\255\052\255\054\255\042\255\073\255\074\255\000\000\ +\000\000\000\000\000\000\249\254\000\000\033\255\255\254\000\000\ +\027\255\033\255\000\000\000\000\000\000\000\000\062\255\000\000\ +\000\000\000\000\000\000\000\000\000\000\033\255\000\000\000\000\ +\000\000\000\000\000\000\000\000\002\255\000\000\000\000\000\000\ +\055\255\057\255\056\255\000\000\000\000\000\000\000\000\027\255\ +\000\000\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\000\000\000\000\000\000\000\000\ -\000\000\000\000\000\000\052\255\000\000\000\000\000\000\000\000\ -\000\000\000\000\000\000\063\255\000\000\000\000\000\000\000\000\ -\000\000\000\000\055\255\000\000\000\000\000\000\000\000\000\000\ +\000\000\000\000\000\000\059\255\000\000\000\000\000\000\000\000\ +\000\000\000\000\000\000\064\255\000\000\000\000\000\000\000\000\ +\000\000\000\000\060\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\021\255\000\000\000\000\000\000\064\255\000\000\000\000\ -\000\000\000\000\000\000\000\000\000\000\079\255\000\000\000\000\ -\000\000\000\000\000\000\000\000\063\255\000\000\000\000\065\255\ -\063\255\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ +\000\000\000\000\061\255\000\000\000\000\000\000\065\255\000\000\ +\000\000\000\000\000\000\000\000\000\000\000\000\078\255\000\000\ +\000\000\000\000\000\000\000\000\000\000\064\255\000\000\000\000\ +\067\255\064\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\ -\066\255\000\000\000\000\000\000\000\000\000\000\065\255\000\000\ -\000\000" +\000\000\069\255\000\000\000\000\000\000\000\000\000\000\067\255\ +\000\000\000\000" let yygindex = "\000\000\ -\000\000\000\000\000\000\000\000\000\000\066\000\000\000\000\000\ -\000\000\248\255\000\000\081\000\000\000\000\000\000\000\089\000\ -\000\000\016\000\035\000\036\000\037\000\195\255\251\255\213\255\ +\000\000\000\000\000\000\000\000\000\000\068\000\000\000\000\000\ +\000\000\248\255\000\000\080\000\000\000\000\000\000\000\089\000\ +\000\000\016\000\035\000\036\000\037\000\213\255\251\255\212\255\ \000\000\000\000" -let yytablesize = 98 +let yytablesize = 99 let yytable = "\034\000\ -\087\000\088\000\089\000\031\000\032\000\003\000\067\000\086\000\ -\004\000\038\000\001\000\098\000\093\000\051\000\094\000\052\000\ -\067\000\039\000\040\000\041\000\042\000\095\000\043\000\044\000\ -\003\000\003\000\043\000\004\000\043\000\028\000\030\000\006\000\ -\046\000\050\000\067\000\047\000\048\000\090\000\091\000\055\000\ -\033\000\100\000\051\000\058\000\052\000\059\000\056\000\070\000\ -\071\000\005\000\006\000\007\000\008\000\009\000\010\000\011\000\ -\012\000\013\000\014\000\015\000\016\000\051\000\058\000\052\000\ -\059\000\057\000\069\000\068\000\072\000\060\000\079\000\080\000\ -\081\000\082\000\083\000\084\000\077\000\073\000\004\000\078\000\ -\102\000\029\000\103\000\101\000\041\000\049\000\104\000\062\000\ -\063\000\065\000\066\000\037\000\029\000\099\000\074\000\075\000\ -\076\000\105\000" +\088\000\089\000\090\000\031\000\032\000\003\000\068\000\001\000\ +\004\000\038\000\080\000\081\000\082\000\083\000\084\000\085\000\ +\068\000\039\000\040\000\041\000\042\000\043\000\044\000\045\000\ +\028\000\003\000\087\000\094\000\004\000\095\000\099\000\006\000\ +\003\000\052\000\068\000\053\000\096\000\091\000\092\000\030\000\ +\033\000\101\000\052\000\059\000\053\000\060\000\047\000\048\000\ +\071\000\072\000\005\000\006\000\007\000\008\000\009\000\010\000\ +\011\000\012\000\013\000\014\000\015\000\016\000\052\000\059\000\ +\053\000\060\000\044\000\049\000\044\000\051\000\061\000\056\000\ +\057\000\058\000\069\000\073\000\070\000\074\000\078\000\103\000\ +\105\000\079\000\104\000\042\000\102\000\004\000\030\000\050\000\ +\063\000\064\000\037\000\066\000\029\000\067\000\100\000\075\000\ +\076\000\077\000\106\000" let yycheck = "\008\000\ -\002\001\003\001\004\001\002\001\003\001\002\001\050\000\069\000\ -\005\001\003\001\001\000\073\000\001\001\001\001\003\001\003\001\ -\060\000\011\001\012\001\013\001\014\001\010\001\016\001\017\001\ -\002\001\002\001\006\001\005\001\008\001\024\001\002\001\028\001\ -\003\001\007\001\078\000\027\001\027\001\039\001\040\001\006\001\ -\039\001\085\000\001\001\002\001\003\001\004\001\001\001\056\000\ -\057\000\027\001\028\001\029\001\030\001\031\001\032\001\033\001\ -\034\001\035\001\036\001\037\001\038\001\001\001\002\001\003\001\ -\004\001\006\001\026\001\025\001\024\001\009\001\018\001\019\001\ -\020\001\021\001\022\001\023\001\006\001\024\001\027\001\008\001\ -\025\001\027\001\026\001\092\000\006\001\020\000\025\001\025\001\ -\025\001\025\001\025\001\011\000\004\000\078\000\060\000\060\000\ -\060\000\103\000" +\002\001\003\001\004\001\002\001\003\001\002\001\051\000\001\000\ +\005\001\003\001\018\001\019\001\020\001\021\001\022\001\023\001\ +\061\000\011\001\012\001\013\001\014\001\015\001\016\001\017\001\ +\024\001\002\001\070\000\001\001\005\001\003\001\074\000\028\001\ +\002\001\001\001\079\000\003\001\010\001\039\001\040\001\002\001\ +\039\001\086\000\001\001\002\001\003\001\004\001\003\001\027\001\ +\057\000\058\000\027\001\028\001\029\001\030\001\031\001\032\001\ +\033\001\034\001\035\001\036\001\037\001\038\001\001\001\002\001\ +\003\001\004\001\006\001\027\001\008\001\007\001\009\001\006\001\ +\001\001\006\001\025\001\024\001\026\001\024\001\006\001\025\001\ +\025\001\008\001\026\001\006\001\093\000\027\001\027\001\020\000\ +\025\001\025\001\011\000\025\001\004\000\025\001\079\000\061\000\ +\061\000\061\000\104\000" let yynames_const = "\ QMARK\000\ @@ -425,335 +425,341 @@ let yyact = [| ; (fun __caml_parser_env -> Obj.repr( # 85 "parser.mly" - ( IsOdd ) + ( Union ) # 430 "parser.ml" : 'help_param)) ; (fun __caml_parser_env -> Obj.repr( # 86 "parser.mly" - ( IsEven ) + ( IsOdd ) # 436 "parser.ml" : 'help_param)) ; (fun __caml_parser_env -> - let _1 = (Parsing.peek_val __caml_parser_env 0 : string) in Obj.repr( # 87 "parser.mly" + ( IsEven ) +# 442 "parser.ml" + : 'help_param)) +; (fun __caml_parser_env -> + let _1 = (Parsing.peek_val __caml_parser_env 0 : string) in + Obj.repr( +# 88 "parser.mly" ( Other ) -# 443 "parser.ml" +# 449 "parser.ml" : 'help_param)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 2 : 'reconn_param) in let _3 = (Parsing.peek_val __caml_parser_env 0 : 'reconn_param) in Obj.repr( -# 91 "parser.mly" +# 92 "parser.mly" ( _1 ^ "." ^ _3 ) -# 451 "parser.ml" +# 457 "parser.ml" : 'file_name)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 0 : 'reconn_param) in Obj.repr( -# 92 "parser.mly" +# 93 "parser.mly" ( _1 ) -# 458 "parser.ml" +# 464 "parser.ml" : 'file_name)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 0 : string) in Obj.repr( -# 95 "parser.mly" - ( _1 ) -# 465 "parser.ml" - : 'reconn_param)) -; (fun __caml_parser_env -> - let _1 = (Parsing.peek_val __caml_parser_env 0 : string) in - Obj.repr( # 96 "parser.mly" ( _1 ) -# 472 "parser.ml" +# 471 "parser.ml" : 'reconn_param)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 0 : string) in Obj.repr( # 97 "parser.mly" ( _1 ) -# 479 "parser.ml" +# 478 "parser.ml" : 'reconn_param)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 0 : string) in Obj.repr( -# 101 "parser.mly" +# 98 "parser.mly" ( _1 ) -# 486 "parser.ml" - : 'pass_param)) +# 485 "parser.ml" + : 'reconn_param)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 0 : string) in Obj.repr( # 102 "parser.mly" ( _1 ) -# 493 "parser.ml" +# 492 "parser.ml" : 'pass_param)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 0 : string) in Obj.repr( # 103 "parser.mly" ( _1 ) -# 500 "parser.ml" +# 499 "parser.ml" : 'pass_param)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 0 : string) in Obj.repr( # 104 "parser.mly" ( _1 ) -# 507 "parser.ml" +# 506 "parser.ml" : 'pass_param)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 0 : string) in Obj.repr( # 105 "parser.mly" ( _1 ) -# 514 "parser.ml" +# 513 "parser.ml" + : 'pass_param)) +; (fun __caml_parser_env -> + let _1 = (Parsing.peek_val __caml_parser_env 0 : string) in + Obj.repr( +# 106 "parser.mly" + ( _1 ) +# 520 "parser.ml" : 'pass_param)) ; (fun __caml_parser_env -> Obj.repr( -# 109 "parser.mly" +# 110 "parser.mly" ( ) -# 520 "parser.ml" +# 526 "parser.ml" : 'fact)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 3 : 'head) in let _3 = (Parsing.peek_val __caml_parser_env 1 : 'body) in Obj.repr( -# 113 "parser.mly" +# 114 "parser.mly" ( Rule (_1,_3) ) -# 528 "parser.ml" +# 534 "parser.ml" : 'rule)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 0 : 'predicate) in Obj.repr( -# 117 "parser.mly" +# 118 "parser.mly" ( _1 ) -# 535 "parser.ml" +# 541 "parser.ml" : 'head)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 0 : 'litlist) in Obj.repr( -# 121 "parser.mly" +# 122 "parser.mly" ( _1 ) -# 542 "parser.ml" +# 548 "parser.ml" : 'body)) ; (fun __caml_parser_env -> let _2 = (Parsing.peek_val __caml_parser_env 1 : 'predicate) in Obj.repr( -# 125 "parser.mly" +# 126 "parser.mly" ( Query _2 ) -# 549 "parser.ml" +# 555 "parser.ml" : 'query)) ; (fun __caml_parser_env -> Obj.repr( -# 128 "parser.mly" +# 129 "parser.mly" ( [] ) -# 555 "parser.ml" +# 561 "parser.ml" : 'litlist)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 0 : 'literal) in Obj.repr( -# 129 "parser.mly" +# 130 "parser.mly" ( _1 :: [] ) -# 562 "parser.ml" +# 568 "parser.ml" : 'litlist)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 2 : 'litlist) in let _3 = (Parsing.peek_val __caml_parser_env 0 : 'literal) in Obj.repr( -# 130 "parser.mly" +# 131 "parser.mly" ( _3 :: _1 ) -# 570 "parser.ml" +# 576 "parser.ml" : 'litlist)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 0 : 'bodypredicate) in Obj.repr( -# 134 "parser.mly" +# 135 "parser.mly" ( Rel _1 ) -# 577 "parser.ml" +# 583 "parser.ml" : 'literal)) ; (fun __caml_parser_env -> let _2 = (Parsing.peek_val __caml_parser_env 0 : 'bodypredicate) in Obj.repr( -# 135 "parser.mly" +# 136 "parser.mly" ( Not (Rel _2) ) -# 584 "parser.ml" +# 590 "parser.ml" : 'literal)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 0 : 'comparison) in Obj.repr( -# 136 "parser.mly" +# 137 "parser.mly" ( _1 ) -# 591 "parser.ml" +# 597 "parser.ml" : 'literal)) ; (fun __caml_parser_env -> let _2 = (Parsing.peek_val __caml_parser_env 0 : 'comparison) in Obj.repr( -# 137 "parser.mly" +# 138 "parser.mly" ( Not _2 ) -# 598 "parser.ml" +# 604 "parser.ml" : 'literal)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 0 : 'booleanpredicate) in Obj.repr( -# 138 "parser.mly" +# 139 "parser.mly" ( _1 ) -# 605 "parser.ml" +# 611 "parser.ml" : 'literal)) ; (fun __caml_parser_env -> let _2 = (Parsing.peek_val __caml_parser_env 0 : 'booleanpredicate) in Obj.repr( -# 139 "parser.mly" +# 140 "parser.mly" ( Not _2 ) -# 612 "parser.ml" +# 618 "parser.ml" : 'literal)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 3 : string) in let _3 = (Parsing.peek_val __caml_parser_env 1 : 'termlist) in Obj.repr( -# 143 "parser.mly" +# 144 "parser.mly" ( Pred (_1, _3) ) -# 620 "parser.ml" +# 626 "parser.ml" : 'predicate)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 3 : string) in let _3 = (Parsing.peek_val __caml_parser_env 1 : 'bodytermlist) in Obj.repr( -# 147 "parser.mly" +# 148 "parser.mly" ( Pred (_1, _3) ) -# 628 "parser.ml" +# 634 "parser.ml" : 'bodypredicate)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 3 : string) in let _3 = (Parsing.peek_val __caml_parser_env 1 : 'termlist) in Obj.repr( -# 151 "parser.mly" +# 152 "parser.mly" ( BPred (_1, _3) ) -# 636 "parser.ml" +# 642 "parser.ml" : 'booleanpredicate)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 2 : 'term) in let _2 = (Parsing.peek_val __caml_parser_env 1 : 'compsym) in let _3 = (Parsing.peek_val __caml_parser_env 0 : 'term) in Obj.repr( -# 155 "parser.mly" +# 156 "parser.mly" ( Comp (_1, _2, _3) ) -# 645 "parser.ml" - : 'comparison)) -; (fun __caml_parser_env -> - Obj.repr( -# 159 "parser.mly" - ( "<" ) # 651 "parser.ml" - : 'compsym)) + : 'comparison)) ; (fun __caml_parser_env -> Obj.repr( # 160 "parser.mly" - ( ">" ) + ( "<" ) # 657 "parser.ml" : 'compsym)) ; (fun __caml_parser_env -> Obj.repr( # 161 "parser.mly" - ( "<=" ) + ( ">" ) # 663 "parser.ml" : 'compsym)) ; (fun __caml_parser_env -> Obj.repr( # 162 "parser.mly" - ( ">=" ) + ( "<=" ) # 669 "parser.ml" : 'compsym)) ; (fun __caml_parser_env -> Obj.repr( # 163 "parser.mly" - ( "<>" ) + ( ">=" ) # 675 "parser.ml" : 'compsym)) ; (fun __caml_parser_env -> Obj.repr( # 164 "parser.mly" - ( "=" ) + ( "<>" ) # 681 "parser.ml" : 'compsym)) ; (fun __caml_parser_env -> Obj.repr( -# 167 "parser.mly" - ( [] ) +# 165 "parser.mly" + ( "=" ) # 687 "parser.ml" + : 'compsym)) +; (fun __caml_parser_env -> + Obj.repr( +# 168 "parser.mly" + ( [] ) +# 693 "parser.ml" : 'termlist)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 0 : 'term) in Obj.repr( -# 168 "parser.mly" +# 169 "parser.mly" ( _1 :: [] ) -# 694 "parser.ml" +# 700 "parser.ml" : 'termlist)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 2 : 'term) in let _3 = (Parsing.peek_val __caml_parser_env 0 : 'termlist) in Obj.repr( -# 169 "parser.mly" +# 170 "parser.mly" ( _1 :: _3 ) -# 702 "parser.ml" +# 708 "parser.ml" : 'termlist)) ; (fun __caml_parser_env -> Obj.repr( -# 171 "parser.mly" +# 172 "parser.mly" ( [] ) -# 708 "parser.ml" +# 714 "parser.ml" : 'bodytermlist)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 0 : 'bodyterm) in Obj.repr( -# 172 "parser.mly" +# 173 "parser.mly" ( _1 :: [] ) -# 715 "parser.ml" +# 721 "parser.ml" : 'bodytermlist)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 2 : 'bodyterm) in let _3 = (Parsing.peek_val __caml_parser_env 0 : 'bodytermlist) in Obj.repr( -# 173 "parser.mly" +# 174 "parser.mly" ( _1 :: _3 ) -# 723 "parser.ml" +# 729 "parser.ml" : 'bodytermlist)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 0 : string) in Obj.repr( -# 176 "parser.mly" +# 177 "parser.mly" ( ParamS _1 ) -# 730 "parser.ml" +# 736 "parser.ml" : 'term)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 0 : int) in Obj.repr( -# 177 "parser.mly" +# 178 "parser.mly" ( ParamI _1 ) -# 737 "parser.ml" +# 743 "parser.ml" : 'term)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 0 : string) in Obj.repr( -# 180 "parser.mly" +# 181 "parser.mly" ( ParamS _1 ) -# 744 "parser.ml" +# 750 "parser.ml" : 'bodyterm)) ; (fun __caml_parser_env -> let _1 = (Parsing.peek_val __caml_parser_env 0 : int) in Obj.repr( -# 181 "parser.mly" +# 182 "parser.mly" ( ParamI _1 ) -# 751 "parser.ml" +# 757 "parser.ml" : 'bodyterm)) ; (fun __caml_parser_env -> Obj.repr( -# 182 "parser.mly" +# 183 "parser.mly" ( ParamS "_ANONVAR_" ) -# 757 "parser.ml" +# 763 "parser.ml" : 'bodyterm)) (* Entry main *) ; (fun __caml_parser_env -> raise (Parsing.YYexit (Parsing.peek_val __caml_parser_env 0)))