-
Notifications
You must be signed in to change notification settings - Fork 112
experiment: Viper integration #3477
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
88 commits
Select commit
Hold shift + click to select a range
62595d0
stub code for viper
crusso fce1e32
initial command line arg
crusso cc5499f
output translations, add annotations and formatting
crusso 353050e
some viper
crusso e11d486
start on pretty (not pretty)
crusso b14abe3
hack in more viper
crusso 18e6003
better printing
crusso 07a7912
mo stuff
crusso 4b0a637
fix translation of NotE
crusso 838d399
plumb contexts
crusso 2615160
add self prefix on field access; add self param to methods
crusso 9f7d795
handle await async {}; add test variants
crusso 6c12511
viper: src-loc mapping (#3484)
ggreif 18449d7
viper: cleanups (#3485)
ggreif 36bea43
viper: testing (#3487)
ggreif c6feeaf
handle equality comparisons
ggreif 137337e
handle `OrE` and `AndE`
ggreif d1799c9
fix copy&pasto
ggreif 47ad446
implement `>`
ggreif 6b59baf
pretty-print all binary operators
ggreif 4544491
binops
ggreif 228ba23
viper: invariants (#3488)
ggreif 7459811
pretty-print `null`
ggreif e5a25af
Support generation of __init__ methods based on actor private fields …
aterga 9f1761b
Add 'moc.js' endpoint for Viper integration
rvanasa 7ca05ce
Reorganize moc.js endpoint
rvanasa 2883120
Convert JS array to OCaml array
rvanasa e56ee70
update `viperserver` nightly
ggreif 33edfca
indentation
ggreif 1a061f2
Generate method specs in Motoko to Viper translation (#3496)
aterga fcce511
viper: assertions (#3499)
ggreif c62fa80
experiment: viper await async ghost state (#3500)
crusso 08c8941
Add async constraint into test/viper/claim.mo
aterga 222b601
Add manual encoding into test/viper/ok/claim.vpr.ok
aterga 44fb500
fix tests to increment counter
crusso 59d7ba8
viper: map translation exceptions to diagnostic errors (#3503)
crusso fee72de
viper: error source mappings in `moc.js` (#3501)
rvanasa 0835e12
XON/XOFF for methods
ggreif 5e112ec
viper: parse and emit concurrency assertions (#3504)
ggreif 29ae2b6
tidy code; report more unsupported syntax; add // @verify to test sou…
crusso b8bdba2
viper: ignore generated `.mo.vpr` files
ggreif 45d100a
viper: refactor using !!! helper (#3511)
crusso d76781f
viper: add the concurrency condition, observe verification fail (#3507)
ggreif 80c1d39
turn runtime `assert`s into Viper `assume`s (#3506)
ggreif 29d87d6
bump `viperserver.jar`
ggreif a8b19cf
Support static assertions as `assert:system` in Motoko to Viper trans…
aterga b18c52e
Reset 'marks' at the beginning of 'prog_mapped'
rvanasa adc5e3e
Merge pull request #3523 from dfinity/ryan/viper-reset-pretty
ggreif 1e34444
patch `rocksdb`
ggreif ddaeb09
next try
ggreif a88eb35
victory!
ggreif 218a85d
clean up
ggreif f59eba0
Delete rocks.diff
ggreif 74cc67a
Delete rocks1.diff
ggreif 54fd3f4
only do the defines for M1
ggreif e3cbe22
Merge branch 'gabor/m1' into viper
ggreif eadb2d5
bump to newest nightly
ggreif 13f67e0
filter out underscores
ggreif 487e041
ignore viper temporaries
ggreif 8cf94fb
viper: conditionalise lexer/grammar (#3574)
ggreif 15152f8
viper: enable recent VS Code extension improvements (#3581)
rvanasa fbf13f5
cover `WhileS`, but no invariant yet
ggreif d097d3c
explicitly fail on `MethodCallS` and `LabelS`
ggreif de28e14
Update default.nix
ggreif 4fd7011
refresh the download link
ggreif d0c5f9d
accept
ggreif 401520d
add ingredients for viper testing
ggreif 91a4d92
accept
ggreif f0701f4
Merge branch 'master' into viper
ggreif 857a0f7
undo merge snafu
ggreif f24d08c
simplify
ggreif 1dcd79e
Merge branch 'master' into viper
crusso 5c3954f
move IMPLIES token to assertions.mly
crusso 5072557
tweaks
crusso f93555f
viper: associate the first `exhale` with the `async` expression (#3524)
ggreif 74553c7
viper: switch to stable server (#3593)
ggreif 1222479
Merge branch 'master' into viper
ggreif 585bc73
add a Changelog entry
ggreif 781ded2
Remove crib sheet
ggreif ffa3c73
remove more
ggreif 55af544
spruce up this test a bit
ggreif 98c563f
add some more features
ggreif 4f15125
fix: thread the mode into the parser (#3599)
ggreif e8edbcb
test that `--viper` works
ggreif 7bf2635
Update test/repl/viper.sh
ggreif 7127efd
Merge remote-tracking branch 'origin/master' into viper
ggreif 998f484
Document `--viper` in `src/viper/README.md` (#3601)
aterga de46df9
Merge branch 'master' into viper
aterga File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,9 @@ result* | |
|
||
/samples/**/*.txt | ||
|
||
**/*.mo.vpr | ||
test/viper/tmp | ||
|
||
enable-internals | ||
|
||
# Editor configuration | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
%{ | ||
|
||
let verification_syntax_error at code msg = | ||
Diag.add_msg (Option.get !Parser_lib.msg_store) | ||
(Diag.error_message at code "verification syntax" msg) | ||
|
||
(* Verification mode only *) | ||
|
||
let (&&&) cond (action : Mo_def.Syntax.exp) = | ||
if not cond then | ||
verification_syntax_error | ||
action.Source.at | ||
"M0181" "verification assertions not permitted in normal mode"; | ||
action | ||
|
||
let is_verification () = | ||
match !Parser_lib.mode with | ||
| None -> assert false | ||
| Some mode -> mode.Lexer_lib.verification | ||
|
||
%} | ||
|
||
(* Viper-only tokens and productions *) | ||
|
||
%token INVARIANT | ||
%token IMPLIES | ||
(* | ||
%nonassoc IMPLIES (* see parser.mly *) | ||
*) | ||
|
||
%% | ||
|
||
%public exp_bin(B) : | ||
| e1=exp_bin(B) IMPLIES e2=exp_bin(ob) | ||
{ ImpliesE(e1, e2) @? at $sloc } | ||
|
||
%public exp_nondec(B) : | ||
| ASSERT COLON SYSTEM e=exp_nest | ||
{ is_verification () &&& AssertE(Static, e) @? at $sloc } | ||
| ASSERT COLON INVARIANT e=exp_nest | ||
{ is_verification () &&& AssertE(Invariant, e) @? at $sloc } | ||
| ASSERT COLON FUNC e=exp_nest | ||
{ is_verification () &&& AssertE(Precondition, e) @? at $sloc } | ||
| ASSERT COLON RETURN e=exp_nest | ||
{ is_verification () &&& AssertE(Postcondition, e) @? at $sloc } | ||
| ASSERT COLON s=NAT COLON ASYNC e=exp_nest | ||
{ is_verification () &&& AssertE(Concurrency s, e) @? at $sloc } | ||
|
||
%% |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.