Skip to content
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

Syncing RDE Work #4745

Open
wants to merge 41 commits into
base: master
Choose a base branch
from
Open

Syncing RDE Work #4745

wants to merge 41 commits into from

Conversation

ssomayyajula
Copy link
Contributor

Description

Pretty printing RDE Dafny backend + Dafny Abstract Machine.

How has this been tested?

Pretty printing tested on "Hello, World".

By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.

@ssomayyajula ssomayyajula marked this pull request as draft November 7, 2023 22:29
Copy link
Collaborator

@RustanLeino RustanLeino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here are a few style comments.

@@ -2,15 +2,209 @@ module {:extern "ResolvedDesugaredExecutableDafnyPlugin"} ResolvedDesugaredExecu
import opened DAST
import PrettyPrinter
import UnsupportedFeature
import DAM

class COMP {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Class COMP only has static members. Remove the class altogether and instead declare the members as module-level members.

Copy link
Contributor Author

@ssomayyajula ssomayyajula Dec 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I think that should be fine as long as Compiler-dafny.cs does not depend on the fact that COMP is a class by way of its translation to C# in GeneratedFromDafny.cs.

Comment on lines 161 to 166
case Break(lab) => {
match lab
case Some(lab) =>
st := DAM.Throw(DAM.Var(lab), DAM.Skip());
case None => UnsupportedFeature.Throw(); st := DAM.Skip();
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of putting { ... } around the entire match lab ... statement, put the { ... } around the list of cases, like this:

match lab {
  case Some(lab) =>
    ...
  case None => ...
}

type Field = string

datatype Pos =
Unit
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a prefix | to make all the alternatives look the same.

}

// S |- stack <= start- <= end-
predicate CheckStack(s: StoreTyping, start: Neg, stack: Stack, end: Neg) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name CheckStack sounds operational, using the verb "check". Wouldn't it be more appropriate to think of a predicate is using an adjective, like ValidStack?

For that matter, it is also possible to rename the predicate just Valid and declare it as a member of the StoreTyping type.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for grouping checking/synthesis functions into each type definition

The terminology Check/Synth is a reference to the two modes of bidirectional typing (checking against a type vs. synthesis of a type).

@ssomayyajula ssomayyajula marked this pull request as ready for review December 21, 2023 22:20
@ssomayyajula ssomayyajula self-assigned this Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants