1
(************************************************************************)
2
(* v * The Coq Proof Assistant / The Coq Development Team *)
3
(* <O___,, * CNRS-Ecole Polytechnique-INRIA Futurs-Universite Paris Sud *)
4
(* \VV/ **************************************************************)
5
(* // * This file is distributed under the terms of the *)
6
(* * GNU Lesser General Public License Version 2.1 *)
7
(************************************************************************)
9
(*i camlp4deps: "parsing/grammar.cma" i*)
18
let pr_mlname _ _ _ s = spc () ++ qs s
20
ARGUMENT EXTEND mlname
23
| [ preident(id) ] -> [ id ]
24
| [ string(s) ] -> [ s ]
30
let pr_language = function
31
| Ocaml -> str "Ocaml"
32
| Haskell -> str "Haskell"
33
| Scheme -> str "Scheme"
35
VERNAC ARGUMENT EXTEND language
36
PRINTED BY pr_language
37
| [ "Ocaml" ] -> [ Ocaml ]
38
| [ "Haskell" ] -> [ Haskell ]
39
| [ "Scheme" ] -> [ Scheme ]
42
(* Extraction commands *)
44
VERNAC COMMAND EXTEND Extraction
45
(* Extraction in the Coq toplevel *)
46
| [ "Extraction" global(x) ] -> [ simple_extraction x ]
47
| [ "Recursive" "Extraction" ne_global_list(l) ] -> [ full_extraction None l ]
49
(* Monolithic extraction to a file *)
50
| [ "Extraction" string(f) ne_global_list(l) ]
51
-> [ full_extraction (Some f) l ]
54
(* Modular extraction (one Coq library = one ML module) *)
55
VERNAC COMMAND EXTEND ExtractionLibrary
56
| [ "Extraction" "Library" ident(m) ]
57
-> [ extraction_library false m ]
60
VERNAC COMMAND EXTEND RecursiveExtractionLibrary
61
| [ "Recursive" "Extraction" "Library" ident(m) ]
62
-> [ extraction_library true m ]
66
VERNAC COMMAND EXTEND ExtractionLanguage
67
| [ "Extraction" "Language" language(l) ]
68
-> [ extraction_language l ]
71
VERNAC COMMAND EXTEND ExtractionInline
72
(* Custom inlining directives *)
73
| [ "Extraction" "Inline" ne_global_list(l) ]
74
-> [ extraction_inline true l ]
77
VERNAC COMMAND EXTEND ExtractionNoInline
78
| [ "Extraction" "NoInline" ne_global_list(l) ]
79
-> [ extraction_inline false l ]
82
VERNAC COMMAND EXTEND PrintExtractionInline
83
| [ "Print" "Extraction" "Inline" ]
84
-> [ print_extraction_inline () ]
87
VERNAC COMMAND EXTEND ResetExtractionInline
88
| [ "Reset" "Extraction" "Inline" ]
89
-> [ reset_extraction_inline () ]
92
VERNAC COMMAND EXTEND ExtractionBlacklist
93
(* Force Extraction to not use some filenames *)
94
| [ "Extraction" "Blacklist" ne_ident_list(l) ]
95
-> [ extraction_blacklist l ]
98
VERNAC COMMAND EXTEND PrintExtractionBlacklist
99
| [ "Print" "Extraction" "Blacklist" ]
100
-> [ print_extraction_blacklist () ]
103
VERNAC COMMAND EXTEND ResetExtractionBlacklist
104
| [ "Reset" "Extraction" "Blacklist" ]
105
-> [ reset_extraction_blacklist () ]
109
(* Overriding of a Coq object by an ML one *)
110
VERNAC COMMAND EXTEND ExtractionConstant
111
| [ "Extract" "Constant" global(x) string_list(idl) "=>" mlname(y) ]
112
-> [ extract_constant_inline false x idl y ]
115
VERNAC COMMAND EXTEND ExtractionInlinedConstant
116
| [ "Extract" "Inlined" "Constant" global(x) "=>" mlname(y) ]
117
-> [ extract_constant_inline true x [] y ]
120
VERNAC COMMAND EXTEND ExtractionInductive
121
| [ "Extract" "Inductive" global(x) "=>" mlname(id) "[" mlname_list(idl) "]" ]
122
-> [ extract_inductive x (id,idl) ]