Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
why3
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
119
Issues
119
List
Boards
Labels
Service Desk
Milestones
Merge Requests
16
Merge Requests
16
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Why3
why3
Commits
eb517957
Commit
eb517957
authored
Mar 04, 2014
by
MARCHE Claude
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
extraction de max_sum -> joli petit bug d'extraction a corriger !
parent
5af37ada
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
61 additions
and
4 deletions
+61
-4
doc/exec.tex
doc/exec.tex
+4
-2
examples/vstte10_max_sum.mlw
examples/vstte10_max_sum.mlw
+5
-2
examples/vstte10_max_sum/Makefile.in
examples/vstte10_max_sum/Makefile.in
+44
-0
examples/vstte10_max_sum/main.ml
examples/vstte10_max_sum/main.ml
+8
-0
No files found.
doc/exec.tex
View file @
eb517957
...
...
@@ -59,9 +59,11 @@ among which we find a file \texttt{maxsum\_\_MaxAndSum.ml} containing
the OCaml code for functions
\texttt
{
max
\_
sum
}
and
\texttt
{
test
}
.
To compile it, we create a file
\texttt
{
main.ml
}
containing a call to
\texttt
{
test
}
, that is
containing a call to
\texttt
{
test
}
, that is
for example
\begin{whycode}
let () = test ()
let (s,m) = test () in
Format.printf "sum=
%s, max=%s@."
(Why3
__
BigInt.to
_
string s) (Why3
__
BigInt.to
_
string m)
\end{whycode}
and we pass both files
\texttt
{
maxsum
\_\_
MaxAndSum.ml
}
and
\texttt
{
main.ml
}
to the OCaml compiler:
...
...
examples/vstte10_max_sum.mlw
View file @
eb517957
...
...
@@ -60,7 +60,7 @@ module TestCase
exception BenchFailure
let test
_case () raises { BenchFailure -> true }
=
let test
()
=
let n = 10 in
let a = make n 0 in
a[0] <- 9;
...
...
@@ -73,7 +73,10 @@ module TestCase
a[7] <- 1;
a[8] <- 10;
a[9] <- 6;
let (s, m) = max_sum a n in
max_sum a n
let test_case () raises { BenchFailure -> true } =
let (s, m) = test () in
assert { s = 45 };
assert { m = 10 };
(* bench of --exec *)
...
...
examples/vstte10_max_sum/Makefile.in
0 → 100644
View file @
eb517957
MAIN
=
main
OBJ
=
vstte10_max_sum__MaxAndSum2 vstte10_max_sum__TestCase
ML
=
$(
addsuffix
.ml,
$(OBJ)
)
CMO
=
$(
addsuffix
.cmo,
$(OBJ)
)
CMX
=
$(
addsuffix
.cmx,
$(OBJ)
)
OCAMLOPT
=
ocamlopt
-noassert
-inline
1000
INCLUDE
=
@BIGINTINCLUDE@
-I
../../lib/why3
all
:
$(MAIN).@OCAMLBEST@
extract
:
$(ML)
$(MAIN).byte
:
$(CMO) $(MAIN).cmo
ocamlc
$(INCLUDE)
@BIGINTLIB@.cma why3extract.cma
-o
$@
$^
$(MAIN).opt
:
$(CMX) $(MAIN).cmx
$(OCAMLOPT)
$(INCLUDE)
@BIGINTLIB@.cmxa why3extract.cmxa
-o
$@
$^
$(MAIN).cmx
:
$(CMX)
$(ML)
:
../vstte10_max_sum.mlw
../../bin/why3
-E
ocaml32 ../vstte10_max_sum.mlw
-o
.
%.cmx
:
%.ml
$(OCAMLOPT)
$(INCLUDE)
-annot
-c
$<
%.cmo
:
%.ml
ocamlc
$(INCLUDE)
-annot
-c
$<
%.cmi
:
%.mli
ocamlc
$(INCLUDE)
-annot
-c
$<
clean
::
rm
-f
$(ML)
*
.cm[xio]
*
.o
*
.annot
$(MAIN)
.opt
$(MAIN)
.byte
rm
-f
why3__
*
.ml
*
vstte10_max_sum__
*
.ml
*
int__
*
.ml
*
Makefile
:
Makefile.in ../../config.status
cd
../..
;
./config.status
chmod
--file
examples/vstte10_max_sum/Makefile
examples/vstte10_max_sum/main.ml
0 → 100644
View file @
eb517957
open
Why3extract
open
Format
let
()
=
let
(
s
,
m
)
=
Vstte10_max_sum__TestCase
.
test
()
in
printf
"sum=%s, max=%s@."
(
Why3__BigInt
.
to_string
s
)
(
Why3__BigInt
.
to_string
m
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment