diff options
| author | letouzey | 2010-06-02 15:06:03 +0000 |
|---|---|---|
| committer | letouzey | 2010-06-02 15:06:03 +0000 |
| commit | 700f011316e067fa7311ba23d2195a483376a284 (patch) | |
| tree | c548be08b0a32ef7457afc4cdc4e875ef19997e7 /plugins/extraction/ExtrOcamlBasic.v | |
| parent | 5dcfaee7251c9b7833b7f87d6f9b7528cc4aed7d (diff) | |
Extraction: start of a support library
- ExtrOcamlBasic: mapping of basic types to ocaml's ones
- ExtrOcamlIntConv: conversion between int and coq's numerical types
- ExtrOcamlBigIntConv: same with big_int (no overflow)
- ExtrOcamlNatInt: realizes nat by int (unsafe)
more to come: Haskell, handling of stings, more stuff in ExtrOcamlNatInt,
etc etc...
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@13050 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'plugins/extraction/ExtrOcamlBasic.v')
| -rw-r--r-- | plugins/extraction/ExtrOcamlBasic.v | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/plugins/extraction/ExtrOcamlBasic.v b/plugins/extraction/ExtrOcamlBasic.v new file mode 100644 index 0000000000..1fcdfd655c --- /dev/null +++ b/plugins/extraction/ExtrOcamlBasic.v @@ -0,0 +1,33 @@ +(************************************************************************) +(* v * The Coq Proof Assistant / The Coq Development Team *) +(* <O___,, * CNRS-Ecole Polytechnique-INRIA Futurs-Universite Paris Sud *) +(* \VV/ **************************************************************) +(* // * This file is distributed under the terms of the *) +(* * GNU Lesser General Public License Version 2.1 *) +(************************************************************************) + +(** Extraction to Ocaml : use of basic Ocaml types *) + +Extract Inductive bool => bool [ true false ]. +Extract Inductive option => option [ Some None ]. +Extract Inductive prod => "( * )" [ "" ]. + (* The "" above is a hack, but produce nicer code than with "(,)" *) +Extract Inductive unit => unit [ "()" ]. +Extract Inductive list => list [ "[]" "( :: )" ]. + +(** We could also map sumbool to bool, sumor to option, but + this isn't always a gain in clarity. We leave it to the user... + +Extract Inductive sumbool => bool [ true false ]. +Extract Inductive sumor => option [ Some None ]. +*) + +(** Restore lazyness of andb, orb. + NB: without these Extract Constant, andb/orb would be inlined + by extraction in order to have lazyness, producing inelegant + (if ... then ... else false) and (if ... then true else ...). +*) + +Extract Inlined Constant andb => "(&&)". +Extract Inlined Constant orb => "(||)". + |
