Skip to content

Commit a59b15d

Browse files
committed
Nagini Converting
1 parent 0860638 commit a59b15d

28 files changed

+518
-80
lines changed

CODE_OF_CONDUCT.md

100644100755
File mode changed.

CONTRIBUTING.md

100644100755
File mode changed.

DAFNY.ORG.txt

100644100755
File mode changed.

INSTALL.md

100644100755
File mode changed.

LICENSE.txt

100644100755
File mode changed.

Makefile

100644100755
File mode changed.

NOTICES.txt

100644100755
File mode changed.

README.md

100644100755
File mode changed.

RELEASE_NOTES.md

100644100755
File mode changed.

SECURITY.md

100644100755
File mode changed.

Scripts/quicktest.sh

+1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ $DAFNY build -t:go c.dfy | diff - $tmp || exit 1
6363
./c | diff - $tmpx || exit 1
6464
(cd c-go; GO111MODULE=auto GOPATH=`pwd` go run src/c.go) | diff - $tmpx || exit 1
6565
echo Building with Python
66+
echo $DAFNY
6667
$DAFNY build -t:py c.dfy | diff - $tmp || exit 1
6768
python c-py/c.py | diff - $tmpx || exit 1
6869
echo Building with Rust

Source/Dafny.sln

+38
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,32 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DafnyDriver.Test", "DafnyDr
4343
EndProject
4444
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DafnyCore.Test", "DafnyCore.Test\DafnyCore.Test.csproj", "{33C29F26-A27B-474D-B436-83EA615B09FC}"
4545
EndProject
46+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Boogie", "Boogie", "{60332269-9C5D-465E-8582-01F9B738BD90}"
47+
EndProject
48+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BaseTypes", "..\boogie\Source\BaseTypes\BaseTypes.csproj", "{68721962-0D91-4355-BC94-BE1CCBD30E47}"
49+
EndProject
50+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AbstractInterpretation", "..\boogie\Source\AbstractInterpretation\AbstractInterpretation.csproj", "{2A6B36F4-9F15-459A-8EDB-5BAEED98FE17}"
51+
EndProject
52+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeContractsExtender", "..\boogie\Source\CodeContractsExtender\CodeContractsExtender.csproj", "{09662044-5640-4785-92E3-2F7CDBA4DDB2}"
53+
EndProject
54+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Concurrency", "..\boogie\Source\Concurrency\Concurrency.csproj", "{DA8A9BA8-9BBA-4C64-9736-FD967517DCA9}"
55+
EndProject
56+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Core", "..\boogie\Source\Core\Core.csproj", "{2BF5ECCA-24B2-4A4B-86B6-D0DB17331109}"
57+
EndProject
58+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExecutionEngine", "..\boogie\Source\ExecutionEngine\ExecutionEngine.csproj", "{0145DC89-7243-41F8-AB3E-F716F04E9BFF}"
59+
EndProject
60+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Graph", "..\boogie\Source\Graph\Graph.csproj", "{05DE24BB-D639-40C4-894F-701652F51559}"
61+
EndProject
62+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Houdini", "..\boogie\Source\Houdini\Houdini.csproj", "{51D6B0D1-2D15-40A3-80F4-E32A5C07B0A6}"
63+
EndProject
64+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Model", "..\boogie\Source\Model\Model.csproj", "{D97C23B6-FB4A-4450-930E-58EC83D308A0}"
65+
EndProject
66+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SMTLib", "..\boogie\Source\Provers\SMTLib\SMTLib.csproj", "{0EC245EE-54DD-4AE3-9C2E-34E67EE28B9F}"
67+
EndProject
68+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VCExpr", "..\boogie\Source\VCExpr\VCExpr.csproj", "{E760E37E-0257-4C96-89C4-722F85BABDBB}"
69+
EndProject
70+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VCGeneration", "..\boogie\Source\VCGeneration\VCGeneration.csproj", "{1EE372AA-4FF9-47FB-9C04-18CBF219F6E8}"
71+
EndProject
4672
EndProject
4773
Global
4874
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -138,5 +164,17 @@ Global
138164
SolutionGuid = {280F572B-D27A-4613-998F-00B6FFE01187}
139165
EndGlobalSection
140166
GlobalSection(NestedProjects) = preSolution
167+
{68721962-0D91-4355-BC94-BE1CCBD30E47} = {60332269-9C5D-465E-8582-01F9B738BD90}
168+
{2A6B36F4-9F15-459A-8EDB-5BAEED98FE17} = {60332269-9C5D-465E-8582-01F9B738BD90}
169+
{09662044-5640-4785-92E3-2F7CDBA4DDB2} = {60332269-9C5D-465E-8582-01F9B738BD90}
170+
{DA8A9BA8-9BBA-4C64-9736-FD967517DCA9} = {60332269-9C5D-465E-8582-01F9B738BD90}
171+
{2BF5ECCA-24B2-4A4B-86B6-D0DB17331109} = {60332269-9C5D-465E-8582-01F9B738BD90}
172+
{0145DC89-7243-41F8-AB3E-F716F04E9BFF} = {60332269-9C5D-465E-8582-01F9B738BD90}
173+
{05DE24BB-D639-40C4-894F-701652F51559} = {60332269-9C5D-465E-8582-01F9B738BD90}
174+
{51D6B0D1-2D15-40A3-80F4-E32A5C07B0A6} = {60332269-9C5D-465E-8582-01F9B738BD90}
175+
{D97C23B6-FB4A-4450-930E-58EC83D308A0} = {60332269-9C5D-465E-8582-01F9B738BD90}
176+
{0EC245EE-54DD-4AE3-9C2E-34E67EE28B9F} = {60332269-9C5D-465E-8582-01F9B738BD90}
177+
{E760E37E-0257-4C96-89C4-722F85BABDBB} = {60332269-9C5D-465E-8582-01F9B738BD90}
178+
{1EE372AA-4FF9-47FB-9C04-18CBF219F6E8} = {60332269-9C5D-465E-8582-01F9B738BD90}
141179
EndGlobalSection
142180
EndGlobal

