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
286a3b89
Commit
286a3b89
authored
Dec 30, 2010
by
Jean-Christophe Filliâtre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
programs: syntax for infix and prefix symbols
parent
9ddba7a4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
20 deletions
+18
-20
bench/programs/good/booleans.mlw
bench/programs/good/booleans.mlw
+7
-7
modules/stdlib.mlw
modules/stdlib.mlw
+2
-2
src/parser/parser.pre.mly
src/parser/parser.pre.mly
+4
-4
tests/test-pgm-jcf.mlw
tests/test-pgm-jcf.mlw
+5
-7
No files found.
bench/programs/good/booleans.mlw
View file @
286a3b89
...
...
@@ -17,14 +17,14 @@ let test_and_1 () =
{ result = 1 }
let test_and_2 () =
{
!
x <> 0 }
{ x <> 0 }
if id_not_0 !x >= 1 && !x <= 1 then !x else 0+1
{ result = 1 }
let test_or_1 () =
{ }
if (incr x; !x > 0) || !x < 0 then 1 else 2
{ result = 1 ->
!
x <> 0 }
{ result = 1 -> x <> 0 }
let test_or_2 () =
{ }
...
...
@@ -34,17 +34,17 @@ let test_or_2 () =
let test_not_1 () =
{ }
if not (!x = 0) then x := 0
{
!
x = 0 }
{ x = 0 }
let test_not_2 () =
{
!
x <= 0 }
{ x <= 0 }
while not (!x = 0) do invariant { !x <= 0 } incr x done
{
!
x = 0 }
{ x = 0 }
let test_all_1 () =
{ }
(!x >= 0 && not (!x = 0) || !x >= 1)
{ result=True <->
!
x>=1 }
{ result=True <-> x>=1 }
(* from Cesar Munoz's CD3D *)
...
...
@@ -58,7 +58,7 @@ parameter sq : x:int -> {} int { result = x*x }
let test_cd3d () =
{ true }
if !vx=0 && !vy=0 && sq !vx + sq !vy < sq d then 1 else 2
{ result=1 ->
!vx=0 and !
vy=0 }
{ result=1 ->
vx=0 and
vy=0 }
end
...
...
modules/stdlib.mlw
View file @
286a3b89
...
...
@@ -7,9 +7,9 @@ module Ref
parameter ref : v:'a -> {} ref 'a { result=v }
parameter
get
: r:ref 'a -> {} 'a reads r { result=r }
parameter
(!)
: r:ref 'a -> {} 'a reads r { result=r }
parameter
set
: r:ref 'a -> v:'a -> {} unit writes r { r=v }
parameter
(:=)
: r:ref 'a -> v:'a -> {} unit writes r { r=v }
end
...
...
src/parser/parser.pre.mly
View file @
286a3b89
...
...
@@ -855,13 +855,13 @@ list1_program_decl:
program_decl
:
|
decl
{
Dlogic
$
1
}
|
LET
lident
labels
list1_type_v_binder
opt_cast
EQUAL
triple
|
LET
lident
_rich
labels
list1_type_v_binder
opt_cast
EQUAL
triple
{
Dlet
(
add_lab
$
2
$
3
,
mk_expr_i
7
(
Efun
(
$
4
,
cast_body
$
5
$
7
)))
}
|
LET
lident
labels
EQUAL
FUN
list1_type_v_binder
ARROW
triple
|
LET
lident
_rich
labels
EQUAL
FUN
list1_type_v_binder
ARROW
triple
{
Dlet
(
add_lab
$
2
$
3
,
mk_expr_i
8
(
Efun
(
$
6
,
$
8
)))
}
|
LET
REC
list1_recfun_sep_and
{
Dletrec
$
3
}
|
PARAMETER
lident
labels
COLON
type_v
|
PARAMETER
lident
_rich
labels
COLON
type_v
{
Dparam
(
add_lab
$
2
$
3
,
$
5
)
}
|
EXCEPTION
uident
labels
{
Dexn
(
add_lab
$
2
$
3
,
None
)
}
...
...
@@ -893,7 +893,7 @@ list1_recfun_sep_and:
;
recfun
:
|
lident
labels
list1_type_v_binder
opt_cast
opt_variant
EQUAL
triple
|
lident
_rich
labels
list1_type_v_binder
opt_cast
opt_variant
EQUAL
triple
{
add_lab
$
1
$
2
,
$
3
,
$
5
,
cast_body
$
4
$
7
}
;
...
...
tests/test-pgm-jcf.mlw
View file @
286a3b89
...
...
@@ -8,21 +8,19 @@ module P
let incr (r : ref int) : unit =
{ }
set r (get r + 1)
r := !r + 1
{ r = old r + 1 }
parameter r : ref int
let foo (x : int) =
{ x = 1 }
if x = 1 || absurd then 2 else 3
{ result = 2 }
let rec (!!) (x : ref int) =
{ x>=0 } if !x > 0 then begin x := !x - 1; !! x end { x=0 }
let
f
(r : ref int) =
let
test
(r : ref int) =
{ r = 0 }
assert { r = 0 };
incr r;
get
r
!
r
{ result = 1 }
end
...
...
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