Debian Codegraph @

topbin/rocqworker.ml

raw symbols SCIP
1 (************************************************************************)
2 (* * The Rocq Prover / The Rocq Development Team *)
3 (* v * Copyright INRIA, CNRS and contributors *)
4 (* <O___,, * (see version control and CREDITS file for authors & dates) *)
5 (* \VV/ **************************************************************)
6 (* // * This file is distributed under the terms of the *)
7 (* * GNU Lesser General Public License Version 2.1 *)
8 (* * (see LICENSE file for the text of the license) *)
9 (************************************************************************)
10
11 module WProof = AsyncTaskQueue.MakeWorker(Stm.ProofTask) ()
12 module WQuery = AsyncTaskQueue.MakeWorker(Stm.QueryTask) ()
13 module WTactic = AsyncTaskQueue.MakeWorker(Partac.TacTask) ()
14
15 let error s () =
16 Format.eprintf "Usage: rocqworker --kind=[compile|repl|proof|query|tactic] $args@\ngot %s\n%!" s;
17 exit 1
18
19 type kind =
20 | Worker of { init : unit -> unit; loop : unit -> unit }
21 | Compile
22 | Repl
23
24 let start kind args = match kind with
25 | Worker { init; loop } -> WorkerLoop.start ~init ~loop args
26 | Compile -> Coqc.main args
27 | Repl -> Coqtop.(start_coq coqtop_toplevel args)
28
29 let () =
30 if Array.length Sys.argv < 2
31 then error "no argument" ()
32 else
33 let argv = List.tl (Array.to_list Sys.argv) in
34 let kind = List.hd argv in
35 let argv = List.tl argv in
36 let kind =
37 match kind with
38 | "--kind=compile" -> Compile
39 | "--kind=repl" -> Repl
40 | "--kind=proof" -> Worker { init = WProof.init_stdout; loop = WProof.main_loop }
41 | "--kind=query" -> Worker { init = WQuery.init_stdout; loop = WQuery.main_loop }
42 | "--kind=tactic" -> Worker { init = WTactic.init_stdout; loop = WTactic.main_loop }
43 | s -> error s ()
44 in
45 start kind argv