Source/DafnyCore/AST/Statements/Assignment/LocalVariable.cs

+8-2
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,14 @@ public string AssignUniqueName(FreshIdGenerator generator) {
8080
sanitizedName ??= $"_{IVariable.CompileNameIdGenerator.FreshNumericId()}_{SanitizedNameShadowable}";
8181

8282
string compileName;
83-
public string CompileName =>
84-
compileName ??= SanitizedName;
83+
public string CompileName {
84+
get {
85+
return compileName ??= SanitizedName;
86+
}
87+
set {
88+
compileName = value;
89+
}
90+
}
8591

8692
// TODO rename and update comment? Or make it nullable?
8793
public readonly Type SyntacticType; // this is the type mentioned in the declaration, if any

Source/DafnyCore/AST/Types/UserDefinedType.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ void ObjectInvariant() {
1717
}
1818

1919
public readonly Expression NamePath; // either NameSegment or ExprDotName (with the inner expression satisfying this same constraint)
20-
public readonly string Name;
20+
public string Name;
2121
[Rep]
2222

2323
public string FullName {

Source/DafnyCore/Backends/CSharp/CsharpCodeGenerator.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -2046,7 +2046,7 @@ protected override void EmitHalt(IToken tok, Expression/*?*/ messageExpr, Concre
20462046
}
20472047

20482048
protected override ConcreteSyntaxTree EmitForStmt(IToken tok, IVariable loopIndex, bool goingUp, string /*?*/ endVarName,
2049-
List<Statement> body, LList<Label> labels, ConcreteSyntaxTree wr) {
2049+
List<Statement> body, LList<Label> labels, out ConcreteSyntaxTree annotWriter, ConcreteSyntaxTree wr) {
20502050

20512051
wr.Write($"for ({TypeName(loopIndex.Type, wr, tok)} {loopIndex.CompileName} = ");
20522052
var startWr = wr.Fork();
@@ -2062,6 +2062,7 @@ protected override ConcreteSyntaxTree EmitForStmt(IToken tok, IVariable loopInde
20622062
bodyWr.WriteLine($"{loopIndex.CompileName}--;");
20632063
}
20642064
bodyWr = EmitContinueLabel(labels, bodyWr);
2065+
annotWriter = bodyWr.Fork();
20652066
TrStmtList(body, bodyWr);
20662067

20672068
return startWr;

Source/DafnyCore/Backends/Cplusplus/CppCodeGenerator.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1324,7 +1324,7 @@ protected override void EmitHalt(IToken tok, Expression messageExpr, ConcreteSyn
13241324
}
13251325

13261326
protected override ConcreteSyntaxTree EmitForStmt(IToken tok, IVariable loopIndex, bool goingUp, string /*?*/ endVarName,
1327-
List<Statement> body, LList<Label> labels, ConcreteSyntaxTree wr) {
1327+
List<Statement> body, LList<Label> labels, out ConcreteSyntaxTree annotWriter, ConcreteSyntaxTree wr) {
13281328
throw new UnsupportedFeatureException(tok, Feature.ForLoops, "for loops have not yet been implemented");
13291329
}
13301330

Source/DafnyCore/Backends/Dafny/DafnyCodeGenerator.cs

+4-2
Original file line numberDiff line numberDiff line change
@@ -1170,15 +1170,17 @@ protected override ConcreteSyntaxTree EmitBlock(ConcreteSyntaxTree wr) {
11701170
}
11711171

11721172
protected override ConcreteSyntaxTree EmitForStmt(IToken tok, IVariable loopIndex, bool goingUp, string endVarName,
1173-
List<Statement> body, LList<Label> labels, ConcreteSyntaxTree wr) {
1173+
List<Statement> body, LList<Label> labels, out ConcreteSyntaxTree annotWriter, ConcreteSyntaxTree wr) {
11741174
AddUnsupportedFeature(tok, Feature.ForLoops);
1175+
annotWriter = null;
11751176
return wr;
11761177
}
11771178

1178-
protected override ConcreteSyntaxTree CreateWhileLoop(out ConcreteSyntaxTree guardWriter, ConcreteSyntaxTree wr) {
1179+
protected override ConcreteSyntaxTree CreateWhileLoop(out ConcreteSyntaxTree guardWriter, out ConcreteSyntaxTree annotWriter, ConcreteSyntaxTree wr) {
11791180
if (wr is BuilderSyntaxTree<StatementContainer> statementContainer) {
11801181
var whileBuilder = statementContainer.Builder.While();
11811182
guardWriter = new BuilderSyntaxTree<ExprContainer>(whileBuilder, this);
1183+
annotWriter = guardWriter.Fork();
11821184
return new BuilderSyntaxTree<StatementContainer>(whileBuilder, this);
11831185
} else {
11841186
throw new InvalidOperationException();

Source/DafnyCore/Backends/GoLang/GoCodeGenerator.cs

+4-2
Original file line numberDiff line numberDiff line change
@@ -2065,15 +2065,16 @@ protected override void EmitHalt(IToken tok, Expression messageExpr, ConcreteSyn
20652065
}
20662066
}
20672067

2068-
protected override ConcreteSyntaxTree CreateWhileLoop(out ConcreteSyntaxTree guardWriter, ConcreteSyntaxTree wr) {
2068+
protected override ConcreteSyntaxTree CreateWhileLoop(out ConcreteSyntaxTree guardWriter, out ConcreteSyntaxTree annotWriter, ConcreteSyntaxTree wr) {
20692069
wr.Write("for ");
20702070
guardWriter = wr.Fork();
20712071
var wBody = wr.NewBlock("");
2072+
annotWriter = wr.Fork();
20722073
return wBody;
20732074
}
20742075

20752076
protected override ConcreteSyntaxTree EmitForStmt(IToken tok, IVariable loopIndex, bool goingUp, string /*?*/ endVarName,
2076-
List<Statement> body, LList<Label> labels, ConcreteSyntaxTree wr) {
2077+
List<Statement> body, LList<Label> labels, out ConcreteSyntaxTree annotWriter, ConcreteSyntaxTree wr) {
20772078

20782079
wr.Write($"for {loopIndex.CompileName} := ");
20792080
var startWr = wr.Fork();
@@ -2109,6 +2110,7 @@ protected override ConcreteSyntaxTree EmitForStmt(IToken tok, IVariable loopInde
21092110
}
21102111
}
21112112
bodyWr = EmitContinueLabel(labels, bodyWr);
2113+
annotWriter = bodyWr.Fork();
21122114
TrStmtList(body, bodyWr);
21132115

21142116
return startWr;

Source/DafnyCore/Backends/Java/JavaCodeGenerator.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -3823,7 +3823,7 @@ protected override ConcreteSyntaxTree CreateForLoop(string indexVar, Action<Conc
38233823
}
38243824

38253825
protected override ConcreteSyntaxTree EmitForStmt(IToken tok, IVariable loopIndex, bool goingUp, string /*?*/ endVarName,
3826-
List<Statement> body, LList<Label> labels, ConcreteSyntaxTree wr) {
3826+
List<Statement> body, LList<Label> labels, out ConcreteSyntaxTree annotWriter, ConcreteSyntaxTree wr) {
38273827

38283828
var nativeType = AsNativeType(loopIndex.Type);
38293829

@@ -3865,6 +3865,7 @@ protected override ConcreteSyntaxTree EmitForStmt(IToken tok, IVariable loopInde
38653865
}
38663866
}
38673867
bodyWr = EmitContinueLabel(labels, bodyWr);
3868+
annotWriter = bodyWr.Fork();
38683869
TrStmtList(body, bodyWr);
38693870

38703871
return startWr;

Source/DafnyCore/Backends/JavaScript/JavaScriptCodeGenerator.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1242,7 +1242,7 @@ protected override void EmitHalt(IToken tok, Expression/*?*/ messageExpr, Concre
12421242
}
12431243

12441244
protected override ConcreteSyntaxTree EmitForStmt(IToken tok, IVariable loopIndex, bool goingUp, string /*?*/ endVarName,
1245-
List<Statement> body, LList<Label> labels, ConcreteSyntaxTree wr) {
1245+
List<Statement> body, LList<Label> labels, out ConcreteSyntaxTree annotWriter, ConcreteSyntaxTree wr) {
12461246

12471247
var nativeType = AsNativeType(loopIndex.Type);
12481248

@@ -1280,6 +1280,7 @@ protected override ConcreteSyntaxTree EmitForStmt(IToken tok, IVariable loopInde
12801280
}
12811281
}
12821282
bodyWr = EmitContinueLabel(labels, bodyWr);
1283+
annotWriter = bodyWr.Fork();
12831284
TrStmtList(body, bodyWr);
12841285

12851286
return startWr;

0 commit comments

Comments
 (0)