-
Notifications
You must be signed in to change notification settings - Fork 263
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
Feat: Dafny-to-Rust code indentation and identifiers #4974
Merged
Merged
Changes from all commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
0628309
Added initial tests to support allocation
MikaelMayer 7649600
Implemented codatatypes
MikaelMayer 06c65ba
Sequences now defined. Only need to define more methods
MikaelMayer 5fc5bf4
Support for traits and mutable variables without dynamic dispatch(?)
MikaelMayer b72cec9
Arguments always borrowed, deallocation more general now
MikaelMayer c2f8b24
Conversion to/from Rust strings, better handling of is_string
MikaelMayer bed8f90
Got rid of DafnyClone
MikaelMayer 79f1503
Immutable lazy maps
MikaelMayer 4b0fae7
Support to subtype testing
MikaelMayer 754022c
Make sure StreamReaders are closed after use
MikaelMayer 22a2897
Formatting fix 2
MikaelMayer ae3081c
Needed to updated GeneratedFromDafny apparently
MikaelMayer 705b1ca
Aligning with existing runtime
MikaelMayer 13defc6
More idiomatic rust identifiers, started to deal with indentation
MikaelMayer ded93a3
Allow dead code + finished all trivial impl
MikaelMayer 70e1dcf
Added standard library
MikaelMayer 6c6236a
Support for subset of standard libraries
MikaelMayer aa3e84a
much better Rust output
MikaelMayer eccae5e
Proof that ID encoding is bijective so that there is no collision
MikaelMayer 5ba5c93
Constant initialization for datatypes and tests with closures
MikaelMayer c7fb7c0
Merge branch 'master' into feat-rust
MikaelMayer 770da14
Fixed the merge build
MikaelMayer 1cb67f2
Merge branch 'master' into feat-rust-indentation
MikaelMayer be32004
Fixed the build
MikaelMayer d0d51db
Merge branch 'master' into feat-rust-indentation
MikaelMayer a02d416
Merge branch 'master' into feat-rust-indentation
MikaelMayer 4ace3fc
Fixed CI test issue
MikaelMayer 8d0e038
Merge branch 'feat-rust-indentation' of https://github.com/dafny-lang…
MikaelMayer a8e39f3
Merge branch 'master' into feat-rust-indentation
MikaelMayer 3bd7222
Merge branch 'master' into feat-rust-indentation
MikaelMayer 3de581a
fixed makefile
MikaelMayer 98fd9a1
Merge branch 'master' into feat-rust-indentation
MikaelMayer e44508e
Merge branch 'feat-rust-indentation' of https://github.com/dafny-lang…
MikaelMayer f017545
Formatting
MikaelMayer 6e8c650
Merge branch 'master' into feat-rust-indentation
MikaelMayer 965b7bd
should review comment
MikaelMayer 69aeac1
Merge branch 'feat-rust-indentation' of https://github.com/dafny-lang…
MikaelMayer 65cdcc5
Removed is_string and node_count
MikaelMayer ac460b1
Removed experimentation file
MikaelMayer 037b54a
Merge branch 'master' into feat-rust-indentation
MikaelMayer 837ff9b
Fixed the merge build
MikaelMayer 79fcfb9
Fixed CI
MikaelMayer 32b8ee8
Merge branch 'master' into feat-rust-indentation
MikaelMayer 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 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 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 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 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.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That seems like a good idea to me, but it assumes that the goal of the DAST is to be as simple as possible, rather than retaining extra information that might produce better output in some contexts. I think that's a good design goal personally, but this file should be more explicit about documenting that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally I want:
I was able to accomplish both goals the following way, as this step has already been accomplished in the next PR. The design is the following:
BinaryOp(Implies, x, y)
becomesBinaryOp(Or, Not(x), y)
, same for all the variants of <= and < and != and == etc.BinaryOp
andUnaryOp
so that compilers can decide to enhance the rendering of the operators based on original Dafny information, but that should only be an optional idiomatic rendering step or a transformation of the target language AST to another more idiomatic target language AST.This ensures conversions are done minimally .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both good goals to have, but there will be times when they conflict. :)
Sounds like you're saying in this case we might annotate the AST further if we decided we need to know when the original Dafny source was
A ==> B
as opposed to!A || B
. I think that's a reasonable general approach: keep the AST itself minimal so getting to simple correct translation is easier, but add more additional information when you feel the need to improve the output.I think it's worth stating that tenet in or around this file somewhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just added to the top of
AST.dfy
for the next PR: