/
g_relation_extraction.ml4
82 lines (68 loc) · 3.56 KB
/
g_relation_extraction.ml4
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
(****************************************************************************)
(* RelationExtraction - Extraction of inductive relations for Coq *)
(* *)
(* This program is free software: you can redistribute it and/or modify *)
(* it under the terms of the GNU General Public License as published by *)
(* the Free Software Foundation, either version 3 of the License, or *)
(* (at your option) any later version. *)
(* *)
(* This program is distributed in the hope that it will be useful, *)
(* but WITHOUT ANY WARRANTY; without even the implied warranty of *)
(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *)
(* GNU General Public License for more details. *)
(* *)
(* You should have received a copy of the GNU General Public License *)
(* along with this program. If not, see <http://www.gnu.org/licenses/>. *)
(* *)
(* Copyright 2011 CNAM-ENSIIE *)
(* Catherine Dubois <dubois@ensiie.fr> *)
(* David Delahaye <david.delahaye@cnam.fr> *)
(* Pierre-Nicolas Tollitte <tollitte@ensiie.fr> *)
(****************************************************************************)
(*i camlp4deps: "parsing/grammar.cma" i*)
open Genarg
open Pp
open Relation_extraction
let pr_mode _ _ _ (id, mode) =
str "" ++ spc () ++ str "[" ++
(List.fold_left (fun b e -> b ++ spc () ++ int e) (mt ()) mode) ++
spc () ++ str "]"
ARGUMENT EXTEND mode
TYPED AS reference * (int list)
PRINTED BY pr_mode
| [ global(id) "[" integer_list(mde) "]" ] -> [ (id, mde) ]
END
VERNAC COMMAND EXTEND ExtractionRelation
| [ "Extraction" "Relation" mode(mde) ] ->
[ relation_extraction (fst mde) [ mde ] ]
| [ "Extraction" "Relation" mode(mde) "with" mode_list(modes) ] ->
[ relation_extraction (fst mde) (mde :: modes) ]
END
VERNAC COMMAND EXTEND ExtractionRelationRelaxed
| [ "Extraction" "Relation" "Relaxed" mode(mde) ] ->
[ relation_extraction_order (fst mde) [ mde ] ]
| [ "Extraction" "Relation" "Relaxed" mode(mde) "with" mode_list(modes) ] ->
[ relation_extraction_order (fst mde) (mde :: modes) ]
END
VERNAC COMMAND EXTEND ExtractionRelationSingle
| [ "Extraction" "Relation" "Single" mode(mde) ] ->
[ relation_extraction_single (fst mde) [ mde ] ]
| [ "Extraction" "Relation" "Single" mode(mde) "with" mode_list(modes) ] ->
[ relation_extraction_single (fst mde) (mde :: modes) ]
END
VERNAC COMMAND EXTEND ExtractionRelationSingleRelaxed
| [ "Extraction" "Relation" "Single" "Relaxed" mode(mde) ] ->
[ relation_extraction_single_order (fst mde) [ mde ] ]
| [ "Extraction" "Relation" "Single" "Relaxed" mode(mde) "with" mode_list(modes) ] ->
[ relation_extraction_single_order (fst mde) (mde :: modes) ]
END
VERNAC COMMAND EXTEND ExtractionRelationFixpoint
| [ "Extraction" "Relation" "Fixpoint" mode(mde) ] ->
[ relation_extraction_fixpoint (fst mde) [ mde ] ]
| [ "Extraction" "Relation" "Fixpoint" mode(mde) "with" mode_list(modes) ] ->
[ relation_extraction_fixpoint (fst mde) (mde :: modes) ]
END
VERNAC COMMAND EXTEND ExtractionRelationPrint
| [ "Extraction" "Relation" "Print" string(str) ] ->
[ extraction_print str ]
END