]> matita.cs.unibo.it Git - fireball-separation.git/blob - ocaml/problems.ml
Code clean-up
[fireball-separation.git] / ocaml / problems.ml
1 open Lambda4;;
2 open Util;;
3
4 (* Syntax for problem files in problem/ folder:
5
6 - dollar ($) on newline
7   begin new problem
8   $! means that the problem is expected to be separable,
9   $? means that it is expected to be unseparable
10
11 - (#) on new line
12   comment line
13
14 - (D) (C) (N) stand respectively for divergent, convergent, numeric
15
16 - lines starting with spaces inherit the type from the last line
17
18 *)
19
20 (* assert_depends solves the problem, and checks if the result was expected *)
21 let assert_depends x =
22  let c = String.sub (label_of_problem x) 0 1 in
23  match solve x with
24  | `Unseparable s when c = "!" ->
25     failwith ("assert_depends: unseparable because: " ^ s ^ ".")
26  | `Separable _  when c = "?" ->
27     failwith ("assert_depends: separable.")
28  | _ -> ()
29 ;;
30
31 (* TODO *)
32 (* div under a lambda in conv *)
33
34 if Array.length Sys.argv = 1
35  then failwith "no command line args. Please use e.g. ./a.out problems/*"
36 else Array.iteri (fun i filename -> if i > 0 then
37  List.iter (assert_depends ++ problem_of) (Parser.from_file filename)
38  ) Sys.argv
39 ;;