9 | TFF
-> fprintf fmt
"TFF"
10 | FOF
-> fprintf fmt
"FOF"
11 | CNF
-> fprintf fmt
"CNF"
15 | Axiom
-> fprintf fmt
"Axiom"
16 | Hypothesis
-> fprintf fmt
"Hypothesis"
17 | Definition
-> fprintf fmt
"Definition"
18 | Assumption
-> fprintf fmt
"Assumption"
19 | Corollary
-> fprintf fmt
"Corollary"
20 | Lemma
-> fprintf fmt
"Lemma"
21 | Theorem
-> fprintf fmt
"Theorem"
22 | Conjecture
-> fprintf fmt
"Conjecture"
23 | Negated_conjecture
-> fprintf fmt
"Negated_conjecture"
24 | Type
-> fprintf fmt
"Type"
28 | BOequ
-> fprintf fmt
"equ"
29 | BOnequ
-> fprintf fmt
"nequ"
30 | BOimp
-> fprintf fmt
"imp"
31 | BOpmi
-> fprintf fmt
"pmi"
32 | BOand
-> fprintf fmt
"and"
33 | BOor
-> fprintf fmt
"or"
34 | BOnand
-> fprintf fmt
"nand"
35 | BOnor
-> fprintf fmt
"nor"
37 let rec pr_expr fmt e
=
39 | Elet
(e1
,e2
) -> fprintf fmt
"Elet(...)"
40 | Eite
(e1
,e2
,e3
) -> fprintf fmt
"Eite(...)"
41 | Eqnt
(q
,vl
,e
) -> fprintf fmt
"Eqnt(...)"
43 fprintf fmt
"Ebin(%a,%a,%a)" pr_op op
pr_expr e1
pr_expr e2
44 | Enot e
-> fprintf fmt
"Enot(%a)" pr_expr e
45 | Eequ
(e1
,e2
) -> fprintf fmt
"Equ(%a,%a)" pr_expr e1
pr_expr e2
47 fprintf fmt
"Eapp(%s,[%a])" w
(Pp.print_list
Pp.comma
pr_expr) el
48 | Edef
(w
,el
) -> fprintf fmt
"Edef(...)"
49 | Evar v
-> fprintf fmt
"Evar(%s)" v
50 | Edob d
-> fprintf fmt
"Edob(...)"
51 | Enum n
-> fprintf fmt
"Enum(...)"
53 let pr_top_formula fmt f
=
55 | LogicFormula e
-> fprintf fmt
"LogicFormula(%a)" pr_expr e
56 | TypedAtom
(a
,t
) -> fprintf fmt
"TypedAtom"
57 | Sequent
(l1
,l2
) -> fprintf fmt
"Sequent"
61 | Formula
(kind
,name
,role
,top_formula
,loc
) ->
62 fprintf fmt
"@[<hov 2>{ kind = %a,@ name = '%s',@ role = %a,@ form = %a }@]"
63 pr_kind kind name
pr_role role
pr_top_formula top_formula
64 | Include
(file
,namelist
,loc
) ->
65 fprintf fmt
"include file '%s'" file
68 Pp.print_list
Pp.newline
pr_decl fmt a
70 exception Unsupported
of string
72 let unsupported s
= raise
(Unsupported s
)
76 | BOequ
-> unsupported "BOequ"
77 | BOnequ
-> unsupported "BOnequ"
79 | BOpmi
-> unsupported "BOpmi"
85 let rec check_expr e
= match e
.e_node
with
86 | Elet
(e1
,e2
) -> unsupported "let"
87 | Eite
(e1
,e2
,e3
) -> unsupported "ite"
88 | Eqnt
(q
,vl
,e
) -> check_expr e
89 | Ebin
(op
,e1
,e2
) -> check_op op
; check_expr e1
; check_expr e2
90 | Enot e
-> check_expr e
91 | Eequ
(e1
,e2
) -> unsupported "equ"
92 | Eapp
(w
,el
) -> List.iter
check_expr el
93 | Edef
(w
,el
) -> unsupported "def"
95 | Edob d
-> unsupported "dob"
96 | Enum n
-> unsupported "num"
98 let check_top_formula f
=
100 | LogicFormula e
-> check_expr e
101 | TypedAtom _
-> unsupported "TypedAtom"
102 | Sequent _
-> unsupported "Sequent"
108 | Definition
-> unsupported "Definition"
114 | Negated_conjecture
-> ()
115 | Type
-> unsupported "Type"
120 | TFF
-> unsupported "TFF"
126 | Include _
-> unsupported "Include"
127 | Formula
(kind
,_
,role
,top_formula
,_
) ->
128 check_kind kind
; check_role role
; check_top_formula top_formula
130 let check_file a
= List.iter
check_decl a
133 if Array.length
Sys.argv
<> 2 then
135 eprintf
"Usage: %s <file>@." Sys.argv
.(0);
139 let file = Sys.argv
.(1) in
141 let ast = Tptp_lexer.load
file in
143 (* printf "%a@." pr_file ast; *)
144 printf
"File '%s' is OK.@." file;
147 | Tptp_lexer.FileNotFound f
->
148 eprintf
"File not found: %s@." f
; exit
2
150 eprintf
"File %s: '%s' is not supported@." file s
; exit
1
152 eprintf
"Parsing error: %a@." Exn_printer.exn_printer e
;