This repository has been archived by the owner on Jan 16, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCUI.ml
101 lines (98 loc) · 3.12 KB
/
CUI.ml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
(* This file is distributed under the terms of the GNU Lesser General Public License Version 2.1 *)
(* Jeongbong Seo, Jonghyun Park, Sungwoo Park *)
(* Programming Language Laboratory, POSTECH *)
(* {baramseo, parjong, gla}@postech.ac.kr *)
open Common
open Core.Std
open Interactive
let loop () =
try begin
let cmd = Command.from_string_exn (read_line ()) in
try
begin
match cmd with
| Command.Open prop ->
Session.start_fprop ~fprop:prop
|! simpl_unwrap
| Command.Restart ->
Session.restart ()
|! simpl_unwrap
| Command.Close ->
Session.close ()
|! simpl_unwrap
| Command.Apply tac ->
Session.step tac
|! simpl_unwrap
| Command.Undo ->
Session.undo ()
|! simpl_unwrap
| Command.Auto i ->
Session.auto i
|! simpl_unwrap
| Command.Trivial ->
Session.trivial ()
|! simpl_unwrap
| Command.Next_subgoal ->
Session.next_subgoal ()
|! simpl_unwrap
| Command.Prev_subgoal ->
Session.prev_subgoal ()
|! simpl_unwrap
| Command.Next_branch ->
Session.next_branch ()
|! simpl_unwrap
| Command.Prev_branch ->
Session.prev_branch ()
|! simpl_unwrap
| Command.Save filename ->
Session.save filename
|! simpl_unwrap;
print_endline ("Saved the proof to '" ^ filename ^ "'.")
| Command.Save_seq_pic filename ->
Session.save_seq_pic ~filename
|! simpl_unwrap
| Command.Fork ->
Session.fork ()
|! simpl_unwrap
| Command.Print_history ->
Session.print_history () |! print_endline
| Command.Help ->
Session.help_msg () |! print_endline
| Command.Quit ->
exit 0;
| Command.Show_all ->
Session.show_all ()
| Command.Show_visible ->
Session.show_visible ()
| Command.Show_toggle ->
Session.show_toggle ()
end;
print_newline ();
Session.to_string () |! print_endline
with
| Failure msg -> print_endline msg
end
with
| Failure msg ->
Core.Core_string.concat ~sep:"\n"
[ "Invalid command:";
msg;]
|! print_endline
let _ =
try
Printexc.record_backtrace true;
Session.init ();
print_endline "--------------------------------------------------------------------------------";
print_endline " Welcome to BBEye prover";
print_endline "";
Session.to_string () |! print_endline;
while true do
print_endline "--------------------------------------------------------------------------------";
print_string "> ";
loop ()
done
with
| (Failure msg) as e ->
Printexc.print_backtrace stdout |! print_newline;
print_string msg |! print_newline;
raise e