;;\r
\r
let mk_app' = function\r
- | [] -> raise (ParsingError "bug")\r
+ | [] -> assert false\r
| t :: ts -> List.fold_left mk_app t ts\r
;;\r
\r
| Some varname, cs ->\r
let vars' = (varname::bound, free) in\r
(match strip_spaces cs with\r
- | [] -> raise (ParsingError "manca dopo variabile lambda")\r
+ | [] -> raise (ParsingError "Lambda expression incomplete")\r
| c::cs -> (if c = '.' then (match read_smt vars' cs with\r
- | None, _, _ -> raise (ParsingError "manca corpo lambda")\r
+ | None, _, _ -> raise (ParsingError "Lambda body expected")\r
| Some [x], y, (_, free) -> Some [mk_lam x], y, (bound, free)\r
- | Some _, _, _ -> raise (ParsingError "???")\r
- ) else raise (ParsingError "manca . nel lambda")\r
+ | Some _, _, _ -> assert false\r
+ ) else raise (ParsingError "Expected `.` after variable in lambda")\r
))\r
| _, _ -> assert false\r
) in let rec aux vars cs =\r
| None, cs, vars -> Some [tm], cs, vars\r
| Some ts, cs, vars -> Some (tm :: ts), cs, vars\r
)\r
- | Some _ -> raise (ParsingError "bug")\r
+ | Some _ -> assert false\r
| None -> None, x, vars\r
in fun cs -> match aux vars cs with\r
| None, cs, vars -> None, cs, vars\r
let cs = strip_spaces cs in\r
match cs with\r
| [] -> None, [], vars\r
- | c::cs -> if c = ')' then tm, cs, vars else raise (ParsingError ") mancante")\r
- ) else raise (ParsingError "???")\r
+ | c::cs -> if c = ')' then tm, cs, vars else raise (ParsingError "Missing `)`")\r
+ ) else assert false\r
;;\r
\r
let parse x =\r
match read_smt ([],[]) (explode x) with\r
| Some [y], [], _ -> y\r
- | _, _, _ -> raise (ParsingError "???")\r
+ | _, _, _ -> assert false\r
;;\r
\r
let parse_many strs =\r
let f (x, y) z = match read_smt y (explode z) with\r
| Some[tm], [], vars -> (tm :: x, vars)\r
- | _, _, _ -> raise (ParsingError "???")\r
+ | _, _, _ -> assert false\r
in let aux = List.fold_left f ([], ([], [])) (* index zero is reserved *)\r
in let (tms, (_, free)) = aux strs\r
in (List.rev tms, free)\r
let strs = [div] @ ps @ conv in\r
\r
if List.length ps = 0 && List.length conv = 0\r
- then raise (ParsingError "empty problem");\r
+ then raise (ParsingError "Parsed empty problem");\r
\r
(* parse' *)\r
let (tms, free) = parse_many strs in\r
then None\r
else match div with\r
| `I _ as t -> Some t\r
- | _ -> raise (ParsingError "div is not an inert or BOT in the initial problem") in\r
+ | _ -> raise (ParsingError "D is not an inert in the initial problem") in\r
let conv = Util.filter_map (\r
function\r
| #i_n_var as t -> Some t\r
| `Lam _ -> None\r
- | _ -> raise (ParsingError "A term in conv is not i_n_var")\r
+ | _ -> raise (ParsingError "A C-term is not i_n_var")\r
) conv in\r
let ps = List.map (\r
function\r
| #i_n_var as y -> y\r
- | _ as y -> raise (ParsingError ("A term in num is not i_n_var" ^ Num.string_of_nf y))\r
+ | _ -> raise (ParsingError "An N-term is not i_n_var")\r
) ps in\r
name, div, conv, ps, free\r
;;\r