Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Grigory's manual merge

  • Loading branch information...
commit 94afda650cd3090a059dab723f0e24b9cfe6473e 1 parent 671c5d9
@ckroxigor ckroxigor authored
View
1  .gitignore
@@ -7,6 +7,5 @@
*.cmx
*.cmxs
*.cmxa
-*.dat
*~
yadi
View
272 eval.ml
@@ -21,6 +21,12 @@ Hashtbl.replace hash_schema "Dummy" [""];;
Hashtbl.remove hash_schema "Dummy";;
+(*Count how many time a given string appers in the list of strings*)
+let count s l =
+ List.length (List.filter(fun x -> (String.compare x s) == 0)l)
+;;
+
+
(* Store the schema to a variable *)
let store_schema (conn:Postgresql.connection) res =
Hashtbl.reset hash_schema;
@@ -64,19 +70,19 @@ let get_command c = match c with
;;
-let eval_command c aux_arg outch = match c with
+let eval_command c aux_arg = match c with
| TestComm p -> printf "This is the first test command! Argument is %s\n" p; aux_arg := ""; "";
| ReconnComm (host_name, port_name, user_name, password_name, db_name) -> aux_arg := "reconnect"; "host=" ^ host_name ^ " port=" ^ string_of_int port_name ^ " user=" ^ user_name ^ " password=" ^ password_name ^ " dbname=" ^ db_name;
| ChangeOutComm f -> aux_arg := "changeout"; f;
| ReadScriptComm f -> aux_arg := "readscript"; f;
| HelpCommand h -> (match h with
- | Select -> aux_arg := ""; fprintf outch "Form the query as Head(x) :- Body(x,y)., which selects x from the table.\nExample: Q(x) :- R(x,y). \n"; flush outch; "";
- | Join -> aux_arg := ""; fprintf outch "Use 'and' to perform the join, such as Head(x,z) :- Body1(x,y) and Body2(y,z)., which performs join on Body1.y = Body2.y.\nExample: Q(x,Z) :- R(x,y) and P(y,z). \n"; flush outch; "";
- | Where -> aux_arg := ""; fprintf outch "Use 'and' to add WHERE condition, such as Head(x) :- Body1(x,y) and y \'comparison\' \'condition\'.\n\nFollowing symbols are permitted as \'comparison\': <, >, =, <=, >=, <> (not equal).\nConstant or variable is permitted as \'condition\'.\n\nExample1: Q(x) :- R(x,y) and y=6. \nExample2: Q(x) :- R(x,y,z) and y<z.\n"; flush outch; "";
- | WhereNot -> aux_arg := ""; fprintf outch "WHERE NOT clause can be expressed in two ways:\n\n1.in the WHERE condition with adding \'not\' before condition\n\nExample1: Q(x) :- R(x,y) and not y=6.\n\n\n2.by putting \'not\' keyword in front of relation in the body, which we want to negate\n\nExample2: Q(x) :- not R(x,y,z) and y<3.\n"; flush outch; "";
- | Other -> aux_arg := "unknown"; fprintf stderr "Enter valid SQL keyword to see help!\n"; flush stderr; "";)
- | TabinfoCommand table_name -> aux_arg := "tabinfo"; "select column_name, data_type, is_nullable from information_schema.columns where table_name=\'" ^ table_name ^ "\';";
- | GettablesCommand -> aux_arg := "tabinfo"; "SELECT table_name FROM information_schema.tables WHERE table_schema = 'public';";
+ | Select -> aux_arg := ""; fprintf stdout "Form the query as Head(x) :- Body(x,y)., which selects x from the table.\nExample: Q(x) :- R(x,y). \n"; flush stdout; "";
+ | Join -> aux_arg := ""; fprintf stdout "Use 'and' to perform the join, such as Head(x,z) :- Body1(x,y) and Body2(y,z)., which performs join on Body1.y = Body2.y .\nExample: Q(x,Z) :- R(x,y) and P(y,z). \n"; flush stdout; "";
+ | Where -> aux_arg := ""; fprintf stdout "Use 'and' to add WHERE condition, such as Head(x) :- Body1(x,y) and y \'comparison\' \'condition\'.\n\nFollowing symbols are permitted as \'comparison\': <, >, =, <=, >=, <> (not equal).\nConstant or variable is permitted as \'condition\'.\n \nExample1: Q(x) :- R(x,y) and y=6. \nExample2: Q(x) :- R(x,y,z) and y<z.\n"; flush stdout; "";
+ | WhereNot -> aux_arg := ""; fprintf stdout "WHERE NOT clause can be expressed in two ways:\n \n1.in the WHERE condition with adding \'not\' before condition\n \nExample1: Q(x) :- R(x,y) and not y=6.\n \n \n2.by putting \'not\' keyword in front of relation in the body, which we want to negate\n \nExample2:Q(x) :- not R(x,y,z) and y<3.\n"; flush stdout; "";
+ | Other -> aux_arg := "unknown"; fprintf stderr "Enter valid SQL keyword to see help!\n"; flush stderr; "";)
+ | TabinfoCommand table_name -> aux_arg := "tabinfo"; "select column_name, data_type, is_nullable from information_schema.columns where table_name=\'" ^ table_name ^ "\';";
+ | GettablesCommand -> aux_arg := "tabinfo"; "SELECT table_name FROM information_schema.tables WHERE table_schema = 'public';";
| GetdbCommand -> aux_arg := "tabinfo"; "SELECT datname FROM pg_database;";
| QuitCommand -> aux_arg := "quit"; fprintf stderr "Thanks for usage of YADI!\n"; flush stderr; "quit";
| UnknownCommand -> aux_arg := "unknown"; fprintf stderr "This command is not defined yet!\n"; flush stderr; "";
@@ -124,8 +130,7 @@ let rec get_predname t = match t with
| Rel r -> ( match r with
| Pred (x, vl) -> x
)
- | Comp (s, c, i) -> s
- | Comp2 (s, c, i) -> s
+ | Comp (s, c, i) -> c
| Not t -> get_predname t
| BPred (x, vl) -> x
;;
@@ -135,8 +140,7 @@ let rec get_varlist t = match t with
| Rel r -> ( match r with
| Pred (x, vl) -> vl
)
- | Comp (s, c, i) -> s :: []
- | Comp2 (s, c, s2) -> s :: []
+ | Comp (s, c, i) -> s :: [i]
| Not t -> get_varlist t
| BPred (x, vl) -> vl
;;
@@ -181,21 +185,28 @@ let rec search_non_empty_list l pos =
;;
let prepare_literal l = match l with
- | Rel r -> [get_predname(l); (String.concat "," (get_varlist (l)))]
- | Comp (s, c, i) -> [get_predname(l); c; string_of_int i]
- | Comp2 (s, c, i) -> [get_predname(l); c; i]
+ | Rel r -> [get_predname(l); (String.concat "," (List.map(fun x -> param_to_string x)(get_varlist l)))]
+ | Comp (s, c, i) -> [Expr.param_to_string s; c; Expr.param_to_string i]
| Not t -> []
| BPred (x, vl) -> let len = List.length vl in
match x with
| "_isEven" -> if len != 1 then raise (QueryError ("Boolean predicate '_isEven' expects one parameter."))
- else [List.hd vl; "%2 = 0"]
+ else [param_to_string (List.hd vl); "%2 = 0"]
| "_isOdd" -> if len != 1 then raise (QueryError ("Boolean predicate '_isOdd' expects one parameter."))
- else [List.hd vl; "%2 = 1"]
+ else [param_to_string (List.hd vl); "%2 = 1"]
| _ -> raise (QueryError ("Unrecognized boolean predicate '"^x^"'."))
;;
let split_relation l =
- [get_predname(l); (String.concat "," (get_varlist (l)))]
+ [get_predname(l); (String.concat "," (List.map(fun x -> param_to_string x)(get_varlist l)))]
+;;
+
+let relation_head l =
+ get_predname(l)
+;;
+
+let relation_tail l =
+ (get_varlist l)
;;
let extract_term_from_not l = match l with
@@ -276,15 +287,38 @@ let prepare_variables_selection cols as_name =
let hash_names = Hashtbl.create 10 in
Hashtbl.add hash_names "_ANONVAR_" 1; (* ignoring anonymous variables *)
(String.concat ", " (List.filter(fun x -> (String.compare x "") != 0) (List.mapi(fun n x ->
- begin
- try
- let _ = Hashtbl.find hash_names x in
- ""
- with Not_found ->
- Hashtbl.add hash_names x 1;
- (*Init the list in the hash*)
- (List.nth cols n)^" AS "^x
- end
+ match x with
+ | ParamI i -> ""
+ | ParamS s ->
+ begin
+ try
+ let _ = Hashtbl.find hash_names s in
+ ""
+ with Not_found ->
+ (*Init the list in the hash*)
+ Hashtbl.add hash_names s 1;
+ (param_to_string (List.nth cols n))^" AS "^s
+ end
+ ) as_name)))
+;;
+
+(*Returns an string containing the select information deleting the repeated names for strings in cols*)
+let s_prepare_variables_selection cols as_name =
+ let hash_names = Hashtbl.create 10 in
+ Hashtbl.add hash_names "_ANONVAR_" 1; (* ignoring anonymous variables *)
+ (String.concat ", " (List.filter(fun x -> (String.compare x "") != 0) (List.mapi(fun n x ->
+ match x with
+ | ParamI i -> ""
+ | ParamS s ->
+ begin
+ try
+ let _ = Hashtbl.find hash_names s in
+ ""
+ with Not_found ->
+ (*Init the list in the hash*)
+ Hashtbl.add hash_names s 1;
+ (List.nth cols n)^" AS "^s
+ end
) as_name)))
;;
@@ -292,59 +326,147 @@ let prepare_variables_selection cols as_name =
let generate_select_restrictions cols as_name =
let hash_names = Hashtbl.create 10 in
(List.filter(fun x -> (String.compare x "") != 0) (List.mapi(fun n x ->
- begin
- try
- let c = Hashtbl.find hash_names x in
- (List.nth cols n)^" = "^c
- with Not_found ->
- (*Init the list in the hash*)
- if ((String.compare x "_ANONVAR_") != 0) then (* ignoring anonymous variables *)
- Hashtbl.add hash_names x (List.nth cols n);
- ""
- end
+ match x with
+ | ParamI i -> (param_to_string (List.nth cols n))^" = "^string_of_int i
+ | ParamS s ->
+ begin
+ try
+ let c = Hashtbl.find hash_names x in
+ (param_to_string (List.nth cols n))^" = "^c
+ with Not_found ->
+ (*Init the list in the hash*)
+ if ((String.compare s "_ANONVAR_") != 0) then (* ignoring anonymous variables *)
+ Hashtbl.add hash_names x (param_to_string (List.nth cols n));
+ ""
+ end
) as_name))
;;
+(*Returns a list of queries generated by repeated variables in the predicates for string in the columns*)
+let s_generate_select_restrictions cols as_name =
+ let hash_names = Hashtbl.create 10 in
+ (List.filter(fun x -> (String.compare x "") != 0) (List.mapi(fun n x ->
+ match x with
+ | ParamI i -> (List.nth cols n)^" = "^string_of_int i
+ | ParamS s ->
+ begin
+ try
+ let c = Hashtbl.find hash_names x in
+ (List.nth cols n)^" = "^c
+ with Not_found ->
+ (*Init the list in the hash*)
+ if ((String.compare s "_ANONVAR_") != 0) then (* ignoring anonymous variables *)
+ Hashtbl.add hash_names x (List.nth cols n);
+ ""
+ end
+ ) as_name))
+;;
+
+(*Preprare recursive table names*)
+let prepare_variables_selection_rec_queries name cols =
+ List.mapi(fun n x -> (ParamS("_attr"^(string_of_int n)^"_"))) cols
+;;
+
+let prepare_recursive_call name cols =
+ let rec_col_names = prepare_variables_selection_rec_queries name cols in
+ let where_clauses = generate_select_restrictions rec_col_names cols in
+ let sel = (prepare_variables_selection rec_col_names cols) in
+ let where_str = if List.length where_clauses > 0 then " WHERE "^(String.concat " AND " where_clauses) else "" in
+ "(SELECT "^sel^" FROM "^name^where_str^") AS foo"
+;;
+
+let with_str = ref [];;
+let with_keys = ref[];;
+
(* Subquery generator *)
let rec get_subquery e name col_names =
- let num_queried_columns = (List.length(Str.split (Str.regexp ",") col_names)) in
+ let num_anonym_columns = List.length (List.filter(fun x -> (String.compare (match x with
+ | ParamI i -> string_of_int i
+ | ParamS s -> s
+ ) "_ANONVAR_") == 0) (col_names)) in
+ let num_queried_columns = List.length col_names in
(*Printf.printf "Parameters(%i): '%s'\n" (List.length(Str.split (Str.regexp ",") col_names)) col_names;*)
(*Printf.printf "Call %s\n" name; flush stdout;*)
let predicates = get_fullrelation e name in
if ((List.length predicates) = 0) then
(*It's an edb*)
let edb_cols = get_column name in
+ if num_queried_columns == num_anonym_columns then
+ raise (QueryError ("Relation '"^name^"' should have at least 1 non anymous variable!"));
if num_queried_columns > (List.length edb_cols) then
raise (QueryError ("Relation '"^name^"' has "^(string_of_int (List.length edb_cols))^" columns but you queried "^(string_of_int num_queried_columns)^"."))
else
"(SELECT "^
- (prepare_variables_selection (get_column name) (Str.split (Str.regexp ",") col_names) )^
+ (s_prepare_variables_selection edb_cols col_names )^
" FROM "^
name^
- (let where = generate_select_restrictions (get_column name) (Str.split (Str.regexp ",") col_names) in
+ (let where = s_generate_select_restrictions edb_cols col_names in
if List.length where > 0 then " WHERE "^(String.concat " AND " where )
else "")^
") AS foo"
else
+ let is_recursive = List.exists(
+ fun predicate -> List.exists (
+ fun elem -> match elem with
+ | Rel l -> (String.compare (relation_head(elem)) name) == 0
+ | _ -> false ) (get_rel predicate)) predicates in
+ (*If recursive check restrictions*)
+ if is_recursive then (
+ let num_rec_def = ref 0 in
+ List.iter(
+ fun predicate ->
+ let times = (count name (List.map(fun elem -> match elem with | Rel l -> relation_head(elem) | _ -> "")(get_rel predicate))) in
+ if times > 1 then
+ raise(QueryError ("Error: Predicate "^name^" appears "^(string_of_int times)^" times in its recursive defition."))
+ else if times == 1 then num_rec_def := num_rec_def.contents + 1
+ ) predicates;
+ if num_rec_def.contents > 1 then raise(QueryError("Error: There are too many("^(string_of_int num_rec_def.contents)^") recursive defintions for "^name^".")) );
+ (*Sort the predicates if necessary (just for recursice queries)*)
+ let spredicates = if is_recursive then
+ List.append (List.filter(fun predicate -> not (List.exists (
+ fun elem -> match elem with
+ | Rel l -> (String.compare (relation_head(elem)) name) == 0
+ | _ -> false ) (get_rel predicate))) predicates)
+ (List.filter(fun predicate -> List.exists (
+ fun elem -> match elem with
+ | Rel l -> (String.compare (relation_head(elem)) name) == 0
+ | _ -> false ) (get_rel predicate)) predicates)
+
+ else predicates in
+ (*Printf.printf "Is recursive: %b\n" is_recursive;*)
let sub_selects = List.map (fun predicate ->
let head_cols = get_head_attibutes predicate in
- (*Printf.printf "Head columns(%i): %s\n" (List.length head_cols) (String.concat ", " head_cols);*)
+ (*Printf.printf "Head columns(%i): %s\n" (List.length head_cols) (String.concat "," (List.map(fun x -> param_to_string x) head_cols));*)
let lrel = get_rel predicate in
(*Printf.printf "Number of relations: %i\n" (List.length lrel);*)
+ if num_queried_columns == num_anonym_columns then
+ raise (QueryError ("Relation '"^name^"' should have at least 1 non anymous variable!"));
if num_queried_columns > (List.length head_cols) then
raise (QueryError ("Relation '"^name^"' has "^(string_of_int (List.length head_cols))^" columns but you queried "^(string_of_int num_queried_columns)^"."))
else
- let sel = (prepare_variables_selection head_cols (Str.split (Str.regexp ",") col_names)) in
+ let col_names2 = (if is_recursive then prepare_variables_selection_rec_queries name col_names else col_names) in
+ (*Printf.printf "col_names2(%i): %s\n" (List.length head_cols) (String.concat "," (List.map(fun x -> param_to_string x) col_names2));*)
+ let sel = (prepare_variables_selection head_cols col_names2) in
(String.concat " " [
"SELECT";
sel;
"FROM";
- (gen_sub_tables e lrel (Str.split (Str.regexp ",") col_names) head_cols);
+ (gen_sub_tables e lrel col_names2 head_cols name);
])
- ) predicates in
- "("^(String.concat " UNION " sub_selects)^") AS foo"
-(*gen_sub_tables e: tree l:relation sel:columns to select sel_as: selected attributes name*)
-and gen_sub_tables e l sel sel_as =
+ ) spredicates in
+ if not is_recursive then "("^(String.concat " UNION " sub_selects)^") AS foo"
+ else let head_cols = prepare_variables_selection_rec_queries name col_names in
+ let where_clauses = (generate_select_restrictions head_cols col_names) in
+ let where_str = if List.length where_clauses > 0 then " WHERE "^(String.concat " AND " where_clauses) else "" in
+ (*Printf.printf "Clauses over the recursive query(%i): %s\n" (List.length where_clauses) where_str;*)
+ let vars_rec = (String.concat ", " (List.map(fun x -> param_to_string x) head_cols)) in
+ let vars = (prepare_variables_selection head_cols col_names) in
+ if not(List.exists(fun x-> (String.compare x name) == 0)with_keys.contents) then
+ with_str := List.append with_str.contents [name^"("^vars_rec^") AS ("^(String.concat " UNION " sub_selects)^")"];
+ with_keys := List.append with_keys.contents [name];
+ "(SELECT "^vars^" FROM "^name^where_str^") AS foo"
+(*gen_sub_tables e: tree l:relation sel:columns to select sel_as: selected attributes name; name: current relation name*)
+and gen_sub_tables e l sel sel_as name =
(*Initialize empty lists*)
let from = ref [] in (*Contains the string queries of the not negated relations*)
let where = ref (generate_select_restrictions sel_as sel) in (*Contains the string of the restrictions applied to the not negated relations*)
@@ -357,56 +479,53 @@ and gen_sub_tables e l sel sel_as =
(*Generate the table expressions for the from*)
let tables = List.filter (fun x -> match x with | Rel r -> true | _ -> false) l in
for ntable = 0 to List.length tables - 1 do
- let table = split_relation(List.nth tables ntable) in
- let table_name = List.nth table 0 in
- let col_names = List.nth table 1 in
- from := List.append from.contents [(get_subquery e table_name col_names)^(string_of_int num_table.contents)];
+ let table_name = relation_head (List.nth tables ntable) in
+ let col_names = relation_tail (List.nth tables ntable) in
+ from := List.append from.contents [
+ if (String.compare name table_name) == 0 then
+ (*Recursive query*)
+ (prepare_recursive_call name col_names)^(string_of_int num_table.contents)
+ else (get_subquery e table_name col_names)^(string_of_int num_table.contents)];
num_table := num_table.contents + 1;
- vars_from := List.append vars_from.contents (Str.split (Str.regexp ",") col_names);
+ vars_from := List.append vars_from.contents (List.filter(fun x -> match x with | ParamS s -> true | ParamI i -> false) col_names);
done;
(*Process the equalities*)
let comparisons = List.filter (fun x -> match x with
| Comp(s, c, i) -> true
- | Comp2(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
let equ = (String.concat " " info) in
if match List.nth comparisons nequ with
- | Comp(s, c, i) -> List.exists (fun x -> (String.compare (List.nth info 0) x) == 0) vars_from.contents
- | Comp2(s, c, i) -> List.exists (fun x -> (String.compare (List.nth info 0) x) == 0) vars_from.contents &&
- List.exists(fun x -> (String.compare (List.nth info 2) x) == 0) vars_from.contents
- | BPred (x, vl) -> List.exists (fun x -> List.exists(fun y -> (String.compare y x) == 0) vl) vars_from.contents
+ | 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 where_not_in := List.append where_not_in.contents [equ]
done;
+ (*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
List.iter(fun x-> match x with
- | Rel r -> not_in := List.append not_in.contents [(get_subquery e (get_predname(Rel r)) (String.concat "," (get_varlist(Rel r))))^(string_of_int num_table.contents)];
+ | 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;
vars_not_in := List.append vars_not_in.contents (get_varlist(Rel r))
- | Comp (s, c, i) -> let info = prepare_literal x in
- if List.exists(fun x -> (String.compare (List.hd info) x) == 0) vars_from.contents
- then where := List.append where.contents ["NOT "^(String.concat " " (prepare_literal(x)))]
- else where_not_in := List.append where_not_in.contents ["NOT "^(String.concat " " (prepare_literal(x)))]
- | Comp2(s, c, i) -> let info = prepare_literal x in
- if List.exists(fun x -> (String.compare (List.hd info) x) == 0) vars_from.contents &&
- List.exists(fun x -> (String.compare (List.nth info 2) x) == 0) vars_from.contents
+ | Comp (s, c, i) -> if 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]
then where := List.append where.contents ["NOT "^(String.concat " " (prepare_literal(x)))]
else where_not_in := List.append where_not_in.contents ["NOT "^(String.concat " " (prepare_literal(x)))]
- | BPred(s, vl) -> if List.exists (fun x -> List.exists(fun y -> (String.compare y x) == 0) vl) vars_from.contents
+ | BPred(s, vl) -> if 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
then where := List.append where.contents ["NOT "^(String.concat " " (prepare_literal(x)))]
else where_not_in := List.append where_not_in.contents ["NOT "^(String.concat " " (prepare_literal(x)))]
| Not t -> invalid_arg "Error: Not Not Clause!!!") sub_nots;
(*Check query safety*)
(*1st check that all selected variables are in a not negated relation*)
- List.iter(fun x -> if not (List.exists(fun y -> (String.compare x y) == 0) vars_from.contents)
- then raise (QueryError ("Variable '"^x^"' is not safe."))) sel_as;
+ List.iter(fun x -> if not (List.exists(fun y -> (String.compare (param_to_string x) (param_to_string y)) == 0 || (match x with | ParamS s -> false | ParamI i -> true)) vars_from.contents)
+ then raise (QueryError ("Variable '"^(param_to_string x)^"' is not safe."))) sel_as;
(*Generate the result*)
let str_from = String.concat " NATURAL JOIN " from.contents in
let str_where =
@@ -425,15 +544,20 @@ and gen_sub_tables e l sel sel_as =
(* generate SQL statement from the ast *)
-let sql_stt e = String.concat ""
- ["SELECT DISTINCT ";
- (String.concat ", " (get_varlist(match (get_query e) with
- Query p -> Rel p | _ -> invalid_arg "is_prog")));
+let sql_stt e =
+ with_str := [];
+ with_keys := [];
+ String.concat ""
+ [if List.length with_str.contents > 0 then "WITH RECURSIVE " else "";
+ String.concat ", " with_str.contents;
+ "SELECT DISTINCT ";
+ (String.concat ", " (List.map(fun x -> param_to_string x)(get_varlist(match (get_query e) with
+ Query p -> Rel p | _ -> invalid_arg "is_prog"))));
" FROM " ;
( get_subquery e (get_predname(match (get_query e) with
Query p -> Rel p | _ -> invalid_arg "is_prog"))
- (String.concat "," (get_varlist(match (get_query e) with
- Query p -> Rel p | _ -> invalid_arg "is_prog"))));
+ (get_varlist(match (get_query e) with
+ Query p -> Rel p | _ -> invalid_arg "is_prog")));
]
;;
View
162 examples.lang
@@ -56,7 +56,7 @@ Q(x,y) :- Test(x,y) and x=1.
?-Q(b,c).
/
-Q(x) :- Test(x,1).
+Q(x) :- Test(1,x).
?-Q(b).
/
@@ -84,6 +84,10 @@ Q(x,a,b):-Names(x,y,z) and Marks(x,a,b) and b = 75.
?-Q(x,a,b).
/
+Q(x,a):-Names(x,y,z) and Marks(x,a,75).
+?-Q(x,a).
+/
+
Q(x,a,b):-Marks(x,a,b).
?-Q(x,a,b).
/
@@ -107,6 +111,7 @@ Q(y):-Student(x,z,a) and not Enroll(x,y,b) and z=200.
R(x):-Enroll(a,x,b) and not Q(x).
?-R(x).
/
+Errors ==> Variable 'y' is not safe.
Q(id,descr) :- Test(id,descr).
R(id,descr) :- Q(id,descr).
@@ -178,6 +183,18 @@ Q(x,y,z):-Marks(x,y,z) and not x = z.
?-Q(x,y,z).
/
+Q(x,y,z):-Marks(x,y,z) and not x = x.
+?-Q(x,y,z).
+/
+
+Q(x,y,z):-Marks(x,y,z) and not x = 3.
+?-Q(x,y,z).
+/
+
+Q(x,y,z):-Marks(x,y,z) and not 3 = x.
+?-Q(x,y,z).
+/
+
Q(x,y,z):-Names(x,y,z) and not Marks(x,a,b) and x = b.
?-Q(x,a,b).
/
@@ -259,6 +276,148 @@ Q(x,y,z):-Marks(x,y,z) and _isOdd(z).
?-Q(x,y,z).
/
+Q(x,y):-Marks(x,y,100).
+?-Q(x,y).
+/
+
+Q(x,y,100):-Marks(x,y,100).
+?-Q(x,y,101).
+/
+
+R(x,y,z):-Marks(x,y,z).
+Q(x,y):-R(3,y,x).
+?-Q(x,y).
+/
+
+Q(x,y):-Marks(3,y,x).
+?-Q(x,y).
+/
+
+Q(y):-Marks(3,y,100).
+?-Q(y).
+/
+
+Q(x,y,z):-Marks(x,y,z) and _isOdd(1).
+?-Q(x,y,z).
+/
+
+Q(x,1,z):-Marks(x,y,z).
+?-Q(x,y,z).
+/
+
+Q(x,1,z):-Marks(x,_,z).
+?-Q(x,y,z).
+/
+
+Q(0,1,2):-Marks(x,y,z).
+?-Q(x,y,z).
+/
+
+Q(0,1,2):-Marks(x,y,z).
+Q(2,1,0):-Marks(x,y,z).
+?-Q(x,y,z).
+/
+
+Q(x,y,z):-Marks(x,y,z).
+?-Q(1,y,z).
+/
+
+Q(x,y):-Marks(x,y,y).
+?-Q(1,y).
+/
+
+Q(x,y,z):-Marks(x,y,z).
+R(x,y):-Q(x,y,75).
+?-R(x,y).
+/
+
+Q(x,y,z):-Marks(x,y,z).
+Q(x,y,101):-Q(x,y,75).
+?-Q(x,y,z).
+/
+
+Q(x,y,101):-Q(x,y,75).
+Q(x,y,z):-Marks(x,y,z).
+?-Q(x,y,z).
+/
+
+Q(x,y,z):-Marks(x,y,z).
+Q(x,y,105):-Q(x,y,z).
+R(a,b):-Q(a,b,50).
+?-R(c,d).
+/
+
+Q(x,1):-Marks(x).
+Q(c,2):-Q(c).
+?-Q(a,b).
+/
+
+Q(x,y,z):-Marks(x,y,z).
+Q(x,y,105):-Marks(x,y,z).
+Q(x,y,102):-Q(x,y,75).
+?-Q(x,y,z).
+/
+
+Reach(a,b):- Links(l,a,b).
+Reach(b,a):- Links(l,a,b).
+Reach(x,y):- Reach(x,z) and Links(a,z,y).
+?-Reach(a, b).
+/
+
+Reacha(a,b):- Links(l,a,b).
+Reacha(a,c):- Reacha(a,b) and Links(l,b,c).
+Reachb(b,a):- Links(l,a,b).
+Reachb(c,a):- Reachb(a,b) and Links(l,b,c).
+Reach(a,c):- Reacha(a,b) and Reachb(b,c).
+?-Reach(a, b).
+/
+
+Connections(a,b):- Links(l,a,b).
+Connections(b,a):- Links(l,a,b).
+Reach(a,b):-Connections(a,b).
+Reach(a,c):-Reach(a,b) and Connections(b,c).
+?-Reach(a, b).
+/
+
+Connections(a,b):- Links(l,a,b).
+Connections(b,a):- Links(l,a,b).
+Reach(a,b):-Connections(a,b).
+Reach(a,c):-Reach(a,b) and Connections(b,c).
+?-Reach(a, a).
+/
+
+Connections(a,b):- Links(l,a,b).
+Connections(b,a):- Links(l,a,b).
+Reach(a,b):-Connections(a,b).
+Reach(a,c):-Reach(a,b) and Connections(b,c).
+Tmp(a,a):-Reach(a, a).
+?-Tmp(a, a).
+/
+
+Connections(a,b):- Links(l,a,b).
+Connections(b,a):- Links(l,a,b).
+Reach(a,b):-Connections(a,b).
+Reach(a,c):-Reach(a,b) and Reach(b,c).
+?-Reach(a, b).
+/
+Error ==> Error: Predicate Reach appears 2 times in its recursive defition.
+
+Connections(a,b):- Links(l,a,b).
+Connections(b,a):- Links(l,a,b).
+Reach(a,b):-Connections(a,b).
+Reach(a,c):-Reach(a,b) and Connections(b,c).
+Reach(a,c):-Reach(a,b) and Connections(b,c).
+?-Reach(a, b).
+/
+Error ==> Error: There are too many(2) recursive defintions for Reach.
+
+Q(x,y,z):-Marks(x,y,z).
+Q(x,y,101):-Q(x,y,75).
+R(x,y,z,1):-Q(x,y,z).
+R(x,y,z,2):-Q(x,y,z).
+?-R(x,y,z,t).
+/
+
(*command examples*)
#help select/
@@ -274,3 +433,4 @@ Q(x,y,z):-Marks(x,y,z) and _isOdd(z).
#changeout stdout/
#reconnect localhost 5432 postgres postgres test_db/
#quit/
+
View
27 expr.ml
@@ -6,12 +6,14 @@ type expr =
| Comm of stt (*later it would be stt list!!!*)
and term =
| Rel of rterm
- | Comp of string * string * int
- | Comp2 of string * string * string
+ | Comp of param * string * param
| Not of term
- | BPred of string * string list
+ | BPred of string * param list
and rterm =
- | Pred of string * string list
+ | Pred of string * param list
+and param =
+ | ParamS of string
+ | ParamI of int
and stt =
| TestComm of string
| ReconnComm of string * int * string * string * string
@@ -35,20 +37,25 @@ and helpp =
(* to be continued... *)
;;
+let param_to_string p =
+ match p with
+ | ParamS s -> s
+ | ParamI i -> string_of_int i
+;;
+
(* support function for smart stringify of the AST - see to_string below *)
let string_of_rterm r = match r with
- | Pred (x, []) -> x ^ "()"
- | Pred (x, h::[]) -> x ^ "(" ^ h ^ ")"
- | Pred (x, h::t) -> x ^ "(" ^ h ^ List.fold_right (fun s acc -> acc ^ "," ^ s) t "" ^ ")"
+ | Pred (x, []) -> x
+ | Pred (x, h::[]) -> x ^ "(" ^ param_to_string h ^ ")"
+ | Pred (x, h::t) -> x ^ "(" ^ param_to_string h ^ List.fold_right (fun s acc -> acc ^ "," ^ param_to_string s) t "" ^ ")"
;;
(* support function for smart stringify of the AST - see to_string below *)
let rec string_of_term t = match t with
| Rel r -> string_of_rterm r
- | Comp (s1, c, i) -> s1 ^ c ^ string_of_int i
- | Comp2(s1, c, s2) -> s1 ^ c ^ s2
+ | Comp (s1, c, i) -> param_to_string s1 ^ c ^ param_to_string i
| Not t -> "not " ^ string_of_term t
- | BPred (x, vl) -> x^"("^(String.concat "," vl)^")"
+ | BPred (x, vl) -> x^"("^(String.concat "," (List.map(fun x -> param_to_string x)vl))^")"
;;
(* support function for smart stringify of the AST - see to_string below *)
View
493 lexer.ml
@@ -7,154 +7,154 @@
# 8 "lexer.ml"
let __ocaml_lex_tables = {
Lexing.lex_base =
- "\000\000\232\255\003\000\030\000\238\255\239\255\240\255\241\255\
- \014\000\048\000\244\255\078\000\156\000\182\000\004\001\082\001\
- \160\001\238\001\254\255\255\255\060\002\138\002\216\002\038\003\
- \253\255\116\003\142\003\243\255\242\255\233\255\235\255\234\255\
- ";
+ "\000\000\230\255\231\255\232\255\003\000\030\000\238\255\239\255\
+ \240\255\241\255\014\000\048\000\244\255\078\000\160\000\186\000\
+ \008\001\086\001\164\001\242\001\254\255\255\255\064\002\142\002\
+ \220\002\042\003\253\255\120\003\146\003\243\255\242\255\233\255\
+ \235\255\234\255";
Lexing.lex_backtrk =
- "\255\255\255\255\019\000\018\000\255\255\255\255\255\255\255\255\
- \255\255\255\255\255\255\010\000\008\000\255\255\005\000\004\000\
- \003\000\008\000\255\255\255\255\009\000\008\000\008\000\008\000\
- \255\255\006\000\007\000\255\255\255\255\255\255\255\255\255\255\
- ";
+ "\255\255\255\255\255\255\255\255\019\000\018\000\255\255\255\255\
+ \255\255\255\255\025\000\025\000\255\255\010\000\008\000\025\000\
+ \005\000\004\000\003\000\008\000\255\255\255\255\009\000\008\000\
+ \008\000\008\000\255\255\006\000\007\000\255\255\255\255\255\255\
+ \255\255\255\255";
Lexing.lex_default =
- "\255\255\000\000\255\255\255\255\000\000\000\000\000\000\000\000\
- \255\255\255\255\000\000\255\255\255\255\255\255\255\255\255\255\
- \255\255\255\255\000\000\000\000\255\255\255\255\255\255\255\255\
- \000\000\255\255\255\255\000\000\000\000\000\000\000\000\000\000\
- ";
+ "\001\000\000\000\000\000\000\000\255\255\255\255\000\000\000\000\
+ \000\000\000\000\255\255\255\255\000\000\255\255\255\255\255\255\
+ \255\255\255\255\255\255\255\255\000\000\000\000\255\255\255\255\
+ \255\255\255\255\000\000\255\255\255\255\000\000\000\000\000\000\
+ \000\000\000\000";
Lexing.lex_trans =
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
- \000\000\019\000\018\000\000\000\000\000\000\000\000\000\000\000\
+ \000\000\021\000\020\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
- \019\000\000\000\000\000\013\000\000\000\000\000\000\000\000\000\
- \006\000\005\000\000\000\000\000\007\000\011\000\010\000\001\000\
- \015\000\015\000\015\000\015\000\015\000\015\000\015\000\015\000\
- \015\000\015\000\009\000\028\000\003\000\004\000\002\000\008\000\
- \031\000\014\000\014\000\014\000\014\000\014\000\014\000\014\000\
+ \021\000\000\000\000\000\015\000\000\000\000\000\000\000\000\000\
+ \008\000\007\000\000\000\000\000\009\000\013\000\012\000\003\000\
+ \017\000\017\000\017\000\017\000\017\000\017\000\017\000\017\000\
+ \017\000\017\000\011\000\030\000\005\000\006\000\004\000\010\000\
+ \033\000\016\000\016\000\016\000\016\000\016\000\016\000\016\000\
+ \016\000\016\000\016\000\016\000\016\000\016\000\016\000\016\000\
+ \016\000\016\000\016\000\016\000\016\000\016\000\016\000\016\000\
+ \016\000\016\000\016\000\032\000\031\000\029\000\000\000\018\000\
+ \000\000\014\000\014\000\014\000\014\000\014\000\014\000\014\000\
\014\000\014\000\014\000\014\000\014\000\014\000\014\000\014\000\
\014\000\014\000\014\000\014\000\014\000\014\000\014\000\014\000\
- \014\000\014\000\014\000\030\000\029\000\027\000\000\000\016\000\
- \000\000\012\000\012\000\012\000\012\000\012\000\012\000\012\000\
- \012\000\012\000\012\000\012\000\012\000\012\000\012\000\012\000\
- \012\000\012\000\012\000\012\000\012\000\012\000\012\000\012\000\
- \012\000\017\000\012\000\011\000\000\000\000\000\011\000\011\000\
- \011\000\011\000\011\000\011\000\011\000\011\000\011\000\011\000\
- \000\000\000\000\000\000\000\000\000\000\000\000\000\000\011\000\
- \011\000\011\000\011\000\011\000\011\000\011\000\011\000\011\000\
- \011\000\011\000\011\000\011\000\011\000\011\000\011\000\011\000\
- \011\000\011\000\011\000\011\000\011\000\011\000\011\000\011\000\
- \011\000\000\000\000\000\000\000\000\000\011\000\000\000\011\000\
- \011\000\011\000\011\000\011\000\011\000\011\000\011\000\011\000\
- \011\000\011\000\011\000\011\000\011\000\011\000\011\000\011\000\
- \011\000\011\000\011\000\011\000\011\000\011\000\011\000\011\000\
- \011\000\020\000\000\000\000\000\020\000\020\000\020\000\020\000\
- \020\000\020\000\020\000\020\000\020\000\020\000\000\000\000\000\
- \000\000\000\000\000\000\000\000\000\000\020\000\020\000\020\000\
- \020\000\020\000\020\000\020\000\020\000\020\000\020\000\020\000\
- \020\000\020\000\020\000\020\000\020\000\020\000\020\000\020\000\
- \020\000\020\000\020\000\020\000\020\000\020\000\020\000\000\000\
- \000\000\000\000\000\000\020\000\000\000\012\000\012\000\012\000\
- \012\000\012\000\012\000\012\000\012\000\012\000\012\000\012\000\
- \012\000\012\000\012\000\012\000\012\000\012\000\012\000\012\000\
- \012\000\012\000\012\000\012\000\012\000\012\000\012\000\026\000\
- \026\000\026\000\026\000\026\000\026\000\026\000\026\000\026\000\
- \026\000\026\000\026\000\026\000\026\000\026\000\026\000\026\000\
- \026\000\026\000\026\000\026\000\026\000\026\000\026\000\026\000\
- \026\000\020\000\000\000\000\000\020\000\020\000\020\000\020\000\
- \020\000\020\000\020\000\020\000\020\000\020\000\000\000\000\000\
- \000\000\000\000\000\000\000\000\000\000\020\000\020\000\020\000\
- \020\000\020\000\020\000\020\000\020\000\020\000\020\000\020\000\
- \020\000\020\000\020\000\020\000\020\000\020\000\020\000\020\000\
- \020\000\020\000\020\000\020\000\020\000\020\000\020\000\000\000\
- \000\000\000\000\000\000\020\000\000\000\014\000\014\000\014\000\
+ \014\000\019\000\014\000\013\000\000\000\000\000\013\000\013\000\
+ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\
+ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\013\000\
+ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\
+ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\
+ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\
+ \013\000\000\000\000\000\000\000\000\000\013\000\000\000\013\000\
+ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\
+ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\
+ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\
+ \013\000\000\000\000\000\000\000\000\000\022\000\000\000\000\000\
+ \022\000\022\000\022\000\022\000\022\000\022\000\022\000\022\000\
+ \022\000\022\000\000\000\000\000\000\000\000\000\000\000\000\000\
+ \000\000\022\000\022\000\022\000\022\000\022\000\022\000\022\000\
+ \022\000\022\000\022\000\022\000\022\000\022\000\022\000\022\000\
+ \022\000\022\000\022\000\022\000\022\000\022\000\022\000\022\000\
+ \022\000\022\000\022\000\000\000\000\000\000\000\000\000\022\000\
+ \002\000\014\000\014\000\014\000\014\000\014\000\014\000\014\000\
\014\000\014\000\014\000\014\000\014\000\014\000\014\000\014\000\
\014\000\014\000\014\000\014\000\014\000\014\000\014\000\014\000\
- \014\000\014\000\014\000\014\000\014\000\014\000\014\000\011\000\
- \000\000\000\000\015\000\015\000\015\000\015\000\015\000\015\000\
- \015\000\015\000\015\000\015\000\000\000\000\000\000\000\000\000\
- \000\000\000\000\000\000\011\000\011\000\011\000\011\000\011\000\
- \011\000\011\000\011\000\011\000\011\000\011\000\011\000\011\000\
- \011\000\011\000\011\000\011\000\011\000\011\000\011\000\011\000\
- \011\000\011\000\011\000\011\000\011\000\000\000\000\000\000\000\
- \000\000\011\000\000\000\011\000\011\000\011\000\011\000\011\000\
- \011\000\011\000\011\000\011\000\011\000\011\000\011\000\011\000\
- \011\000\011\000\011\000\011\000\011\000\011\000\011\000\011\000\
- \011\000\011\000\011\000\011\000\011\000\011\000\000\000\000\000\
- \011\000\011\000\011\000\011\000\011\000\011\000\011\000\011\000\
- \011\000\011\000\000\000\000\000\000\000\000\000\000\000\000\000\
- \000\000\025\000\025\000\025\000\025\000\025\000\025\000\025\000\
- \025\000\025\000\025\000\025\000\025\000\025\000\025\000\025\000\
- \025\000\025\000\025\000\025\000\025\000\025\000\025\000\025\000\
- \025\000\025\000\025\000\000\000\000\000\000\000\000\000\011\000\
- \000\000\025\000\025\000\025\000\025\000\025\000\025\000\025\000\
- \025\000\025\000\025\000\025\000\025\000\025\000\025\000\025\000\
- \025\000\025\000\025\000\025\000\025\000\025\000\025\000\025\000\
- \025\000\025\000\025\000\020\000\000\000\000\000\020\000\020\000\
- \020\000\020\000\020\000\020\000\020\000\020\000\020\000\020\000\
- \000\000\000\000\000\000\000\000\000\000\000\000\000\000\020\000\
- \020\000\020\000\020\000\020\000\020\000\020\000\020\000\020\000\
- \020\000\020\000\020\000\020\000\020\000\020\000\020\000\020\000\
- \020\000\020\000\020\000\020\000\020\000\020\000\020\000\020\000\
- \020\000\000\000\000\000\000\000\000\000\020\000\000\000\021\000\
- \012\000\012\000\012\000\012\000\012\000\012\000\012\000\012\000\
- \012\000\012\000\012\000\012\000\012\000\012\000\012\000\012\000\
- \012\000\012\000\012\000\012\000\012\000\012\000\012\000\012\000\
- \012\000\020\000\000\000\000\000\020\000\020\000\020\000\020\000\
- \020\000\020\000\020\000\020\000\020\000\020\000\000\000\000\000\
- \000\000\000\000\000\000\000\000\000\000\020\000\020\000\020\000\
- \020\000\020\000\020\000\020\000\020\000\020\000\020\000\020\000\
- \020\000\020\000\020\000\020\000\020\000\020\000\020\000\020\000\
- \020\000\020\000\020\000\020\000\020\000\020\000\020\000\000\000\
- \000\000\000\000\000\000\020\000\000\000\020\000\020\000\020\000\
- \020\000\020\000\020\000\020\000\020\000\020\000\020\000\020\000\
- \020\000\020\000\020\000\020\000\020\000\020\000\020\000\020\000\
- \020\000\020\000\020\000\020\000\020\000\020\000\020\000\020\000\
- \000\000\000\000\020\000\020\000\020\000\020\000\020\000\020\000\
- \020\000\020\000\020\000\020\000\000\000\000\000\000\000\000\000\
- \000\000\000\000\000\000\020\000\020\000\020\000\020\000\020\000\
- \020\000\020\000\020\000\020\000\020\000\020\000\020\000\020\000\
- \020\000\020\000\020\000\020\000\020\000\020\000\020\000\020\000\
- \020\000\020\000\020\000\020\000\020\000\000\000\000\000\000\000\
- \000\000\020\000\000\000\012\000\012\000\012\000\022\000\012\000\
- \012\000\012\000\012\000\012\000\012\000\012\000\012\000\012\000\
- \012\000\012\000\012\000\012\000\012\000\012\000\012\000\012\000\
- \012\000\012\000\012\000\012\000\012\000\020\000\000\000\000\000\
- \020\000\020\000\020\000\020\000\020\000\020\000\020\000\020\000\
- \020\000\020\000\000\000\000\000\000\000\000\000\000\000\000\000\
- \000\000\020\000\020\000\020\000\020\000\020\000\020\000\020\000\
- \020\000\020\000\020\000\020\000\020\000\020\000\020\000\020\000\
- \020\000\020\000\020\000\020\000\020\000\020\000\020\000\020\000\
- \020\000\020\000\020\000\000\000\000\000\000\000\000\000\020\000\
- \000\000\012\000\012\000\012\000\012\000\012\000\012\000\012\000\
- \012\000\023\000\012\000\012\000\012\000\012\000\012\000\012\000\
- \012\000\012\000\012\000\012\000\012\000\012\000\012\000\012\000\
- \012\000\012\000\012\000\020\000\000\000\000\000\020\000\020\000\
- \020\000\020\000\020\000\020\000\020\000\020\000\020\000\020\000\
- \000\000\000\000\000\000\000\000\024\000\000\000\000\000\020\000\
- \020\000\020\000\020\000\020\000\020\000\020\000\020\000\020\000\
- \020\000\020\000\020\000\020\000\020\000\020\000\020\000\020\000\
- \020\000\020\000\020\000\020\000\020\000\020\000\020\000\020\000\
- \020\000\000\000\000\000\000\000\000\000\020\000\000\000\012\000\
- \012\000\012\000\012\000\012\000\012\000\012\000\012\000\012\000\
- \012\000\012\000\012\000\012\000\012\000\012\000\012\000\012\000\
- \012\000\012\000\012\000\012\000\012\000\012\000\012\000\012\000\
- \012\000\011\000\000\000\000\000\011\000\011\000\011\000\011\000\
- \011\000\011\000\011\000\011\000\011\000\011\000\000\000\000\000\
- \000\000\000\000\000\000\000\000\000\000\025\000\025\000\025\000\
- \025\000\025\000\025\000\025\000\025\000\025\000\025\000\025\000\
- \025\000\025\000\025\000\025\000\025\000\025\000\025\000\025\000\
- \025\000\025\000\025\000\025\000\025\000\025\000\025\000\000\000\
- \000\000\000\000\000\000\011\000\000\000\025\000\025\000\025\000\
- \025\000\025\000\025\000\025\000\025\000\025\000\025\000\025\000\
- \025\000\025\000\025\000\025\000\025\000\025\000\025\000\025\000\
- \025\000\025\000\025\000\025\000\025\000\025\000\025\000\026\000\
- \026\000\026\000\026\000\026\000\026\000\026\000\026\000\026\000\
- \026\000\026\000\026\000\026\000\026\000\026\000\026\000\026\000\
- \026\000\026\000\026\000\026\000\026\000\026\000\026\000\026\000\
- \026\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
+ \014\000\014\000\014\000\028\000\028\000\028\000\028\000\028\000\
+ \028\000\028\000\028\000\028\000\028\000\028\000\028\000\028\000\
+ \028\000\028\000\028\000\028\000\028\000\028\000\028\000\028\000\
+ \028\000\028\000\028\000\028\000\028\000\022\000\000\000\000\000\
+ \022\000\022\000\022\000\022\000\022\000\022\000\022\000\022\000\
+ \022\000\022\000\000\000\000\000\000\000\000\000\000\000\000\000\
+ \000\000\022\000\022\000\022\000\022\000\022\000\022\000\022\000\
+ \022\000\022\000\022\000\022\000\022\000\022\000\022\000\022\000\
+ \022\000\022\000\022\000\022\000\022\000\022\000\022\000\022\000\
+ \022\000\022\000\022\000\000\000\000\000\000\000\000\000\022\000\
+ \000\000\016\000\016\000\016\000\016\000\016\000\016\000\016\000\
+ \016\000\016\000\016\000\016\000\016\000\016\000\016\000\016\000\
+ \016\000\016\000\016\000\016\000\016\000\016\000\016\000\016\000\
+ \016\000\016\000\016\000\013\000\000\000\000\000\017\000\017\000\
+ \017\000\017\000\017\000\017\000\017\000\017\000\017\000\017\000\
+ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\013\000\
+ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\
+ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\
+ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\
+ \013\000\000\000\000\000\000\000\000\000\013\000\000\000\013\000\
+ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\
+ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\
+ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\
+ \013\000\013\000\000\000\000\000\013\000\013\000\013\000\013\000\
+ \013\000\013\000\013\000\013\000\013\000\013\000\000\000\000\000\
+ \000\000\000\000\000\000\000\000\000\000\027\000\027\000\027\000\
+ \027\000\027\000\027\000\027\000\027\000\027\000\027\000\027\000\
+ \027\000\027\000\027\000\027\000\027\000\027\000\027\000\027\000\
+ \027\000\027\000\027\000\027\000\027\000\027\000\027\000\000\000\
+ \000\000\000\000\000\000\013\000\000\000\027\000\027\000\027\000\
+ \027\000\027\000\027\000\027\000\027\000\027\000\027\000\027\000\
+ \027\000\027\000\027\000\027\000\027\000\027\000\027\000\027\000\
+ \027\000\027\000\027\000\027\000\027\000\027\000\027\000\022\000\
+ \000\000\000\000\022\000\022\000\022\000\022\000\022\000\022\000\
+ \022\000\022\000\022\000\022\000\000\000\000\000\000\000\000\000\
+ \000\000\000\000\000\000\022\000\022\000\022\000\022\000\022\000\
+ \022\000\022\000\022\000\022\000\022\000\022\000\022\000\022\000\
+ \022\000\022\000\022\000\022\000\022\000\022\000\022\000\022\000\
+ \022\000\022\000\022\000\022\000\022\000\000\000\000\000\000\000\
+ \000\000\022\000\000\000\023\000\014\000\014\000\014\000\014\000\
+ \014\000\014\000\014\000\014\000\014\000\014\000\014\000\014\000\
+ \014\000\014\000\014\000\014\000\014\000\014\000\014\000\014\000\
+ \014\000\014\000\014\000\014\000\014\000\022\000\000\000\000\000\
+ \022\000\022\000\022\000\022\000\022\000\022\000\022\000\022\000\
+ \022\000\022\000\000\000\000\000\000\000\000\000\000\000\000\000\
+ \000\000\022\000\022\000\022\000\022\000\022\000\022\000\022\000\
+ \022\000\022\000\022\000\022\000\022\000\022\000\022\000\022\000\
+ \022\000\022\000\022\000\022\000\022\000\022\000\022\000\022\000\
+ \022\000\022\000\022\000\000\000\000\000\000\000\000\000\022\000\
+ \000\000\022\000\022\000\022\000\022\000\022\000\022\000\022\000\
+ \022\000\022\000\022\000\022\000\022\000\022\000\022\000\022\000\
+ \022\000\022\000\022\000\022\000\022\000\022\000\022\000\022\000\
+ \022\000\022\000\022\000\022\000\000\000\000\000\022\000\022\000\
+ \022\000\022\000\022\000\022\000\022\000\022\000\022\000\022\000\
+ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\022\000\
+ \022\000\022\000\022\000\022\000\022\000\022\000\022\000\022\000\
+ \022\000\022\000\022\000\022\000\022\000\022\000\022\000\022\000\
+ \022\000\022\000\022\000\022\000\022\000\022\000\022\000\022\000\
+ \022\000\000\000\000\000\000\000\000\000\022\000\000\000\014\000\
+ \014\000\014\000\024\000\014\000\014\000\014\000\014\000\014\000\
+ \014\000\014\000\014\000\014\000\014\000\014\000\014\000\014\000\
+ \014\000\014\000\014\000\014\000\014\000\014\000\014\000\014\000\
+ \014\000\022\000\000\000\000\000\022\000\022\000\022\000\022\000\
+ \022\000\022\000\022\000\022\000\022\000\022\000\000\000\000\000\
+ \000\000\000\000\000\000\000\000\000\000\022\000\022\000\022\000\
+ \022\000\022\000\022\000\022\000\022\000\022\000\022\000\022\000\
+ \022\000\022\000\022\000\022\000\022\000\022\000\022\000\022\000\
+ \022\000\022\000\022\000\022\000\022\000\022\000\022\000\000\000\
+ \000\000\000\000\000\000\022\000\000\000\014\000\014\000\014\000\
+ \014\000\014\000\014\000\014\000\014\000\025\000\014\000\014\000\
+ \014\000\014\000\014\000\014\000\014\000\014\000\014\000\014\000\
+ \014\000\014\000\014\000\014\000\014\000\014\000\014\000\022\000\
+ \000\000\000\000\022\000\022\000\022\000\022\000\022\000\022\000\
+ \022\000\022\000\022\000\022\000\000\000\000\000\000\000\000\000\
+ \026\000\000\000\000\000\022\000\022\000\022\000\022\000\022\000\
+ \022\000\022\000\022\000\022\000\022\000\022\000\022\000\022\000\
+ \022\000\022\000\022\000\022\000\022\000\022\000\022\000\022\000\
+ \022\000\022\000\022\000\022\000\022\000\000\000\000\000\000\000\
+ \000\000\022\000\000\000\014\000\014\000\014\000\014\000\014\000\
+ \014\000\014\000\014\000\014\000\014\000\014\000\014\000\014\000\
+ \014\000\014\000\014\000\014\000\014\000\014\000\014\000\014\000\
+ \014\000\014\000\014\000\014\000\014\000\013\000\000\000\000\000\
+ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\
+ \013\000\013\000\000\000\000\000\000\000\000\000\000\000\000\000\
+ \000\000\027\000\027\000\027\000\027\000\027\000\027\000\027\000\
+ \027\000\027\000\027\000\027\000\027\000\027\000\027\000\027\000\
+ \027\000\027\000\027\000\027\000\027\000\027\000\027\000\027\000\
+ \027\000\027\000\027\000\000\000\000\000\000\000\000\000\013\000\
+ \000\000\027\000\027\000\027\000\027\000\027\000\027\000\027\000\
+ \027\000\027\000\027\000\027\000\027\000\027\000\027\000\027\000\
+ \027\000\027\000\027\000\027\000\027\000\027\000\027\000\027\000\
+ \027\000\027\000\027\000\028\000\028\000\028\000\028\000\028\000\
+ \028\000\028\000\028\000\028\000\028\000\028\000\028\000\028\000\
+ \028\000\028\000\028\000\028\000\028\000\028\000\028\000\028\000\
+ \028\000\028\000\028\000\028\000\028\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
@@ -170,7 +170,8 @@ let __ocaml_lex_tables = {
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
- \000\000\000\000\000\000\000\000\000\000\000\000\000\000";
+ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
+ \000\000\000\000\000\000";
Lexing.lex_check =
"\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\000\000\000\000\255\255\255\255\255\255\255\255\255\255\
@@ -179,54 +180,35 @@ let __ocaml_lex_tables = {
\000\000\255\255\255\255\000\000\255\255\255\255\255\255\255\255\
\000\000\000\000\255\255\255\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\008\000\000\000\000\000\000\000\000\000\
- \002\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
+ \000\000\000\000\000\000\010\000\000\000\000\000\000\000\000\000\
+ \004\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
- \000\000\000\000\000\000\003\000\003\000\009\000\255\255\000\000\
+ \000\000\000\000\000\000\005\000\005\000\011\000\255\255\000\000\
\255\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\011\000\255\255\255\255\011\000\011\000\
- \011\000\011\000\011\000\011\000\011\000\011\000\011\000\011\000\
- \255\255\255\255\255\255\255\255\255\255\255\255\255\255\011\000\
- \011\000\011\000\011\000\011\000\011\000\011\000\011\000\011\000\
- \011\000\011\000\011\000\011\000\011\000\011\000\011\000\011\000\
- \011\000\011\000\011\000\011\000\011\000\011\000\011\000\011\000\
- \011\000\255\255\255\255\255\255\255\255\011\000\255\255\011\000\
- \011\000\011\000\011\000\011\000\011\000\011\000\011\000\011\000\
- \011\000\011\000\011\000\011\000\011\000\011\000\011\000\011\000\
- \011\000\011\000\011\000\011\000\011\000\011\000\011\000\011\000\
- \011\000\012\000\255\255\255\255\012\000\012\000\012\000\012\000\
- \012\000\012\000\012\000\012\000\012\000\012\000\255\255\255\255\
- \255\255\255\255\255\255\255\255\255\255\012\000\012\000\012\000\
- \012\000\012\000\012\000\012\000\012\000\012\000\012\000\012\000\
- \012\000\012\000\012\000\012\000\012\000\012\000\012\000\012\000\
- \012\000\012\000\012\000\012\000\012\000\012\000\012\000\255\255\
- \255\255\255\255\255\255\012\000\255\255\012\000\012\000\012\000\
- \012\000\012\000\012\000\012\000\012\000\012\000\012\000\012\000\
- \012\000\012\000\012\000\012\000\012\000\012\000\012\000\012\000\
- \012\000\012\000\012\000\012\000\012\000\012\000\012\000\013\000\
+ \000\000\000\000\000\000\013\000\255\255\255\255\013\000\013\000\
+ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\
+ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\013\000\
+ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\
+ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\
\013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\
+ \013\000\255\255\255\255\255\255\255\255\013\000\255\255\013\000\
\013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\
\013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\
- \013\000\014\000\255\255\255\255\014\000\014\000\014\000\014\000\
- \014\000\014\000\014\000\014\000\014\000\014\000\255\255\255\255\
- \255\255\255\255\255\255\255\255\255\255\014\000\014\000\014\000\
+ \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\
+ \013\000\255\255\255\255\255\255\255\255\014\000\255\255\255\255\
\014\000\014\000\014\000\014\000\014\000\014\000\014\000\014\000\
+ \014\000\014\000\255\255\255\255\255\255\255\255\255\255\255\255\
+ \255\255\014\000\014\000\014\000\014\000\014\000\014\000\014\000\
\014\000\014\000\014\000\014\000\014\000\014\000\014\000\014\000\
- \014\000\014\000\014\000\014\000\014\000\014\000\014\000\255\255\
- \255\255\255\255\255\255\014\000\255\255\014\000\014\000\014\000\
\014\000\014\000\014\000\014\000\014\000\014\000\014\000\014\000\
+ \014\000\014\000\014\000\255\255\255\255\255\255\255\255\014\000\
+ \000\000\014\000\014\000\014\000\014\000\014\000\014\000\014\000\
\014\000\014\000\014\000\014\000\014\000\014\000\014\000\014\000\
- \014\000\014\000\014\000\014\000\014\000\014\000\014\000\015\000\
- \255\255\255\255\015\000\015\000\015\000\015\000\015\000\015\000\
- \015\000\015\000\015\000\015\000\255\255\255\255\255\255\255\255\
- \255\255\255\255\255\255\015\000\015\000\015\000\015\000\015\000\
- \015\000\015\000\015\000\015\000\015\000\015\000\015\000\015\000\
- \015\000\015\000\015\000\015\000\015\000\015\000\015\000\015\000\
- \015\000\015\000\015\000\015\000\015\000\255\255\255\255\255\255\
- \255\255\015\000\255\255\015\000\015\000\015\000\015\000\015\000\
+ \014\000\014\000\014\000\014\000\014\000\014\000\014\000\014\000\
+ \014\000\014\000\014\000\015\000\015\000\015\000\015\000\015\000\
\015\000\015\000\015\000\015\000\015\000\015\000\015\000\015\000\
\015\000\015\000\015\000\015\000\015\000\015\000\015\000\015\000\
\015\000\015\000\015\000\015\000\015\000\016\000\255\255\255\255\
@@ -249,26 +231,26 @@ let __ocaml_lex_tables = {
\017\000\017\000\017\000\017\000\017\000\017\000\017\000\017\000\
\017\000\017\000\017\000\017\000\017\000\017\000\017\000\017\000\
\017\000\017\000\017\000\017\000\017\000\017\000\017\000\017\000\
- \017\000\020\000\255\255\255\255\020\000\020\000\020\000\020\000\
- \020\000\020\000\020\000\020\000\020\000\020\000\255\255\255\255\
- \255\255\255\255\255\255\255\255\255\255\020\000\020\000\020\000\
- \020\000\020\000\020\000\020\000\020\000\020\000\020\000\020\000\
- \020\000\020\000\020\000\020\000\020\000\020\000\020\000\020\000\
- \020\000\020\000\020\000\020\000\020\000\020\000\020\000\255\255\
- \255\255\255\255\255\255\020\000\255\255\020\000\020\000\020\000\
- \020\000\020\000\020\000\020\000\020\000\020\000\020\000\020\000\
- \020\000\020\000\020\000\020\000\020\000\020\000\020\000\020\000\
- \020\000\020\000\020\000\020\000\020\000\020\000\020\000\021\000\
- \255\255\255\255\021\000\021\000\021\000\021\000\021\000\021\000\
- \021\000\021\000\021\000\021\000\255\255\255\255\255\255\255\255\
- \255\255\255\255\255\255\021\000\021\000\021\000\021\000\021\000\
- \021\000\021\000\021\000\021\000\021\000\021\000\021\000\021\000\
- \021\000\021\000\021\000\021\000\021\000\021\000\021\000\021\000\
- \021\000\021\000\021\000\021\000\021\000\255\255\255\255\255\255\
- \255\255\021\000\255\255\021\000\021\000\021\000\021\000\021\000\
- \021\000\021\000\021\000\021\000\021\000\021\000\021\000\021\000\
- \021\000\021\000\021\000\021\000\021\000\021\000\021\000\021\000\
- \021\000\021\000\021\000\021\000\021\000\022\000\255\255\255\255\
+ \017\000\018\000\255\255\255\255\018\000\018\000\018\000\018\000\
+ \018\000\018\000\018\000\018\000\018\000\018\000\255\255\255\255\
+ \255\255\255\255\255\255\255\255\255\255\018\000\018\000\018\000\
+ \018\000\018\000\018\000\018\000\018\000\018\000\018\000\018\000\
+ \018\000\018\000\018\000\018\000\018\000\018\000\018\000\018\000\
+ \018\000\018\000\018\000\018\000\018\000\018\000\018\000\255\255\
+ \255\255\255\255\255\255\018\000\255\255\018\000\018\000\018\000\
+ \018\000\018\000\018\000\018\000\018\000\018\000\018\000\018\000\
+ \018\000\018\000\018\000\018\000\018\000\018\000\018\000\018\000\
+ \018\000\018\000\018\000\018\000\018\000\018\000\018\000\019\000\
+ \255\255\255\255\019\000\019\000\019\000\019\000\019\000\019\000\
+ \019\000\019\000\019\000\019\000\255\255\255\255\255\255\255\255\
+ \255\255\255\255\255\255\019\000\019\000\019\000\019\000\019\000\
+ \019\000\019\000\019\000\019\000\019\000\019\000\019\000\019\000\
+ \019\000\019\000\019\000\019\000\019\000\019\000\019\000\019\000\
+ \019\000\019\000\019\000\019\000\019\000\255\255\255\255\255\255\
+ \255\255\019\000\255\255\019\000\019\000\019\000\019\000\019\000\
+ \019\000\019\000\019\000\019\000\019\000\019\000\019\000\019\000\
+ \019\000\019\000\019\000\019\000\019\000\019\000\019\000\019\000\
+ \019\000\019\000\019\000\019\000\019\000\022\000\255\255\255\255\
\022\000\022\000\022\000\022\000\022\000\022\000\022\000\022\000\
\022\000\022\000\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\022\000\022\000\022\000\022\000\022\000\022\000\022\000\
@@ -280,7 +262,7 @@ let __ocaml_lex_tables = {
\022\000\022\000\022\000\022\000\022\000\022\000\022\000\022\000\
\022\000\022\000\022\000\023\000\255\255\255\255\023\000\023\000\
\023\000\023\000\023\000\023\000\023\000\023\000\023\000\023\000\
- \255\255\255\255\255\255\255\255\023\000\255\255\255\255\023\000\
+ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\023\000\
\023\000\023\000\023\000\023\000\023\000\023\000\023\000\023\000\
\023\000\023\000\023\000\023\000\023\000\023\000\023\000\023\000\
\023\000\023\000\023\000\023\000\023\000\023\000\023\000\023\000\
@@ -288,20 +270,39 @@ let __ocaml_lex_tables = {
\023\000\023\000\023\000\023\000\023\000\023\000\023\000\023\000\
\023\000\023\000\023\000\023\000\023\000\023\000\023\000\023\000\
\023\000\023\000\023\000\023\000\023\000\023\000\023\000\023\000\
- \023\000\025\000\255\255\255\255\025\000\025\000\025\000\025\000\
- \025\000\025\000\025\000\025\000\025\000\025\000\255\255\255\255\
- \255\255\255\255\255\255\255\255\255\255\025\000\025\000\025\000\
+ \023\000\024\000\255\255\255\255\024\000\024\000\024\000\024\000\
+ \024\000\024\000\024\000\024\000\024\000\024\000\255\255\255\255\
+ \255\255\255\255\255\255\255\255\255\255\024\000\024\000\024\000\
+ \024\000\024\000\024\000\024\000\024\000\024\000\024\000\024\000\
+ \024\000\024\000\024\000\024\000\024\000\024\000\024\000\024\000\
+ \024\000\024\000\024\000\024\000\024\000\024\000\024\000\255\255\
+ \255\255\255\255\255\255\024\000\255\255\024\000\024\000\024\000\
+ \024\000\024\000\024\000\024\000\024\000\024\000\024\000\024\000\
+ \024\000\024\000\024\000\024\000\024\000\024\000\024\000\024\000\
+ \024\000\024\000\024\000\024\000\024\000\024\000\024\000\025\000\
+ \255\255\255\255\025\000\025\000\025\000\025\000\025\000\025\000\
+ \025\000\025\000\025\000\025\000\255\255\255\255\255\255\255\255\
+ \025\000\255\255\255\255\025\000\025\000\025\000\025\000\025\000\
\025\000\025\000\025\000\025\000\025\000\025\000\025\000\025\000\
\025\000\025\000\025\000\025\000\025\000\025\000\025\000\025\000\
- \025\000\025\000\025\000\025\000\025\000\025\000\025\000\255\255\
- \255\255\255\255\255\255\025\000\255\255\025\000\025\000\025\000\
+ \025\000\025\000\025\000\025\000\025\000\255\255\255\255\255\255\
+ \255\255\025\000\255\255\025\000\025\000\025\000\025\000\025\000\
\025\000\025\000\025\000\025\000\025\000\025\000\025\000\025\000\
\025\000\025\000\025\000\025\000\025\000\025\000\025\000\025\000\
- \025\000\025\000\025\000\025\000\025\000\025\000\025\000\026\000\
- \026\000\026\000\026\000\026\000\026\000\026\000\026\000\026\000\
- \026\000\026\000\026\000\026\000\026\000\026\000\026\000\026\000\
- \026\000\026\000\026\000\026\000\026\000\026\000\026\000\026\000\
- \026\000\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
+ \025\000\025\000\025\000\025\000\025\000\027\000\255\255\255\255\
+ \027\000\027\000\027\000\027\000\027\000\027\000\027\000\027\000\
+ \027\000\027\000\255\255\255\255\255\255\255\255\255\255\255\255\
+ \255\255\027\000\027\000\027\000\027\000\027\000\027\000\027\000\
+ \027\000\027\000\027\000\027\000\027\000\027\000\027\000\027\000\
+ \027\000\027\000\027\000\027\000\027\000\027\000\027\000\027\000\
+ \027\000\027\000\027\000\255\255\255\255\255\255\255\255\027\000\
+ \255\255\027\000\027\000\027\000\027\000\027\000\027\000\027\000\
+ \027\000\027\000\027\000\027\000\027\000\027\000\027\000\027\000\
+ \027\000\027\000\027\000\027\000\027\000\027\000\027\000\027\000\
+ \027\000\027\000\027\000\028\000\028\000\028\000\028\000\028\000\
+ \028\000\028\000\028\000\028\000\028\000\028\000\028\000\028\000\
+ \028\000\028\000\028\000\028\000\028\000\028\000\028\000\028\000\
+ \028\000\028\000\028\000\028\000\028\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\
@@ -317,7 +318,8 @@ let __ocaml_lex_tables = {
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
- \255\255\255\255\255\255\255\255\255\255\255\255\255\255";
+ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
+ \255\255\255\255\255\255";
Lexing.lex_base_code =
"";
Lexing.lex_backtrk_code =
@@ -339,58 +341,58 @@ and __ocaml_lex_token_rec lexbuf __ocaml_lex_state =
| 0 ->
# 8 "lexer.mll"
( token lexbuf )
-# 343 "lexer.ml"
+# 345 "lexer.ml"
| 1 ->
# 9 "lexer.mll"
( token lexbuf )
-# 348 "lexer.ml"
+# 350 "lexer.ml"
| 2 ->
# 10 "lexer.mll"
( token lexbuf )
-# 353 "lexer.ml"
+# 355 "lexer.ml"
| 3 ->
# 11 "lexer.mll"
( ANON_VAR )
-# 358 "lexer.ml"
+# 360 "lexer.ml"
| 4 ->
let
# 12 "lexer.mll"
lxm
-# 364 "lexer.ml"
+# 366 "lexer.ml"
= Lexing.sub_lexeme lexbuf lexbuf.Lexing.lex_start_pos lexbuf.Lexing.lex_curr_pos in
# 12 "lexer.mll"
( VAL(int_of_string lxm) )
-# 368 "lexer.ml"
+# 370 "lexer.ml"
| 5 ->
let
# 13 "lexer.mll"
lxm
-# 374 "lexer.ml"
+# 376 "lexer.ml"
= Lexing.sub_lexeme lexbuf lexbuf.Lexing.lex_start_pos lexbuf.Lexing.lex_curr_pos in
# 13 "lexer.mll"
( RELNAME(lxm) )
-# 378 "lexer.ml"
+# 380 "lexer.ml"
| 6 ->
let
# 14 "lexer.mll"
lxm
-# 384 "lexer.ml"
+# 386 "lexer.ml"
= Lexing.sub_lexeme lexbuf lexbuf.Lexing.lex_start_pos lexbuf.Lexing.lex_curr_pos in
# 14 "lexer.mll"
( BOOLPRED(lxm) )
-# 388 "lexer.ml"
+# 390 "lexer.ml"
| 7 ->
let
# 15 "lexer.mll"
cmd
-# 394 "lexer.ml"
+# 396 "lexer.ml"
= Lexing.sub_lexeme lexbuf lexbuf.Lexing.lex_start_pos lexbuf.Lexing.lex_curr_pos in
# 15 "lexer.mll"
(match cmd with
@@ -405,13 +407,13 @@ let
| "#getdb" -> GETDBCOMM
| _ -> UNKNOWNCOMM
)
-# 409 "lexer.ml"
+# 411 "lexer.ml"
| 8 ->
let
# 27 "lexer.mll"
lxm
-# 415 "lexer.ml"
+# 417 "lexer.ml"
= Lexing.sub_lexeme lexbuf lexbuf.Lexing.lex_start_pos lexbuf.Lexing.lex_curr_pos in
# 27 "lexer.mll"
( match lxm with
@@ -424,92 +426,107 @@ let
| "where" -> WHERE
| _ -> VARNAME(lxm)
)
-# 428 "lexer.ml"
+# 430 "lexer.ml"
| 9 ->
let
# 37 "lexer.mll"
lxm
-# 434 "lexer.ml"
+# 436 "lexer.ml"
= Lexing.sub_lexeme lexbuf lexbuf.Lexing.lex_start_pos lexbuf.Lexing.lex_curr_pos in
# 37 "lexer.mll"
( ANYNAME(lxm) )
-# 438 "lexer.ml"
+# 440 "lexer.ml"
| 10 ->
let
# 38 "lexer.mll"
lxm
-# 444 "lexer.ml"
+# 446 "lexer.ml"
= Lexing.sub_lexeme lexbuf lexbuf.Lexing.lex_start_pos lexbuf.Lexing.lex_curr_pos in
# 38 "lexer.mll"
( PASSNAME(lxm) )
-# 448 "lexer.ml"
+# 450 "lexer.ml"
| 11 ->
# 39 "lexer.mll"
( DOT )
-# 453 "lexer.ml"
+# 455 "lexer.ml"
| 12 ->
# 40 "lexer.mll"
( IMPLIEDBY )
-# 458 "lexer.ml"
+# 460 "lexer.ml"
| 13 ->
# 41 "lexer.mll"
( QMARK )
-# 463 "lexer.ml"
+# 465 "lexer.ml"
| 14 ->
# 42 "lexer.mll"
( SEP )
-# 468 "lexer.ml"
+# 470 "lexer.ml"
| 15 ->
# 43 "lexer.mll"
( LPAREN )
-# 473 "lexer.ml"
+# 475 "lexer.ml"
| 16 ->
# 44 "lexer.mll"
( RPAREN )
-# 478 "lexer.ml"
+# 480 "lexer.ml"
| 17 ->
# 45 "lexer.mll"
( EQ )
-# 483 "lexer.ml"
+# 485 "lexer.ml"
| 18 ->
# 46 "lexer.mll"
( LE )
-# 488 "lexer.ml"
+# 490 "lexer.ml"
| 19 ->
# 47 "lexer.mll"
( GR )
-# 493 "lexer.ml"
+# 495 "lexer.ml"
| 20 ->
# 48 "lexer.mll"
( LQ )
-# 498 "lexer.ml"
+# 500 "lexer.ml"
| 21 ->
# 49 "lexer.mll"
( GQ )
-# 503 "lexer.ml"
+# 505 "lexer.ml"
| 22 ->
# 50 "lexer.mll"
( NE )
-# 508 "lexer.ml"
+# 510 "lexer.ml"
| 23 ->
# 51 "lexer.mll"
( EOP )
-# 513 "lexer.ml"
+# 515 "lexer.ml"
+
+ | 24 ->
+# 52 "lexer.mll"
+ ( raise End_of_file )
+# 520 "lexer.ml"
+
+ | 25 ->
+let
+# 53 "lexer.mll"
+ c
+# 526 "lexer.ml"
+= Lexing.sub_lexeme_char lexbuf lexbuf.Lexing.lex_start_pos in
+# 53 "lexer.mll"
+ ( Printf.printf "Warning: unknown symbol is ignored: %c\n" c; token lexbuf )
+# 530 "lexer.ml"
| __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_token_rec lexbuf __ocaml_lex_state
View
3  lexer.mll
@@ -49,5 +49,6 @@
| ">=" { GQ }
| "<>" { NE }
| '/' { EOP }
+ | eof { raise End_of_file }
+ | _ as c { Printf.printf "Warning: unknown symbol is ignored: %c\n" c; token lexbuf }
-
View
49 main.ml
@@ -2,6 +2,7 @@ open Lexer ;;
exception Eof ;;
exception GO_QUERY ;;
exception GO_RECONN ;;
+exception ERROR_DONE ;;
exception GO_CHANGEOUT ;;
exception GO_READSCRIPT ;;
exception GO_TABINFO ;;
@@ -144,12 +145,13 @@ let main () =
curr_lexbuf := Lexing.from_channel !infile_ref;
while true do
try
+ Lexing.flush_input !curr_lexbuf;
if !infile_ref == stdin then fprintf stdout "yadi$ "; flush !outfile_ref; flush stdout;
(*print_endline (Expr.to_string ast); flush stdout;*)
let ast = Parser.main Lexer.token !curr_lexbuf in
try
let aux_arg = ref "" in
- if Eval.is_command ast then temp_str := Eval.eval_command (Eval.get_command ast) aux_arg !outfile_ref else raise(GO_QUERY);
+ if Eval.is_command ast then temp_str := Eval.eval_command (Eval.get_command ast) aux_arg else raise(GO_QUERY);
try
(*if !temp_str = "" then printf "\n" else raise(GO_RECONN);*)
match !aux_arg with
@@ -175,7 +177,7 @@ let main () =
infile_ref := open_in !temp_str;
curr_lexbuf := Lexing.from_channel !infile_ref;
with _ ->
- fprintf stderr "Error: can't open the required file!\n"; flush !errfile_ref;
+ fprintf !errfile_ref "Error: can't open the required file!\n"; flush !errfile_ref;
;
| GO_CHANGEOUT ->
try
@@ -183,7 +185,7 @@ let main () =
| "stdout" -> close_out !outfile_ref; outfile_ref := stdout;
| _ -> outfile_ref := open_out !temp_str;
with _ ->
- fprintf stderr "Error: can't open the required file!\n"; flush !errfile_ref;
+ fprintf !errfile_ref "Error: can't open the required file!\n"; flush !errfile_ref;
;
| GO_TABINFO ->
!c#send_query !temp_str;
@@ -199,13 +201,39 @@ let main () =
with
Eval.QueryError explanation -> fprintf !outfile_ref "%s\n" explanation; flush !outfile_ref
;
- with Failure arg ->
- match arg with
- | "lexing: empty token" -> if !infile_ref == stdin then failwith(arg);
- close_in !infile_ref;
- infile_ref := stdin;
- curr_lexbuf := Lexing.from_channel !infile_ref;
- | _ -> failwith(arg);
+ with
+ | End_of_file ->
+ if !infile_ref != stdin then close_in !infile_ref;
+ infile_ref := stdin;
+ curr_lexbuf := Lexing.from_channel !infile_ref;
+ | Failure arg ->
+ fprintf !errfile_ref "Error: %s\n" arg; flush !errfile_ref;
+ | Invalid_argument(arg) ->
+ fprintf !errfile_ref "Fatal error: %s\n" arg; flush !errfile_ref;
+ fprintf !errfile_ref "It's recommended to close the program and report the bug to the authors of YADI in order to avoid unexpected behaviour! However, you can continue on your own risk!\n"; flush !errfile_ref;
+ | Parsing.Parse_error ->
+ let curr_pos = !curr_lexbuf.Lexing.lex_curr_p in
+ (*let curr_line = curr_pos.Lexing.pos_lnum in line number *)
+ let start_cnum = (Lexing.lexeme_start !curr_lexbuf) - curr_pos.Lexing.pos_bol in (* start offset in line *)
+ let curr_cnum = curr_pos.Lexing.pos_cnum - curr_pos.Lexing.pos_bol in (* end offset in line *)
+ let curr_tok = Lexing.lexeme !curr_lexbuf in (* current matched string *)
+ fprintf !errfile_ref "\nSyntax error! Wrong character sequence:\nPosition in line: (%d - %d)\nCharacter sequence: %s\nIgnoring everything up to the closest / symbol... If program stops, type \"/\" + enter\n\n" start_cnum curr_cnum curr_tok; flush !errfile_ref;
+ flush !outfile_ref;
+ try
+ while true do
+ let tmp_line = input_line !infile_ref in
+ match tmp_line
+ with
+ | _ -> if (String.contains tmp_line '/') then raise ERROR_DONE;
+ done;
+ with
+ | ERROR_DONE ->
+ fprintf !errfile_ref "\n"; flush !errfile_ref;
+ | End_of_file ->
+ if !infile_ref != stdin then close_in !infile_ref;
+ infile_ref := stdin;
+ curr_lexbuf := Lexing.from_channel !infile_ref;
+
done
with Eof ->
!c#finish; exit 0
@@ -217,3 +245,4 @@ let _ =
| Error e -> prerr_endline (string_of_error e)
| e -> prerr_endline (Printexc.to_string e)
;;
+
View
403 parser.ml
@@ -96,9 +96,9 @@ let yylhs = "\255\255\
\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\020\000\020\000\024\000\
-\024\000\024\000\024\000\024\000\024\000\022\000\022\000\022\000\
-\023\000\023\000\023\000\025\000\026\000\026\000\000\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\
@@ -107,9 +107,9 @@ let yylen = "\002\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\003\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\002\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\036\000\000\000\000\000\
@@ -118,87 +118,84 @@ let yydefred = "\000\000\
\010\000\000\000\038\000\000\000\000\000\011\000\029\000\030\000\
\028\000\000\000\000\000\013\000\014\000\025\000\021\000\022\000\
\023\000\024\000\019\000\020\000\002\000\003\000\007\000\000\000\
-\068\000\000\000\000\000\040\000\000\000\000\000\000\000\000\000\
-\000\000\000\000\000\000\000\000\000\000\042\000\044\000\046\000\
-\048\000\050\000\000\000\000\000\026\000\061\000\056\000\057\000\
-\058\000\059\000\060\000\000\000\000\000\000\000\000\000\045\000\
-\047\000\049\000\037\000\000\000\064\000\032\000\033\000\035\000\
-\031\000\034\000\000\000\054\000\069\000\070\000\000\000\000\000\
-\053\000\055\000\000\000\043\000\012\000\051\000\000\000\052\000\
-\067\000"
+\067\000\066\000\000\000\000\000\040\000\000\000\000\000\000\000\
+\000\000\000\000\000\000\000\000\042\000\044\000\046\000\048\000\
+\000\000\050\000\000\000\000\000\026\000\000\000\000\000\045\000\
+\047\000\049\000\037\000\000\000\059\000\054\000\055\000\056\000\
+\057\000\058\000\000\000\062\000\032\000\033\000\035\000\031\000\
+\034\000\000\000\069\000\068\000\070\000\000\000\000\000\000\000\
+\043\000\053\000\012\000\051\000\000\000\052\000\065\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\091\000\036\000\043\000\026\000\060\000\027\000\
-\061\000\062\000\063\000\064\000\065\000\050\000\095\000\076\000\
-\051\000\096\000"
+\025\000\035\000\090\000\036\000\043\000\026\000\059\000\027\000\
+\060\000\061\000\062\000\063\000\064\000\051\000\094\000\052\000\
+\083\000\095\000"
let yysindex = "\009\000\
-\023\255\000\000\252\254\016\255\000\000\000\000\022\255\002\255\
-\000\000\002\255\002\255\009\255\000\000\024\255\000\000\000\000\
-\000\000\006\255\013\255\004\255\000\000\000\000\000\000\000\000\
-\000\000\019\255\000\000\041\255\059\255\000\000\000\000\000\000\
-\000\000\065\255\061\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\030\255\
-\000\000\046\255\047\255\000\000\002\255\002\255\044\255\048\255\
-\044\255\050\255\039\255\066\255\067\255\000\000\000\000\000\000\
-\000\000\000\000\041\255\255\254\000\000\000\000\000\000\000\000\
-\000\000\000\000\000\000\070\255\005\255\010\255\041\255\000\000\
-\000\000\000\000\000\000\030\255\000\000\000\000\000\000\000\000\
-\000\000\000\000\002\255\000\000\000\000\000\000\052\255\053\255\
-\000\000\000\000\055\255\000\000\000\000\000\000\005\255\000\000\
-\000\000"
+\024\255\000\000\246\254\022\255\000\000\000\000\028\255\004\255\
+\000\000\004\255\004\255\006\255\000\000\030\255\000\000\000\000\
+\000\000\007\255\010\255\003\255\000\000\000\000\000\000\000\000\
+\000\000\031\255\000\000\020\255\039\255\000\000\000\000\000\000\
+\000\000\036\255\058\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\059\255\
+\000\000\000\000\043\255\044\255\000\000\004\255\004\255\045\255\
+\055\255\040\255\069\255\070\255\000\000\000\000\000\000\000\000\
+\054\255\000\000\020\255\255\254\000\000\012\255\020\255\000\000\
+\000\000\000\000\000\000\059\255\000\000\000\000\000\000\000\000\
+\000\000\000\000\020\255\000\000\000\000\000\000\000\000\000\000\
+\000\000\004\255\000\000\000\000\000\000\057\255\060\255\062\255\
+\000\000\000\000\000\000\000\000\012\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\054\255\000\000\000\000\000\000\000\000\
-\000\000\000\000\000\000\057\255\000\000\000\000\000\000\000\000\
+\000\000\000\000\000\000\053\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\056\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\008\255\
-\000\000\000\000\060\255\000\000\000\000\000\000\000\000\000\000\
-\000\000\000\000\000\000\000\000\075\255\000\000\000\000\000\000\
-\000\000\000\000\057\255\000\000\000\000\000\000\000\000\000\000\
-\000\000\000\000\000\000\000\000\062\255\000\000\057\255\000\000\
+\000\000\000\000\000\000\000\000\000\000\000\000\000\000\019\255\
+\000\000\000\000\000\000\064\255\000\000\000\000\000\000\000\000\
+\000\000\000\000\000\000\075\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\
-\000\000\000\000\000\000\000\000\000\000\000\000\000\000\046\255\
-\000\000\000\000\000\000\000\000\000\000\000\000\062\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\066\255\000\000\
+\000\000\000\000\000\000\000\000\065\255\000\000\000\000"
let yygindex = "\000\000\
-\000\000\000\000\000\000\000\000\000\000\065\000\000\000\000\000\
-\000\000\248\255\000\000\075\000\000\000\000\000\000\000\083\000\
-\000\000\004\000\030\000\031\000\032\000\196\255\245\255\036\000\
+\000\000\000\000\000\000\000\000\000\000\069\000\000\000\000\000\
+\000\000\248\255\000\000\079\000\000\000\000\000\000\000\087\000\
+\000\000\016\000\035\000\036\000\037\000\201\255\251\255\212\255\
\000\000\000\000"
-let yytablesize = 93
+let yytablesize = 96
let yytable = "\034\000\
-\086\000\087\000\088\000\031\000\032\000\003\000\085\000\093\000\
-\004\000\001\000\097\000\038\000\098\000\041\000\094\000\041\000\
-\028\000\003\000\099\000\039\000\040\000\041\000\042\000\030\000\
-\003\000\048\000\044\000\004\000\006\000\045\000\055\000\056\000\
-\057\000\058\000\089\000\090\000\046\000\033\000\059\000\055\000\
-\056\000\057\000\058\000\049\000\068\000\069\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\070\000\071\000\072\000\073\000\074\000\075\000\
-\052\000\053\000\054\000\066\000\077\000\067\000\079\000\083\000\
-\092\000\102\000\084\000\103\000\104\000\004\000\062\000\027\000\
-\039\000\063\000\101\000\065\000\047\000\037\000\029\000\100\000\
-\080\000\081\000\082\000\105\000\078\000"
+\085\000\086\000\087\000\065\000\003\000\031\000\032\000\004\000\
+\038\000\001\000\028\000\084\000\091\000\065\000\092\000\096\000\
+\039\000\040\000\041\000\042\000\049\000\093\000\050\000\003\000\
+\041\000\003\000\041\000\006\000\004\000\030\000\045\000\065\000\
+\044\000\046\000\088\000\089\000\054\000\048\000\098\000\033\000\
+\049\000\056\000\050\000\057\000\053\000\068\000\069\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\049\000\056\000\050\000\057\000\055\000\
+\066\000\070\000\067\000\058\000\077\000\078\000\079\000\080\000\
+\081\000\082\000\075\000\071\000\004\000\076\000\100\000\027\000\
+\039\000\099\000\101\000\102\000\060\000\061\000\063\000\064\000\
+\047\000\037\000\029\000\097\000\072\000\073\000\074\000\103\000"
let yycheck = "\008\000\
-\002\001\003\001\004\001\002\001\003\001\002\001\067\000\003\001\
-\005\001\001\000\001\001\003\001\003\001\006\001\010\001\008\001\
-\021\001\002\001\079\000\011\001\012\001\013\001\014\001\002\001\
-\002\001\007\001\003\001\005\001\025\001\024\001\001\001\002\001\
-\003\001\004\001\036\001\037\001\024\001\036\001\009\001\001\001\
-\002\001\003\001\004\001\003\001\053\000\054\000\024\001\025\001\
-\026\001\027\001\028\001\029\001\030\001\031\001\032\001\033\001\
-\034\001\035\001\015\001\016\001\017\001\018\001\019\001\020\001\
-\006\001\001\001\006\001\022\001\021\001\023\001\021\001\006\001\
-\003\001\022\001\008\001\023\001\022\001\024\001\022\001\024\001\
-\006\001\022\001\091\000\022\001\020\000\011\000\004\000\084\000\
-\059\000\059\000\059\000\103\000\057\000"
+\002\001\003\001\004\001\048\000\002\001\002\001\003\001\005\001\
+\003\001\001\000\021\001\067\000\001\001\058\000\003\001\071\000\
+\011\001\012\001\013\001\014\001\001\001\010\001\003\001\002\001\
+\006\001\002\001\008\001\025\001\005\001\002\001\024\001\076\000\
+\003\001\024\001\036\001\037\001\001\001\007\001\083\000\036\001\
+\001\001\002\001\003\001\004\001\006\001\054\000\055\000\024\001\
+\025\001\026\001\027\001\028\001\029\001\030\001\031\001\032\001\
+\033\001\034\001\035\001\001\001\002\001\003\001\004\001\006\001\
+\022\001\021\001\023\001\009\001\015\001\016\001\017\001\018\001\
+\019\001\020\001\006\001\021\001\024\001\008\001\022\001\024\001\
+\006\001\090\000\023\001\022\001\022\001\022\001\022\001\022\001\
+\020\000\011\000\004\000\076\000\058\000\058\000\058\000\101\000"
let yynames_const = "\
QMARK\000\
@@ -248,43 +245,43 @@ let yyact = [|
; (fun __caml_parser_env ->
Obj.repr(
# 42 "parser.mly"
- ( failwith "main: where's my program?!")
-# 253 "parser.ml"
+ ( failwith "Empty command or query!")
+# 250 "parser.ml"
: Expr.expr))
; (fun __caml_parser_env ->
let _1 = (Parsing.peek_val __caml_parser_env 1 : 'program) in
Obj.repr(
# 43 "parser.mly"
( Prog _1 )
-# 260 "parser.ml"
+# 257 "parser.ml"
: Expr.expr))
; (fun __caml_parser_env ->
let _1 = (Parsing.peek_val __caml_parser_env 1 : 'commlist) in
Obj.repr(
# 44 "parser.mly"
( Comm _1 )
-# 267 "parser.ml"
+# 264 "parser.ml"
: Expr.expr))
; (fun __caml_parser_env ->
let _1 = (Parsing.peek_val __caml_parser_env 0 : 'exprlist) in
Obj.repr(
# 48 "parser.mly"
( _1 )
-# 274 "parser.ml"
+# 271 "parser.ml"
: 'program))
; (fun __caml_parser_env ->
let _1 = (Parsing.peek_val __caml_parser_env 0 : 'command) in
Obj.repr(
# 52 "parser.mly"
( _1 (*:: [] *) )
-# 281 "parser.ml"
+# 278 "parser.ml"
: 'commlist))
; (fun __caml_parser_env ->
let _1 = (Parsing.peek_val __caml_parser_env 0 : 'expr) in
Obj.repr(
# 57 "parser.mly"
( _1 :: [] )
-# 288 "parser.ml"
+# 285 "parser.ml"
: 'exprlist))
; (fun __caml_parser_env ->
let _1 = (Parsing.peek_val __caml_parser_env 1 : 'exprlist) in
@@ -292,35 +289,35 @@ let yyact = [|
Obj.repr(
# 58 "parser.mly"
( _2 :: _1 )
-# 296 "parser.ml"
+# 293 "parser.ml"
: 'exprlist))
; (fun __caml_parser_env ->
let _1 = (Parsing.peek_val __caml_parser_env 0 : 'rule) in
Obj.repr(
# 62 "parser.mly"
( _1 )
-# 303 "parser.ml"
+# 300 "parser.ml"
: 'expr))
; (fun __caml_parser_env ->
let _1 = (Parsing.peek_val __caml_parser_env 0 : 'query) in
Obj.repr(
# 63 "parser.mly"
( _1 )
-# 310 "parser.ml"
+# 307 "parser.ml"
: 'expr))
; (fun __caml_parser_env ->
let _1 = (Parsing.peek_val __caml_parser_env 0 : 'fact) in
Obj.repr(
# 64 "parser.mly"
( failwith "fact: to be implemented" )
-# 317 "parser.ml"
+# 314 "parser.ml"
: 'expr))
; (fun __caml_parser_env ->
let _2 = (Parsing.peek_val __caml_parser_env 0 : string) in
Obj.repr(
# 68 "parser.mly"
( TestComm _2 )
-# 324 "parser.ml"
+# 321 "parser.ml"
: 'command))
; (fun __caml_parser_env ->
let _2 = (Parsing.peek_val __caml_parser_env 4 : 'reconn_param) in
@@ -331,408 +328,404 @@ let yyact = [|
Obj.repr(
# 69 "parser.mly"
( ReconnComm (_2,_3,_4,_5,_6) )
-# 335 "parser.ml"
+# 332 "parser.ml"
: 'command))
; (fun __caml_parser_env ->
let _2 = (Parsing.peek_val __caml_parser_env 0 : 'file_name) in
Obj.repr(
# 70 "parser.mly"
( ChangeOutComm _2 )
-# 342 "parser.ml"
+# 339 "parser.ml"
: 'command))
; (fun __caml_parser_env ->
let _2 = (Parsing.peek_val __caml_parser_env 0 : 'file_name) in
Obj.repr(
# 71 "parser.mly"
( ReadScriptComm _2 )
-# 349 "parser.ml"
+# 346 "parser.ml"
: 'command))
; (fun __caml_parser_env ->
Obj.repr(
# 72 "parser.mly"
( QuitCommand )
-# 355 "parser.ml"
+# 352 "parser.ml"
: 'command))
; (fun __caml_parser_env ->
Obj.repr(
# 73 "parser.mly"
( UnknownCommand )
-# 361 "parser.ml"
+# 358 "parser.ml"
: 'command))
; (fun __caml_parser_env ->
Obj.repr(
# 74 "parser.mly"
( GettablesCommand )
-# 367 "parser.ml"
+# 364 "parser.ml"
: 'command))
; (fun __caml_parser_env ->
Obj.repr(
# 75 "parser.mly"
( GetdbCommand )
-# 373 "parser.ml"
+# 370 "parser.ml"
: 'command))
; (fun __caml_parser_env ->
let _2 = (Parsing.peek_val __caml_parser_env 0 : 'help_param) in
Obj.repr(
# 76 "parser.mly"
( HelpCommand _2 )
-# 380 "parser.ml"
+# 377 "parser.ml"
: 'command))
; (fun __caml_parser_env ->
let _2 = (Parsing.peek_val __caml_parser_env 0 : string) in
Obj.repr(
# 77 "parser.mly"
( TabinfoCommand _2)
-# 387 "parser.ml"
+# 384 "parser.ml"
: 'command))
; (fun __caml_parser_env ->
Obj.repr(
# 81 "parser.mly"
( Select )
-# 393 "parser.ml"
+# 390 "parser.ml"
: 'help_param))
; (fun __caml_parser_env ->
Obj.repr(
# 82 "parser.mly"
( Join )
-# 399 "parser.ml"
+# 396 "parser.ml"
: 'help_param))
; (fun __caml_parser_env ->
Obj.repr(
# 83 "parser.mly"
( Where )
-# 405 "parser.ml"
+# 402 "parser.ml"
: 'help_param))
; (fun __caml_parser_env ->
Obj.repr(
# 84 "parser.mly"
( WhereNot )
-# 411 "parser.ml"
+# 408 "parser.ml"
: 'help_param))
; (fun __caml_parser_env ->
let _1 = (Parsing.peek_val __caml_parser_env 0 : string) in
Obj.repr(
# 85 "parser.mly"
( Other )
-# 418 "parser.ml"
+# 415 "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(
-# 90 "parser.mly"
+# 89 "parser.mly"
( _1 ^ "." ^ _3 )
-# 426 "parser.ml"
+# 423 "parser.ml"
: 'file_name))
; (fun __caml_parser_env ->
let _1 = (Parsing.peek_val __caml_parser_env 0 : 'reconn_param) in
Obj.repr(
-# 91 "parser.mly"
+# 90 "parser.mly"
( _1 )
-# 433 "parser.ml"
+# 430 "parser.ml"
: 'file_name))
; (fun __caml_parser_env ->
let _1 = (Parsing.peek_val __caml_parser_env 0 : string) in
Obj.repr(
-# 94 "parser.mly"
+# 93 "parser.mly"
( _1 )
-# 440 "parser.ml"
+# 437 "parser.ml"
: 'reconn_param))
; (fun __caml_parser_env ->
let _1 = (Parsing.peek_val __caml_parser_env 0 : string) in
Obj.repr(
-# 95 "parser.mly"
+# 94 "parser.mly"
( _1 )
-# 447 "parser.ml"
+# 444 "parser.ml"
: 'reconn_param))
; (fun __caml_parser_env ->
let _1 = (Parsing.peek_val __caml_parser_env 0 : string) in
Obj.repr(
-# 96 "parser.mly"
+# 95 "parser.mly"
( _1 )
-# 454 "parser.ml"
+# 451 "parser.ml"
: 'reconn_param))
; (fun __caml_parser_env ->
let _1 = (Parsing.peek_val __caml_parser_env 0 : string) in
Obj.repr(
-# 100 "parser.mly"
+# 99 "parser.mly"
( _1 )
-# 461 "parser.ml"
+# 458 "parser.ml"
: 'pass_param))
; (fun __caml_parser_env ->
let _1 = (Parsing.peek_val __caml_parser_env 0 : string) in
Obj.repr(
-# 101 "parser.mly"
+# 100 "parser.mly"
( _1 )
-# 468 "parser.ml"
+# 465 "parser.ml"
: 'pass_param))
; (fun __caml_parser_env ->
let _1 = (Parsing.peek_val __caml_parser_env 0 : string) in
Obj.repr(
-# 102 "parser.mly"
+# 101 "parser.mly"
( _1 )
-# 475 "parser.ml"
+# 472 "parser.ml"
: 'pass_param))
; (fun __caml_parser_env ->
let _1 = (Parsing.peek_val __caml_parser_env 0 : string) in
Obj.repr(
-# 103 "parser.mly"
+# 102 "parser.mly"
( _1 )
-# 482 "parser.ml"
+# 479 "parser.ml"
: 'pass_param))
; (fun __caml_parser_env ->
let _1 = (Parsing.peek_val __caml_parser_env 0 : string) in
Obj.repr(
-# 104 "parser.mly"
+# 103 "parser.mly"
( _1 )
-# 489 "parser.ml"
+# 486 "parser.ml"
: 'pass_param))
; (fun __caml_parser_env ->
Obj.repr(
-# 108 "parser.mly"
+# 107 "parser.mly"
( )
-# 495 "parser.ml"
+# 492 "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(
-# 112 "parser.mly"
+# 111 "parser.mly"
( Rule (_1,_3) )
-# 503 "parser.ml"
+# 500 "parser.ml"
: 'rule))
; (fun __caml_parser_env ->
let _1 = (Parsing.peek_val __caml_parser_env 0 : 'predicate) in
Obj.repr(
-# 116 "parser.mly"
+# 115 "parser.mly"
( _1 )
-# 510 "parser.ml"
+# 507 "parser.ml"
: 'head))
; (fun __caml_parser_env ->
let _1 = (Parsing.peek_val __caml_parser_env 0 : 'litlist) in
Obj.repr(
-# 120 "parser.mly"
+# 119 "parser.mly"
( _1 )
-# 517 "parser.ml"
+# 514 "parser.ml"
: 'body))
; (fun __caml_parser_env ->
let _2 = (Parsing.peek_val __caml_parser_env 1 : 'predicate) in
Obj.repr(
-# 124 "parser.mly"
+# 123 "parser.mly"
( Query _2 )
-# 524 "parser.ml"
+# 521 "parser.ml"
: 'query))
; (fun __caml_parser_env ->
Obj.repr(
-# 127 "parser.mly"
+# 126 "parser.mly"
( [] )
-# 530 "parser.ml"
+# 527 "parser.ml"
: 'litlist))
; (fun __caml_parser_env ->
let _1 = (Parsing.peek_val __caml_parser_env 0 : 'literal) in