This commit is contained in:
parent
aa2ff7b2f0
commit
2f3113f55d
11742 changed files with 1223940 additions and 0 deletions
|
|
@ -0,0 +1,53 @@
|
|||
$ cat >dune-project <<EOF
|
||||
> (lang dune 2.5)
|
||||
> (using coq 0.2)
|
||||
> EOF
|
||||
|
||||
$ cat >extract.v <<EOF
|
||||
> Definition nb (b : bool) : bool :=
|
||||
> match b with
|
||||
> | false => true
|
||||
> | true => false
|
||||
> end.
|
||||
>
|
||||
> Require Extraction.
|
||||
> Separate Extraction nb.
|
||||
> EOF
|
||||
|
||||
$ cat >dune <<EOF
|
||||
> (coq.extraction
|
||||
> (prelude extract)
|
||||
> (extracted_modules Datatypes extract))
|
||||
>
|
||||
> (executable
|
||||
> (name foo))
|
||||
> EOF
|
||||
|
||||
$ cat >foo.ml <<EOF
|
||||
> open Datatypes
|
||||
> let () =
|
||||
> print_endline (
|
||||
> match Extract.nb Datatypes.Coq_true with
|
||||
> | Coq_true -> "true"
|
||||
> | Coq_false -> "false"
|
||||
> )
|
||||
> EOF
|
||||
|
||||
$ dune exec ./foo.exe
|
||||
Warning: Coq Language Versions lower than 0.8 have been deprecated in Dune
|
||||
3.8 and will be removed in an upcoming Dune version.
|
||||
Hint: To disable this warning, add the following to your dune-project file:
|
||||
(warnings (deprecated_coq_lang_lt_08 disabled))
|
||||
false
|
||||
$ ls _build/default
|
||||
Datatypes.ml
|
||||
Datatypes.mli
|
||||
extract.glob
|
||||
extract.ml
|
||||
extract.mli
|
||||
extract.v
|
||||
extract.vo
|
||||
extract.vok
|
||||
extract.vos
|
||||
foo.exe
|
||||
foo.ml
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
(executable
|
||||
(name my_prog))
|
||||
|
||||
(rule
|
||||
(target my_coq_file.ml)
|
||||
(deps extraction/my_coq_file.ml)
|
||||
(action
|
||||
(with-stdout-to %{target}
|
||||
; here you patch stuff
|
||||
(cat %{deps}))))
|
||||
|
||||
(copy_files extraction/Datatypes.ml)
|
||||
(copy_files extraction/Datatypes.mli)
|
||||
(copy_files extraction/my_coq_file.mli)
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
(lang dune 3.7)
|
||||
(using coq 0.7)
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
(coq.extraction
|
||||
(mode vo)
|
||||
(prelude my_coq_file)
|
||||
(extracted_modules Datatypes my_coq_file))
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
Definition nb (b : bool) : bool :=
|
||||
match b with
|
||||
| false => true
|
||||
| true => false
|
||||
end.
|
||||
|
||||
Require Extraction.
|
||||
Separate Extraction nb.
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
let bool_to_string (b : Datatypes.bool) : string =
|
||||
match b with
|
||||
| Datatypes.Coq_true -> "true"
|
||||
| Datatypes.Coq_false -> "false"
|
||||
|
||||
let () =
|
||||
Datatypes.Coq_true
|
||||
|> My_coq_file.nb
|
||||
|> bool_to_string
|
||||
|> Printf.printf "Result: %s\n"
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
|
||||
$ dune build
|
||||
Warning: Coq Language Versions lower than 0.8 have been deprecated in Dune
|
||||
3.8 and will be removed in an upcoming Dune version.
|
||||
Hint: To disable this warning, add the following to your dune-project file:
|
||||
(warnings (deprecated_coq_lang_lt_08 disabled))
|
||||
|
||||
$ ls _build/default
|
||||
Datatypes.ml
|
||||
Datatypes.mli
|
||||
extraction
|
||||
my_coq_file.ml
|
||||
my_coq_file.mli
|
||||
my_prog.exe
|
||||
my_prog.ml
|
||||
my_prog.mli
|
||||
|
||||
$ cat _build/default/Datatypes.ml
|
||||
|
||||
type bool =
|
||||
| Coq_true
|
||||
| Coq_false
|
||||
|
||||
$ dune exec -- ./my_prog.exe
|
||||
Warning: Coq Language Versions lower than 0.8 have been deprecated in Dune
|
||||
3.8 and will be removed in an upcoming Dune version.
|
||||
Hint: To disable this warning, add the following to your dune-project file:
|
||||
(warnings (deprecated_coq_lang_lt_08 disabled))
|
||||
Result: false
|
||||
Loading…
Add table
Add a link
Reference in a new issue