Skip to content

Commit d3c3eda

Browse files
AD1024ankushdesai
andauthored
[PVerifier] exception handling for PVerifier-specific tokens (#906)
* [tweak] exception handling for PVerifier-specific tokens * save * fix Raft pproj config --------- Co-authored-by: Ankush Desai <[email protected]>
1 parent dff7bae commit d3c3eda

File tree

3 files changed

+21
-15
lines changed

3 files changed

+21
-15
lines changed

Src/PCompiler/CompilerCore/Compiler.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ public int Compile(ICompilerConfiguration job)
3434
Environment.ExitCode = 1;
3535
return Environment.ExitCode;
3636
}
37+
catch (NotSupportedException e)
38+
{
39+
job.Output.WriteError("[NotSupportedError:]\n" + e.Message);
40+
Environment.ExitCode = 1;
41+
return Environment.ExitCode;
42+
}
3743

3844
job.Output.WriteInfo("Type checking ...");
3945
// Run type checker and produce AST
@@ -163,7 +169,7 @@ private static PParser.ProgramContext Parse(ICompilerConfiguration job, FileInfo
163169
case PParser.INIT:
164170
case PParser.PURE:
165171
throw new NotSupportedException(
166-
$"line {token.Line}:{token.Column} \"{token.Text}\" only supported by PVerifier backend.");
172+
$"{inputFile.FullName} (line {token.Line}:{token.Column}): \"{token.Text}\" keyword is only supported by PVerifier backend.");
167173
}
168174
}
169175

Tutorial/5_Paxos/PSpec/common.p

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,52 @@
11
// Unreliably send event `e` with payload `p` to every `target`
2-
fun UnreliableBroadcast(targets: set[machine], e: event, payload: any) {
2+
fun UnreliableBroadcast(target_machines: set[machine], e: event, payload: any) {
33
var i: int;
4-
while (i < sizeof(targets)) {
4+
while (i < sizeof(target_machines)) {
55
if (choose()) {
6-
send targets[i], e, payload;
6+
send target_machines[i], e, payload;
77
}
88
i = i + 1;
99
}
1010
}
1111

1212
// Unreliably send event `e` with payload `p` to every `target`, potentially multiple times
13-
fun UnreliableBroadcastMulti(targets: set[machine], e: event, payload: any) {
13+
fun UnreliableBroadcastMulti(target_machines: set[machine], e: event, payload: any) {
1414
var i: int;
1515
var n: int;
1616
var k: int;
1717

18-
while (i < sizeof(targets)) {
18+
while (i < sizeof(target_machines)) {
1919
// Each message is sent `k` is that number of times
2020
k = choose(3);
2121
// Times we've sent the packet so far
2222
n = 0;
2323
while (n < k) {
24-
send targets[i], e, payload;
24+
send target_machines[i], e, payload;
2525
n = n + 1;
2626
}
2727
i = i + 1;
2828
}
2929
}
3030

3131
// Reliably send event `e` with payload `p` to every `target`
32-
fun ReliableBroadcast(targets: set[machine], e: event, payload: any) {
32+
fun ReliableBroadcast(target_machines: set[machine], e: event, payload: any) {
3333
var i: int;
34-
while (i < sizeof(targets)) {
35-
send targets[i], e, payload;
34+
while (i < sizeof(target_machines)) {
35+
send target_machines[i], e, payload;
3636
i = i + 1;
3737
}
3838
}
3939

4040
// Reliably send event `e` with payload `p` to a majority of `target`. Unreliable send to remaining, potentially multiple times.
41-
fun ReliableBroadcastMajority(targets: set[machine], e: event, payload: any) {
41+
fun ReliableBroadcastMajority(target_machines: set[machine], e: event, payload: any) {
4242
var i: int;
4343
var n: int;
4444
var k: int;
4545
var majority: int;
4646

47-
majority = sizeof(targets) / 2 + 1;
47+
majority = sizeof(target_machines) / 2 + 1;
4848

49-
while (i < sizeof(targets)) {
49+
while (i < sizeof(target_machines)) {
5050
// Each message is sent `k` is that number of times
5151
k = 1;
5252
if (i >= majority) {
@@ -55,7 +55,7 @@ fun ReliableBroadcastMajority(targets: set[machine], e: event, payload: any) {
5555
// Times we've sent the packet so far
5656
n = 0;
5757
while (n < k) {
58-
send targets[i], e, payload;
58+
send target_machines[i], e, payload;
5959
n = n + 1;
6060
}
6161
i = i + 1;

Tutorial/6_Raft/Raft.pproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
<PFile>./PTst/</PFile>
77
</InputFiles>
88
<OutputDir>./PGenerated/</OutputDir>
9-
<Target>CSharp</Target>
9+
<Target>PChecker</Target>
1010
</Project>

0 commit comments

Comments
 (0)