diff --git a/.github/workflows/publishdocs.yml b/.github/workflows/publishdocs.yml
index ac3e21117..348f0038d 100644
--- a/.github/workflows/publishdocs.yml
+++ b/.github/workflows/publishdocs.yml
@@ -1,7 +1,9 @@
name: Publish Docs
on:
push:
- branches: [ main ]
+ branches: [ master ]
+ workflow_dispatch:
+
permissions:
contents: write
jobs:
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 17f29b3b4..bed46e38c 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -11,7 +11,7 @@ on:
description: Additional arguments
default: ""
required: false
-
+
jobs:
Release:
name: P release
diff --git a/.gitignore b/.gitignore
index 359fe07e2..f3310943e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -241,7 +241,7 @@ Tst/temp_builds/*
target/
*.class
-#Mkdocs
+#Mkdocs
site/
# Output
diff --git a/Bld/Deps/cvc5/cvc5-0.0.7-v5.pom b/Bld/Deps/cvc5/cvc5-0.0.7-v5.pom
index b90ec95f5..c4452051c 100644
--- a/Bld/Deps/cvc5/cvc5-0.0.7-v5.pom
+++ b/Bld/Deps/cvc5/cvc5-0.0.7-v5.pom
@@ -5,7 +5,7 @@
cvc5
0.0.7-v5
jar
-
+
CVC5 Java Bindings
CVC5 Java Bindings
https://github.com/cvc5/cvc5
@@ -15,15 +15,15 @@
${project.url}
-
+
${project.url}
-
+
${project.url}
-
+
\ No newline at end of file
diff --git a/Bld/Deps/monosat/monosat-1.6.0-v5.pom b/Bld/Deps/monosat/monosat-1.6.0-v5.pom
index 130979e87..b5c4aeb95 100644
--- a/Bld/Deps/monosat/monosat-1.6.0-v5.pom
+++ b/Bld/Deps/monosat/monosat-1.6.0-v5.pom
@@ -5,7 +5,7 @@
monosat
1.6.0-v5
jar
-
+
MonoSAT Java Bindings
MonoSAT Java Bindings
https://github.com/sambayless/monosat
@@ -15,15 +15,15 @@
${project.url}
-
+
${project.url}
-
+
${project.url}
-
+
\ No newline at end of file
diff --git a/Bld/Deps/pjbdd/pjbdd-1.0.10-10-v5.pom b/Bld/Deps/pjbdd/pjbdd-1.0.10-10-v5.pom
index 5ccc394e2..f2ee7559e 100644
--- a/Bld/Deps/pjbdd/pjbdd-1.0.10-10-v5.pom
+++ b/Bld/Deps/pjbdd/pjbdd-1.0.10-10-v5.pom
@@ -5,7 +5,7 @@
pjbdd
1.0.10-10-v5
jar
-
+
PJBDD Java Bindings
PJBDD Java Bindings
https://gitlab.com/sosy-lab/software/paralleljbdd/
@@ -15,15 +15,15 @@
${project.url}
-
+
${project.url}
-
+
${project.url}
-
+
\ No newline at end of file
diff --git a/Bld/Deps/yices/yices-1.0-v5.pom b/Bld/Deps/yices/yices-1.0-v5.pom
index 55f7d8d3c..dd6b4c6f7 100644
--- a/Bld/Deps/yices/yices-1.0-v5.pom
+++ b/Bld/Deps/yices/yices-1.0-v5.pom
@@ -5,7 +5,7 @@
yices
1.0-v5
jar
-
+
Yices 2 Java Bindings
Yices 2 Java Bindings
https://github.com/aman-goel/yices2_java_bindings
@@ -15,15 +15,15 @@
${project.url}
-
+
${project.url}
-
+
${project.url}
-
+
\ No newline at end of file
diff --git a/Bld/Deps/z3/z3-4.8.14-v5.pom b/Bld/Deps/z3/z3-4.8.14-v5.pom
index dcf55086e..ef97f33e0 100644
--- a/Bld/Deps/z3/z3-4.8.14-v5.pom
+++ b/Bld/Deps/z3/z3-4.8.14-v5.pom
@@ -5,7 +5,7 @@
z3
4.8.14-v5
jar
-
+
Z3 Java Bindings
Z3 Java Bindings
https://github.com/Z3Prover/z3
@@ -15,13 +15,13 @@
${project.url}
-
+
${project.url}
-
+
${project.url}
diff --git a/Docs/docs/advanced/p2c.md b/Docs/docs/advanced/p2c.md
index 47c24c52b..12629f466 100644
--- a/Docs/docs/advanced/p2c.md
+++ b/Docs/docs/advanced/p2c.md
@@ -99,7 +99,7 @@ int main(int argc, char *argv[]) {
processGuid.data3 = 0;
processGuid.data4 = 0;
MAIN_P_PROCESS = PrtStartProcess(processGuid, &P_GEND_IMPL_DefaultImpl, ErrorHandler, Log);
-
+
if (cooperative) {
PrtSetSchedulingPolicy(MAIN_P_PROCESS, PRT_SCHEDULINGPOLICY_COOPERATIVE);
}
@@ -113,12 +113,12 @@ int main(int argc, char *argv[]) {
PrtUpdateAssertFn(MyAssert);
PRT_UINT32 machineId;
PRT_BOOLEAN foundMainMachine = PrtLookupMachineByName("myMachine", &machineId);
-
+
if (foundMainMachine == PRT_FALSE) {
printf("%s\n", "FAILED TO FIND DroneMachine");
exit(1);
}
-
+
PrtMkMachine(MAIN_P_PROCESS, machineId, 1, &payload);
if (cooperative) {
diff --git a/Docs/docs/advanced/psemantics.md b/Docs/docs/advanced/psemantics.md
index 48511eccc..e1eca6a28 100644
--- a/Docs/docs/advanced/psemantics.md
+++ b/Docs/docs/advanced/psemantics.md
@@ -2,18 +2,18 @@ Before getting started with the tutorials, we provide a quick informal overview
**P is a programming language.** P is a state machine based _programming language_ and hence, just like any other imperative programming language it supports basic [data types](../manual/datatypes.md), [expressions](../manual/expressions.md), and [statements](../manual/statemachines.md) that enable programmers to capture complex distributed systems protocol logic as a collection of event-handlers or [functions](../manual/functions.md) (in P state machines).
-**P State machines.** The underlying model of computation for P state machines is similar to that of [Gul Agha's](http://osl.cs.illinois.edu/members/agha.html) [Actor-model-of-computation](https://dspace.mit.edu/handle/1721.1/6952) ([wiki](https://en.wikipedia.org/wiki/Actor_model)). A P program is a collection of concurrently executing state machines that communicate with eachother by sending events (or messages) asynchronously. Each P state machine has an **unbounded FIFO buffer** associated with it.
-Sends are **asynchronous**, i.e., executing a send operation `send t,e,v;` adds event `e` with payload value `v` into the FIFO buffer of the target machine `t`.
+**P State machines.** The underlying model of computation for P state machines is similar to that of [Gul Agha's](http://osl.cs.illinois.edu/members/agha.html) [Actor-model-of-computation](https://dspace.mit.edu/handle/1721.1/6952) ([wiki](https://en.wikipedia.org/wiki/Actor_model)). A P program is a collection of concurrently executing state machines that communicate with eachother by sending events (or messages) asynchronously. Each P state machine has an **unbounded FIFO buffer** associated with it.
+Sends are **asynchronous**, i.e., executing a send operation `send t,e,v;` adds event `e` with payload value `v` into the FIFO buffer of the target machine `t`.
Each state in the P state machine has an entry function associated with it which gets executed when the state machine enters that state. After executing the entry
-function, the machine tries to dequeue an event from the input buffer or blocks if the buffer is empty. Upon dequeuing an event from the input queue of the machine, the attached handler is executed which might transition the machine to a different state. We will provide more details about the P state machines in tutorials as well as the language manual.
+function, the machine tries to dequeue an event from the input buffer or blocks if the buffer is empty. Upon dequeuing an event from the input queue of the machine, the attached handler is executed which might transition the machine to a different state. We will provide more details about the P state machines in tutorials as well as the language manual.
For detailed formal semantics of P state machines, we refer the readers to the [original P paper](https://ankushdesai.github.io/assets/papers/p.pdf) and the [more recent paper](https://ankushdesai.github.io/assets/papers/modp.pdf) with updated semantics.
-There are **two main distinctions** with actor model of computation: (1) P adds the **syntactic sugar** of state machines to actors, and (2) each state machine in P has an **unbounded FIFO buffer** associated with it instead of an unbounded bag in actors (semantic difference).
+There are **two main distinctions** with actor model of computation: (1) P adds the **syntactic sugar** of state machines to actors, and (2) each state machine in P has an **unbounded FIFO buffer** associated with it instead of an unbounded bag in actors (semantic difference).
!!! danger "[Important] Send semantics in P"
Sends are reliable, buffered, non-blocking, and directed (not broadcast). Sends are **reliable** i.e., executing a send operation in P adds an event into the target machines buffer. Hence, if one wants to model message loss it has to be modeled explicitly (discussed in the Failure Detector example in the tutorial). Similarly, as P state machine buffers are FIFO, events are dequeued at the state machine in the **causal order** in which they were sent. Note that events that are sent by two different concurrent machines will be interleaved by the checker and hence, will appear in different order at the target machine but the events sent by the same machine will always appear in the same order at the target state machine. So, just like message loss, arbitrary message re-ordering also has to be explicitly modeled in P (explained in the Paxos example in the tutorials). In general, we find that re-ordering messages/events coming from the same machine is not important and does not lead to any interesting behaviors. More interesting behaviors happen because of interleaving of messages across different state machines which the P checker explores automatically.
- Summary, by default, the communication between state machines using `send` operation follows the above semantics. If you would like to check your system correctness against an arbitrarily network then one would have to model the corresponding `send` semantics in P explicitly. One can then make the arbitrarily network behave as expected with message duplicates, loss, re-order, etc.
+ Summary, by default, the communication between state machines using `send` operation follows the above semantics. If you would like to check your system correctness against an arbitrarily network then one would have to model the corresponding `send` semantics in P explicitly. One can then make the arbitrarily network behave as expected with message duplicates, loss, re-order, etc.
If you have any further doubts related to this topic and modeling network semantics when reasoning using P, feel free to get in touch with Ankush Desai. We have several examples of such cases.
diff --git a/Docs/docs/advanced/psym/install.md b/Docs/docs/advanced/psym/install.md
index 368a3d5a9..b65bda624 100644
--- a/Docs/docs/advanced/psym/install.md
+++ b/Docs/docs/advanced/psym/install.md
@@ -1,7 +1,7 @@
PSym is built to be cross-platform and can be used on MacOS, Linux, and Windows.
### [Steps 1 to 5] Install P
-Follow the instructions on installing P from [Installing P](../../getstarted/install.md)
+Follow the instructions on installing P from [Installing P](../../getstarted/install.md)
(at least up to and including [Step 3](../../getstarted/install.md#step-3-install-p-compiler))
### [Step 6] Install Maven
@@ -17,12 +17,12 @@ To install Maven use:
brew install maven
```
- Dont have Homebrew? Directly use [installer](https://maven.apache.org/install.html).
+ Dont have Homebrew? Directly use [installer](https://maven.apache.org/install.html).
=== "Ubuntu"
Installing Maven on Ubuntu ([details](https://phoenixnap.com/kb/install-maven-on-ubuntu))
-
+
```
sudo apt install maven
```
@@ -40,11 +40,11 @@ To install Maven use:
wget https://dlcdn.apache.org/maven/maven-3/3.8.6/binaries/apache-maven-3.8.6-bin.tar.gz
tar xfv apache-maven-3.8.6-bin.tar.gz
```
-
+
You might do this in your home directory, yielding a folder like `` /home/$USER/apache-maven-3.8.6 ``
-
+
Next, install the software into your environment by adding it to your path, and by defining Maven's environment variables:
-
+
```
export M2_HOME=/home/$USER/apache-maven-3.6.3
export M2=$M2_HOME/bin
diff --git a/Docs/docs/advanced/psym/usingPSym.md b/Docs/docs/advanced/psym/usingPSym.md
index d6ed73dab..ddd52618e 100644
--- a/Docs/docs/advanced/psym/usingPSym.md
+++ b/Docs/docs/advanced/psym/usingPSym.md
@@ -1,4 +1,4 @@
-!!! check ""
+!!! check ""
Before moving forward, we assume that you have successfully [installed PSym](install.md) :metal: .
In this section, we provide an overview of the steps involved in compiling and checking a P program with PSym
@@ -47,7 +47,7 @@ Simply pass the commandline argument `-generate:PSym` when running the P compile
!!! tip "Recommendation"
- We recommend using the P project file `*.pproj` along with passing `-generate:PSym` as commandline argument to the compiler
+ We recommend using the P project file `*.pproj` along with passing `-generate:PSym` as commandline argument to the compiler
to compile a P program for PSym.
Commandline argument `-generate:XXX` takes priority over `YYY ` in `*.pproj` file.
@@ -57,7 +57,7 @@ Simply pass the commandline argument `-generate:PSym` when running the P compile
``` shell
pc -proj:ClientServer.pproj -generate:PSym
```
-
+
??? info "Expected Output"
```
$ pc -proj:ClientServer.pproj -generate:PSym
@@ -101,7 +101,7 @@ java -jar target/ClientServer-jar-with-dependencies.jar
??? info "Expected Output"
```hl_lines="9 10 11 12"
java -jar target/ClientServer-jar-with-dependencies.jar
-
+
Picked up JAVA_TOOL_OPTIONS: -Dlog4j2.formatMsgNoLookups=true
WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance.
Reflections took 100 ms to scan 1 urls, producing 38 keys and 168 values
@@ -137,7 +137,7 @@ java -jar target/ClientServer-jar-with-dependencies.jar \
... Method tcSingleClient
... Project clientserver is using 'default' strategy (seed:0)
--------------------
- Time Memory Coverage Schedule Remaining Depth States
+ Time Memory Coverage Schedule Remaining Depth States
00:00:10 0.2 GB 1.4246418994 % 140 1820 (100 % data) 1 8043
--------------------
Estimated Coverage:: 1.4246418994 %
@@ -163,7 +163,7 @@ java -jar target/ClientServer-jar-with-dependencies.jar \
### Coverage
At the end of a run, PSym reports a coverage metric as an estimated percentage of the execution tree that is explored during
-the run. Assuming a uniform probability for each scheduling/data choice, this metric reports the probability of a
+the run. Assuming a uniform probability for each scheduling/data choice, this metric reports the probability of a
randomly-sampled schedule to be bug free.
??? info "Continuous Feedback"
@@ -171,14 +171,14 @@ randomly-sampled schedule to be bug free.
During the run, PSym prints useful metrics that summarizes the current status of the run.
For example, for the ClientServer run above, PSym prints:
-
+
```
- Time Memory Coverage Schedule Remaining Depth States
+ Time Memory Coverage Schedule Remaining Depth States
00:00:10 0.2 GB 1.4246418994 % 140 1820 (100 % data) 1 8043
```
-
+
that summarizes:
-
+
| Label | Description |
|-----------|----------------------------------------------------------------------------------|
| Time | Elapsed runtime in ``hh:mm:ss`` format |
@@ -194,20 +194,20 @@ randomly-sampled schedule to be bug free.
Sadly, No :pensive:!
- PSym's coverage metric is **not** a perfect state-space coverage metric.
- This metric gives more weightage to shorter schedules, or more precisely, schedules with fewer schedule/data
+ PSym's coverage metric is **not** a perfect state-space coverage metric.
+ This metric gives more weightage to shorter schedules, or more precisely, schedules with fewer schedule/data
choices at shallower search depths.
- Therefore, a PSym run can quickly reach a high estimated coverage (> 99 %) due to exploring shorter schedules
+ Therefore, a PSym run can quickly reach a high estimated coverage (> 99 %) due to exploring shorter schedules
first, after which gaining the remaining left-over percentage can become increasingly (and exponentially) difficult.
-
+
Our recommendation is to target achieving coverage up to 11 nines, i.e., 99.999999999 % to be sufficiently confident
of the absence of bug.
- Additionally, check PSym's Coverage Report (`` output/coverage-*.log ``) to understand the state-space covered
+ Additionally, check PSym's Coverage Report (`` output/coverage-*.log ``) to understand the state-space covered
during the run, as well as the number of distinct states explored.
-At the end of a run, PSym also prints a coverage report in `` output/coverage-*.log `` that tabulates, for each
-exploration step/depth, the number of schedule/data choices explored during the run, along with the number of
+At the end of a run, PSym also prints a coverage report in `` output/coverage-*.log `` that tabulates, for each
+exploration step/depth, the number of schedule/data choices explored during the run, along with the number of
choices remaining as unexplored backtracks.
For example, coverage report corresponding to the previous ClientServer run can be found in `` output/coverage-clientserver.log ``
@@ -226,21 +226,21 @@ For example, coverage report corresponding to the previous ClientServer run can
Depth Covered Remaining
sch data sch data
-------------------------------------
- 0 100
- 1 100
+ 0 100
+ 1 100
2 100 134 5806
- 3 135
- 4 134
- 5 134
- 6 134
+ 3 135
+ 4 134
+ 5 134
+ 6 134
7 134 50 1162
8 134 77 2659
- 9 127
- 10 127
+ 9 127
+ 10 127
11 127 36 559
12 127 48 1045
13 124 36 1149
- 14 120
+ 14 120
15 120 23 296
16 120 36 621
17 114 34 766
@@ -283,9 +283,9 @@ For example, coverage report corresponding to the previous ClientServer run can
```
??? tip "Improving Coverage for ClientServer"
- Looks like the ClientServer example is quite data heavy, since there are lots of unexplored data choices at different steps
+ Looks like the ClientServer example is quite data heavy, since there are lots of unexplored data choices at different steps
(check the rightmost column of `` output/coverage-clientserver.log ``).
- A good idea is to reduce the amount of data non-determinism by reducing the number of choices in the
+ A good idea is to reduce the amount of data non-determinism by reducing the number of choices in the
`choose(*)` expressions, such as the number of data choices in setting the initial bank balances in expression
`choose(100)` [here](https://github.com/p-org/P/blob/master/Tutorial/1_ClientServer/PTst/TestDriver.p#L30).
@@ -315,7 +315,7 @@ For a complete list of options, pass the argument ` --help `.
??? tip "Exploration Techniques"
PSym implements a collection of configurable techniques summarized as follows:
-
+
| Technique | Description |
|-----------------------|-------------------------------------------------------------------------------------|
| Search Strategy | Configure the order in which search is performed: `astar`, `random`, `dfs`, `learn` |
@@ -328,7 +328,7 @@ For a complete list of options, pass the argument ` --help `.
!!! info "Preconfigured Modes"
For ease of usage, PSym provides a set of preconfigured exploration modes as follows:
-
+
| Mode | Description |
|-----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `default` | Explore single execution at a time Search Strategy = `astar` Choice Selection = `random` Never Repeat States = `ON` Stateful Backtracking = `ON` BMC = `OFF` |
@@ -336,7 +336,7 @@ For a complete list of options, pass the argument ` --help `.
| `fuzz` | Explore like a random fuzzer (but never repeat an execution!) Search Strategy = `random` Choice Selection = `random` Never Repeat States = `OFF` Stateful Backtracking = `OFF` BMC = `OFF` |
| `dfs` | Explore single executions at a time in depth-first manner Search Strategy = `dfs` Choice Selection = `random` Never Repeat States = `ON` Stateful Backtracking = `ON` BMC = `OFF` |
| `learn` | Explore single execution at a time with learning Search Strategy = `learn` Choice Selection = `learn` Never Repeat States = `ON` Stateful Backtracking = `ON` BMC = `OFF` |
-
+
Pass the CLI argument ` --mode ` to set the exploration mode.
diff --git a/Docs/docs/advanced/psym/whatisPSym.md b/Docs/docs/advanced/psym/whatisPSym.md
index 7a1106460..aaa2f5dbc 100644
--- a/Docs/docs/advanced/psym/whatisPSym.md
+++ b/Docs/docs/advanced/psym/whatisPSym.md
@@ -1,19 +1,19 @@
-PSym is a new checker for P models developed to complement the default P checker with the primary objective
-to avoid repetition during state-space exploration. PSym guarantees to never repeat an already-explored execution, and
-hence, can exhaustively explore all possible executions. PSym also has an inbuilt coverage tracker that reports estimated
+PSym is a new checker for P models developed to complement the default P checker with the primary objective
+to avoid repetition during state-space exploration. PSym guarantees to never repeat an already-explored execution, and
+hence, can exhaustively explore all possible executions. PSym also has an inbuilt coverage tracker that reports estimated
coverage to give measurable and continuous feedback (even when no bug is found during exploration).
!!! tip "Recommendation"
-
- Exhaustively exploring all possible executions is generally not possible for large models due to
+
+ Exhaustively exploring all possible executions is generally not possible for large models due to
time/memory constraints.
- We recommend always trying PSym with easier tests first, such as ones with only a small number of replica machines and
+ We recommend always trying PSym with easier tests first, such as ones with only a small number of replica machines and
`choose(*)` expressions with fewer choices.
-
+
P compiler has a dedicated backend for PSym, which compiles the P model into a symbolically-instrumented intermediate
representation in Java, packed as a single `.jar` file. Executing the `.jar` file runs PSym runtime. Commandline arguments
-can be passed when running the `.jar` file to configure the exploration strategy. At the end of a run, PSym reports the
+can be passed when running the `.jar` file to configure the exploration strategy. At the end of a run, PSym reports the
result (safe / buggy / partially-safe), an error trace (if found a bug), along with a coverage and statistics report.
``` mermaid
diff --git a/Docs/docs/advanced/structureOfPProgram.md b/Docs/docs/advanced/structureOfPProgram.md
index af1e44d55..f09e1ef05 100644
--- a/Docs/docs/advanced/structureOfPProgram.md
+++ b/Docs/docs/advanced/structureOfPProgram.md
@@ -15,7 +15,7 @@ A P program is typically divided into four folders (or parts):
The `PForeign` folder contains
all the foreign code used in the P program.
-!!! Note "Recommendation"
+!!! Note "Recommendation"
The folder structure described above is just a recommendation.
The P compiler does not require any particular folder structure for a P project. The
examples in the [Tutorials](../tutsoutline.md) use the same folder structure.
diff --git a/Docs/docs/getstarted/install.md b/Docs/docs/getstarted/install.md
index 5bf8fef7f..721271818 100644
--- a/Docs/docs/getstarted/install.md
+++ b/Docs/docs/getstarted/install.md
@@ -24,7 +24,7 @@ P currently uses the specific version of [.Net SDK 8.0](https://dotnet.microsoft
=== "Ubuntu"
Installing .Net SDK on Ubuntu ([details](https://docs.microsoft.com/en-us/dotnet/core/install/linux-ubuntu))
-
+
```shell
wget https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
@@ -39,12 +39,12 @@ P currently uses the specific version of [.Net SDK 8.0](https://dotnet.microsoft
=== "Amazon Linux"
Installing .Net SDK on Amazon Linux 2 ([details](https://learn.microsoft.com/en-us/dotnet/core/install/linux-scripted-manual#scripted-install))
-
+
```shell
wget https://dotnet.microsoft.com/download/dotnet/scripts/v1/dotnet-install.sh
chmod +x dotnet-install.sh
./dotnet-install.sh -c 8.0 -i ~/.dotnet
-
+
# If using a bash shell, replace .zshrc with .bashrc in the below commands
echo 'PATH=$HOME/.dotnet:$HOME/.dotnet/tools:$PATH' >> ~/.zshrc
echo 'export PATH' >> ~/.zshrc
@@ -65,10 +65,10 @@ P currently uses the specific version of [.Net SDK 8.0](https://dotnet.microsoft
You must see an SDK with `8.0.*` dotnet version installed.
If you get `dotnet` command not found error, mostly likely, you need to add the path to dotnet in your `PATH`.
-
+
Useful resources:
- - For Ubuntu: [fxr does not exist](https://stackoverflow.com/questions/73753672/a-fatal-error-occurred-the-folder-usr-share-dotnet-host-fxr-does-not-exist)
+ - For Ubuntu: [fxr does not exist](https://stackoverflow.com/questions/73753672/a-fatal-error-occurred-the-folder-usr-share-dotnet-host-fxr-does-not-exist)
@@ -82,12 +82,12 @@ The P compiler also requires Java (`java` version 11 or higher).
```shell
brew install java
```
- Dont have Homebrew? Directly use [installer](https://www.java.com/en/download/help/mac_install.html).
+ Dont have Homebrew? Directly use [installer](https://www.java.com/en/download/help/mac_install.html).
=== "Ubuntu"
Installing Java on Ubuntu ([details](https://ubuntu.com/tutorials/install-jre#2-installing-openjdk-jre))
-
+
```shell
sudo apt install -y default-jre
```
diff --git a/Docs/docs/getstarted/usingP.md b/Docs/docs/getstarted/usingP.md
index 5c17f8797..261a4e9bb 100644
--- a/Docs/docs/getstarted/usingP.md
+++ b/Docs/docs/getstarted/usingP.md
@@ -1,6 +1,6 @@
!!! info "If you are using an older P version 1.x.x, please find the usage guide [here](../old/getstarted/usingP.md)"
-!!! check ""
+!!! check ""
Before moving forward, we assume that you have successfully installed
[P](install.md) and the [Peasy extension](PeasyIDE.md) :metal:.
@@ -10,12 +10,12 @@ section, we provide an overview of the steps involved in compiling and checking
using the [client server](../tutorial/clientserver.md) example in Tutorials.
-??? info "Get the Client Server Example Locally"
+??? info "Get the Client Server Example Locally"
We will use the [ClientServer](https://github.com/p-org/P/tree/master/Tutorial/1_ClientServer) example from Tutorial folder in P repository to describe the process of compiling and checking a P program. Please clone the P repo and navigate to the
ClientServer example in Tutorial.
Clone P Repo locally:
- ```shell
+ ```shell
git clone https://github.com/p-org/P.git
```
Navigate to the ClientServer examples folder:
@@ -32,7 +32,7 @@ There are two ways of compiling a P program:
1. Using a **P project file** (`*.pproj`) to provide all the required inputs to the compiler or
2. Passing all the P files (`*.p`) along with other options **as commandline arguments** to the compiler.
-!!! tip "Recommendation"
+!!! tip "Recommendation"
We recommend using the P project files to compile a P program.
??? help "P Compiler commandline options"
@@ -40,22 +40,22 @@ There are two ways of compiling a P program:
```
-----------------------------------------------
- usage: p compile [--help] [--pproj string] [--pfiles string] [--projname string] [--outdir string]
+ usage: p compile [--help] [--pproj string] [--pfiles string] [--projname string] [--outdir string]
The P compiler compiles all the P files in the project together and generates the executable that
can be checked for correctness by the P checker.
-
+
Compiling using `.pproj` file:
------------------------------
-pp, --pproj string : P project file to compile (*.pproj). If this option is not passed,
the compiler searches for a *.pproj in the current folder
-
+
Compiling P files directly through commandline:
-----------------------------------------------
-pf, --pfiles string : List of P files to compile
-pn, --projname string : Project name for the compiled output
-o, --outdir string : Dump output to directory (absolute or relative path)
-
+
Optional Arguments:
-------------------
-h, --help Show this help menu
@@ -96,14 +96,14 @@ There are two ways of compiling a P program:
Determining projects to restore...
Restored P/Tutorial/1_ClientServer/PGenerated/CSharp/ClientServer.csproj (in 102 ms).
ClientServer -> P/Tutorial/1_ClientServer/PGenerated/CSharp/net6.0/ClientServer.dll
-
+
Build succeeded.
0 Warning(s)
0 Error(s)
-
+
Time Elapsed 00:00:02.25
-
-
+
+
----------------------------------------
~~ [PTool]: Thanks for using P! ~~
```
@@ -127,12 +127,12 @@ There are two ways of compiling a P program:
./PGenerated/
```
- The `` block provides all the P files that must be compiled together for this project.
+ The `` block provides all the P files that must be compiled together for this project.
In `` one can either specify the path to a P file or to a folder and the P compiler includes all the `*.p` files in the folder during compilation.
The `` block provides the name for the project which is used as the output file name for the generated code.
The `` block provides the output directory for the generated code.
- Finally, the `` block provides a path to other P projects that must be included as dependencies during compilation.
- The P compiler simply recursively copies all the P files in the dependency projects (transitively including all P files in dependent projects) and compiles them together.
+ Finally, the `` block provides a path to other P projects that must be included as dependencies during compilation.
+ The P compiler simply recursively copies all the P files in the dependency projects (transitively including all P files in dependent projects) and compiles them together.
This feature provides a way to split the P models for a large system into sub projects that can share models.
@@ -142,7 +142,7 @@ There are two ways of compiling a P program:
```shell
p compile -pf PSpec/*.p PSrc/*.p PTst/*.p -pn ClientServer -o PGenerated
```
-
+
??? info "Expected Output"
```
$ p compile -pf PSpec/*.p PSrc/*.p PTst/*.p -pn ClientServer -o PGenerated
@@ -157,14 +157,14 @@ There are two ways of compiling a P program:
Determining projects to restore...
Restored P/Tutorial/1_ClientServer/PGenerated/CSharp/ClientServer.csproj (in 115 ms).
ClientServer -> P/Tutorial/1_ClientServer/PGenerated/CSharp/net6.0/ClientServer.dll
-
+
Build succeeded.
0 Warning(s)
0 Error(s)
-
+
Time Elapsed 00:00:05.74
-
-
+
+
----------------------------------------
~~ [PTool]: Thanks for using P! ~~
```
@@ -187,7 +187,7 @@ p check
!!! info "Expected Output"
```hl_lines="8 9 10"
$ p check
-
+
.. Searching for a P compiled file locally in the current folder
.. Found a P compiled file: P/Tutorial/1_ClientServer/PGenerated/CSharp/net6.0/ClientServer.dll
.. Checking P/Tutorial/1_ClientServer/PGenerated/CSharp/net6.0/ClientServer.dll
@@ -196,7 +196,7 @@ p check
tcSingleClient
tcMultipleClients
tcAbstractServer
-
+
~~ [PTool]: Thanks for using P! ~~
```
diff --git a/Docs/docs/index.md b/Docs/docs/index.md
index 3803e2c06..8ff159133 100644
--- a/Docs/docs/index.md
+++ b/Docs/docs/index.md
@@ -16,11 +16,11 @@
![GitHub Action (CI on Ubuntu)](https://github.com/p-org/P/workflows/CI%20on%20Ubuntu/badge.svg)
![GitHub Action (CI on MacOS)](https://github.com/p-org/P/workflows/CI%20on%20MacOS/badge.svg)
-**Challenge**:
+**Challenge**:
Distributed systems are notoriously hard to get right. Programming these systems is challenging because of the need to reason about correctness in the presence of myriad possible interleaving of messages and failures. Unsurprisingly, it is common for service teams to uncover correctness bugs after deployment. Formal methods can play an important role in addressing this challenge!
-**P Overview:**
+**P Overview:**
P is a state machine based programming language for formally modeling and specifying complex
distributed systems. P allows programmers to model their system design as a collection of
communicating state machines. P supports several backend analysis engines
@@ -50,7 +50,7 @@ In our experience of using P inside AWS, Academia, and Microsoft. We have observ
## Let the fun begin!
You can find most of the information about the P framework on this webpage:
-[what is P?](whatisP.md),
+[what is P?](whatisP.md),
[getting started](getstarted/install.md), [tutorials](tutsoutline.md),
[case studies](casestudies.md) and related [research publications](publications.md). If
you have any further questions, please feel free to create an
@@ -58,7 +58,7 @@ you have any further questions, please feel free to create an
[discussions](https://github.com/p-org/P/discussions), or
[email us](mailto:ankushdesai@gmail.com)
-!!! info "Contributions"
+!!! info "Contributions"
_P has always been a collaborative project between industry and academia (since 2013)
:drum:. The P team welcomes contributions and suggestions from all of you!! :punch:._
diff --git a/Docs/docs/manual/datatypes.md b/Docs/docs/manual/datatypes.md
index 687e08482..7c664697d 100644
--- a/Docs/docs/manual/datatypes.md
+++ b/Docs/docs/manual/datatypes.md
@@ -14,7 +14,7 @@ P Supports the following data types:
Data types in P:
```
- type :
+ type :
| bool # PrimitiveType
| int # PrimitiveType
| float # PrimitiveType
@@ -28,7 +28,7 @@ P Supports the following data types:
| seq[type] # SeqType
| set[type] # SetType
| map[type, type] # MapType
-
+
| data # UniversalType
| any # UniversalType
@@ -38,7 +38,7 @@ P Supports the following data types:
Declaring user defined types and foreign types:
```
- typeDecl :
+ typeDecl :
| type iden ; # ForeignTypeDeclaration
| type iden = type ; # UserDefinedTypeDeclaration
;
@@ -47,7 +47,7 @@ P Supports the following data types:
Declaring enum types:
```
- enumTypeDecl :
+ enumTypeDecl :
| enum iden { enumElemList }
| enum iden { numberedEnumElemList }
;
@@ -57,7 +57,7 @@ P Supports the following data types:
numberedEnumElem : iden = IntLiteral ;
```
-!!! info "Operations on P data types"
+!!! info "Operations on P data types"
Details for the operations that can be performed on
P datatypes are described in the [expressions](expressions.md) and [statements](statements.md).
@@ -102,7 +102,7 @@ to the elements). Enums in P can be coerced to `int`. Please refer to the gramma
=== "Enum Declaration"
- ```
+ ```
enum tResponseStatus { ERROR, SUCCESS, TIMEOUT }
// usage of enums
@@ -116,7 +116,7 @@ to the elements). Enums in P can be coerced to `int`. Please refer to the gramma
=== "Enum Declaration with Values"
- ```
+ ```
enum tResponseStatus { ERROR = 500, SUCCESS = 200,
TIMEOUT = 400; }
@@ -141,7 +141,7 @@ var tupleEx: (int, bool, int);
// constructing a value of tuple type.
tupleEx = (20, false, 21);
-// accessing the first and third element of the tupleEx
+// accessing the first and third element of the tupleEx
tupleEx.0 = tupleEx.0 + tupleEx.2;
```
@@ -155,7 +155,7 @@ var namedTupleEx: (x1: int, x2: bool, x3: int);
// constructing a value of named tuple type.
namedTupleEx = (x1 = 20, x2 = false, x3 = 21);
-// accessing the first and third element of the namedTupleEx
+// accessing the first and third element of the namedTupleEx
namedTupleEx.x1 = namedTupleEx.x1 + namedTupleEx.x3;
```
@@ -170,7 +170,7 @@ namedTupleEx.x1 = namedTupleEx.x1 + namedTupleEx.x3;
P supports three collection types: map, sequence (lists), and set. The operations to mutate the collection types like insert, update, and remove elements are described in the [statements](statements.md) section. One can use the `while` loop to iterate over these collection types. Other operations like `sizeof`, `in` (to check containment), `choose` (pick a value nondeterministically), `keys`, and `values` on these collection types are defined in the [expressions](expressions.md) section.
-**Syntax**:
+**Syntax**:
- `map[K, V]` represents a `map` type with keys of type `K` and values of type `V`.
- `seq[T]` represents a sequence type with elements of type `T`.
@@ -182,7 +182,7 @@ P allows programmers to define (or implement) types in the external languages. W
**Syntax:**: `type tName;`
-`tName` is the name of the foreign type.
+`tName` is the name of the foreign type.
Note that foreign types are disjoint from all other types in P. They are subtype of the `any` type.
Details about how to define/implement foreign types in P is described [here](foriegntypesfunctions.md).
diff --git a/Docs/docs/manual/events.md b/Docs/docs/manual/events.md
index 3629040a9..ab5d01f84 100644
--- a/Docs/docs/manual/events.md
+++ b/Docs/docs/manual/events.md
@@ -4,7 +4,7 @@ An event in P has two parts: an event name and a payload value (optional) that c
??? note "P Event Declaration Grammar"
```
- eventDecl :
+ eventDecl :
| event iden (: type)?; # P Event Declaration
```
@@ -24,7 +24,7 @@ An event in P has two parts: an event name and a payload value (optional) that c
// declaration of events that have payloads
type tRequest = (client: Client, key: string, value: int, requestId: int);
// eRequest event with payload of type tRequest
- event eRequest: tRequest;
+ event eRequest: tRequest;
// eResponse event that can have a payload of type (requestId: int, status: bool)
- event eResponse: (requestId: int, status: bool);
+ event eResponse: (requestId: int, status: bool);
```
diff --git a/Docs/docs/manual/expressions.md b/Docs/docs/manual/expressions.md
index be9e5a584..209858abd 100644
--- a/Docs/docs/manual/expressions.md
+++ b/Docs/docs/manual/expressions.md
@@ -59,7 +59,7 @@ P supports the common imperative programming language expressions (just like in
| iden = rvalue (, iden = rvalue)+
;
- # r-value is an expression that can’t have a value assigned to it which
+ # r-value is an expression that can’t have a value assigned to it which
# means r-value can appear on right but not on left hand side of an assignment operator(=)
rvalue : expr ;
# rvalueList is a comma separated list of rvalue.
@@ -98,7 +98,7 @@ P allows creating formatted strings.
h = "Hello"; w = "World";
tup = ("tup value", 100);
- hw = format("{0} {1}, and {2} is {3}!",
+ hw = format("{0} {1}, and {2} is {3}!",
h, w, tup.0, tup.1);
// hw value is "Hello World, and tup value is 100!"
```
@@ -112,7 +112,7 @@ P allows creating formatted strings.
h = "Hello"; w = "World";
tup = ("tup value", 100);
- print format("{0} {1}, and {2} is {3}!",
+ print format("{0} {1}, and {2} is {3}!",
h, w, tup.0, tup.1);
// prints "Hello World, and tup value is 100!"
```
@@ -125,24 +125,24 @@ A tuple or named tuple value can be created using the following expressions:
``` java
// tuple value of type (int,)
-(10,)
+(10,)
// tuple value of type (string, (string, string))
-("Hello", ("World", "!"))
+("Hello", ("World", "!"))
// assume x: int and y: string
// tuple value of type (int, string)
-(x, y)
+(x, y)
```
**Syntax (named tuple value):**: `(iden = rvalue ,)` for a single field named tuple value or `(iden = rvalue (, iden = rvalue)+)` for named tuple with multiple fields.
``` java
// named tuple value of type (reqId: int,)
-(reqId = 10,)
+(reqId = 10,)
// named tuple value of type (h: string, (w: string, a: string))
-(h = "Hello", (w = "World", a = "!"))
+(h = "Hello", (w = "World", a = "!"))
// assume x: int and y: string
// named tuple value of type (a:int, b:string)
-(a = x, b = y)
+(a = x, b = y)
```
### Access Field of Tuple and Named Tuple
@@ -157,7 +157,7 @@ accessed by using the `.` operation followed by the field index.
var tupleEx: (int, bool, int);
tupleEx = (20, false, 21);
-// accessing the first and third element of the tupleEx
+// accessing the first and third element of the tupleEx
tupleEx.0 = tupleEx.0 + tupleEx.2;
```
@@ -171,7 +171,7 @@ of a named tuple can be accessed by using the `.` operation followed by the fiel
var namedTupleEx: (x1: int, x2: bool, x3: int);
namedTupleEx = (x1 = 20, x2 = false, x3 = 21);
-// accessing the first and third element of the namedTupleEx
+// accessing the first and third element of the namedTupleEx
namedTupleEx.x1 = namedTupleEx.x1 + namedTupleEx.x3;
```
@@ -179,7 +179,7 @@ namedTupleEx.x1 = namedTupleEx.x1 + namedTupleEx.x3;
P supports three collection types: `map`, `seq`, and `set`. We can index into these collection types to access its elements.
-**Syntax:** `expr_c[expr_i]`
+**Syntax:** `expr_c[expr_i]`
If `expr_c` is a value of sequence type then `expr_i` must be an integer expression and `expr_c[expr_i]` represents the element at index `expr_i`. Similarly, If `expr_c` is a value of set type then `expr_i` must be an integer expression and `expr_c[expr_i]` represents the element at index `expr_i` but note that for a set there is no guarantee for the order in which elements are stored in the set.
Finally, if `expr_c` is a value of map type then `expr_i` represents the key to look up and `expr_c[expr_i]` represents the value for the key `expr_i`.
@@ -214,7 +214,7 @@ Primarily, `keys` and `values` are used to get contents of the map and then oper
To check if an element (or key in the case of a map) belongs to a collection, P provides the `in` operation.
-**Syntax:** `expr_e in expr_c`
+**Syntax:** `expr_e in expr_c`
`expr_e` is the element (or key in the case of map) and `expr_c` is the collection value. The `in` expression evaluates to `true` if the element belongs to the collection and `false` otherwise.
@@ -247,7 +247,7 @@ New expression is used to create an instance of a machine, `new` returns a machi
``` java
new Client((id = 1, server = this));
```
- Creates a dynamic instance of a Client machine and passes the constructor parameter `(id = 1, server = this)`
+ Creates a dynamic instance of a Client machine and passes the constructor parameter `(id = 1, server = this)`
which is delivered as a payload to the entry function of the start state of the created Client machine.
### Function Call
@@ -264,7 +264,7 @@ Function calls in P are similar to any other imperative programming languages.
=== "Function call"
``` java
- x = Foo();
+ x = Foo();
y = Bar(10, "haha");
```
diff --git a/Docs/docs/manual/foriegntypesfunctions.md b/Docs/docs/manual/foriegntypesfunctions.md
index 74719d869..305d42577 100644
--- a/Docs/docs/manual/foriegntypesfunctions.md
+++ b/Docs/docs/manual/foriegntypesfunctions.md
@@ -9,7 +9,7 @@
!!! hint "Recommendation: Using Foreign Types and Functions"
Programmers can consider implementing a particular type as Foreign type in P if it's a complicated data structure and implementing them using P types is either not possible or too cumbersome. For example, P does not support declaring recursive data types, and hence, implementing a linked-list or a tree like data-structure in P is hard. Hence, we recommend programmers to implement such types as foreign types.
- When modeling complex systems, many times programmers need to implement complicated logic/functions that manipulate or iterate over data-structures. Such functions can be easily implemented in foreign languages like Java and C# as compared to P. For example, sorting a list is easier in Java and C# through standard library functions and verbose in P. Also, functions that manipulate foreign types are implemented as foreign functions.
+ When modeling complex systems, many times programmers need to implement complicated logic/functions that manipulate or iterate over data-structures. Such functions can be easily implemented in foreign languages like Java and C# as compared to P. For example, sorting a list is easier in Java and C# through standard library functions and verbose in P. Also, functions that manipulate foreign types are implemented as foreign functions.
The [Two Phase Commit](../tutorial/twophasecommit.md) example had introduced the foreign function feature. We will now use a simple PriorityQueue example to go into the details of foreign interface in P.
@@ -76,14 +76,14 @@ p compile
Determining projects to restore...
Restored P/Tutorial/PriorityQueue/PGenerated/CSharp/PriorityQueue.csproj (in 392 ms).
PriorityQueue -> P/Tutorial/PriorityQueue/PGenerated/CSharp/net6.0/PriorityQueue.dll
-
+
Build succeeded.
0 Warning(s)
0 Error(s)
-
+
Time Elapsed 00:00:04.08
-
-
+
+
----------------------------------------
[PTool]: Thanks for using P!
```
diff --git a/Docs/docs/manual/functions.md b/Docs/docs/manual/functions.md
index 6d6e39fb1..f73feafec 100644
--- a/Docs/docs/manual/functions.md
+++ b/Docs/docs/manual/functions.md
@@ -1,8 +1,8 @@
-There are two types of functions in P: (1) anonymous functions, and (2) named functions.
+There are two types of functions in P: (1) anonymous functions, and (2) named functions.
-- **Anonymous functions** are unnamed functions that can appear as an entry functions or exit functions or as event-handlers.
+- **Anonymous functions** are unnamed functions that can appear as an entry functions or exit functions or as event-handlers.
- **Named functions** can either be declared inside a state machine or globally as a top-level declaration. The named functions declared within a state machine are local to that machine and hence can access the local-variables of the machine. Global named functions are shared across state machines. Note that the purpose of having named functions is to enable code reuse. Named functions can be also be used as entry/exit functions and also as event handlers.
-
+
Please look at [P state machine](manual/../statemachines.md) for more details about the declaration of these functions.
??? note "P Functions Grammar"
@@ -10,7 +10,7 @@ Please look at [P state machine](manual/../statemachines.md) for more details ab
```
anonFunction : (funParam?) functionBody # AnonymousFunDecl
- funDecl :
+ funDecl :
| fun name (funParamList?) (: returnType)? ; # ForeignFunDecl
| fun name (funParamList?) (: returnType)? functionBody # FunDecl
;
@@ -56,5 +56,5 @@ Function body in P is similar to other programming languages with a restriction
Declaration of local variables in a function must come before any other statement in the function body. So, the body of a function in P is a sequence of variable declarations followed by a sequence of [statements](statements.md).
```
-functionBody : { varDecl* statement* }
+functionBody : { varDecl* statement* }
```
diff --git a/Docs/docs/manual/modulesystem.md b/Docs/docs/manual/modulesystem.md
index 58237e483..1c57baf0c 100644
--- a/Docs/docs/manual/modulesystem.md
+++ b/Docs/docs/manual/modulesystem.md
@@ -79,7 +79,7 @@ P supports unioning multiple modules together to create larger, more complex mod
`module system = (union client, server);`
-`system` is a module which is a union of the modules `client` and `server`.
+`system` is a module which is a union of the modules `client` and `server`.
`module systemAbs = (union client, serverAbs);`
@@ -87,7 +87,7 @@ P supports unioning multiple modules together to create larger, more complex mod
### Assert Monitors Module
-P allows attaching monitors (or specifications) to modules. When attaching monitors to a module, the events observed by the monitors must be sent by `some` machine in the module.
+P allows attaching monitors (or specifications) to modules. When attaching monitors to a module, the events observed by the monitors must be sent by `some` machine in the module.
!!! info ""
The way to think about assert monitors module is that: `attaching these monitors to the module asserts (during P checker exploration) that each execution of the module satisfies the global properties specified by the monitors._
diff --git a/Docs/docs/manual/monitors.md b/Docs/docs/manual/monitors.md
index 5b5dd3677..ac36edb82 100644
--- a/Docs/docs/manual/monitors.md
+++ b/Docs/docs/manual/monitors.md
@@ -1,4 +1,4 @@
-Programmers can write safety and liveness specifications in P as monitors or `spec` machines.
+Programmers can write safety and liveness specifications in P as monitors or `spec` machines.
`spec` machines are monitor state machines or observer state machines that observe a set of events during the execution of the system and
assert the desired correctness specifications based on these observations.
@@ -51,7 +51,7 @@ The above specification checks a very simple global invariant that all `eRequest
``` kotlin linenums="1" hl_lines="13"
/**************************************************************************
-GuaranteedProgress observes the eRequest and eResponse events,
+GuaranteedProgress observes the eRequest and eResponse events,
it asserts that every request is always responded by a successful response.
***************************************************************************/
spec GuaranteedProgress observes eRequest, eResponse {
@@ -64,7 +64,7 @@ spec GuaranteedProgress observes eRequest, eResponse {
}
hot state PendingReqs {
on eResponse do (resp: tResponse) {
- assert resp.rId in pendingReqs,
+ assert resp.rId in pendingReqs,
format ("unexpected rId: {0} received, expected one of {1}", resp.rId, pendingReqs);
if(resp.status == SUCCESS)
{
diff --git a/Docs/docs/manual/statemachines.md b/Docs/docs/manual/statemachines.md
index 6b8153514..dee578d28 100644
--- a/Docs/docs/manual/statemachines.md
+++ b/Docs/docs/manual/statemachines.md
@@ -1,6 +1,6 @@
A P program is a collection of concurrently executing state machines that communicate with each other by sending events (or messages) asynchronously.
-!!! info "P State Machine Semantics"
+!!! info "P State Machine Semantics"
The underlying model of computation is similar to that of [Gul Agha's](http://osl.cs.illinois.edu/members/agha.html) [Actor-model-of-computation](https://dspace.mit.edu/handle/1721.1/6952) ([wiki](https://en.wikipedia.org/wiki/Actor_model)). Here is a summary of important semantic details:
- Each P state machine has an **unbounded FIFO buffer** associated with it.
@@ -20,14 +20,14 @@ A P program is a collection of concurrently executing state machines that commun
# State Machine Body
machineBody : LBRACE machineEntry* RBRACE;
- machineEntry
+ machineEntry
| varDecl
| funDecl
| stateDecl
;
# Variable Decl
- varDecl : var iden : type ;
+ varDecl : var iden : type ;
# State Declaration in P
stateDecl : start? (hot | cold)? state name { stateBody* }
@@ -77,7 +77,7 @@ The entry function gets executed when a machine enters that state. If the corres
=== "Entry function"
- ``` kotlin
+ ``` kotlin
entry {
print format ("Entering state");
}
@@ -100,7 +100,7 @@ The exit function gets executed when a machine exits that state to transition to
=== "Exit function"
- ``` kotlin
+ ``` kotlin
exit {
print format ("Exiting state");
}
@@ -115,7 +115,7 @@ An event handler defined for event `E` in state `S` describes what statements ar
=== "Event handler"
- ``` kotlin
+ ``` kotlin
on eWarmUpReq do {
send controller, eWarmUpCompleted;
}
@@ -123,7 +123,7 @@ An event handler defined for event `E` in state `S` describes what statements ar
=== "Event handler with input parameters"
- ``` kotlin
+ ``` kotlin
on eWithDrawReq do (req: tWithDrawReq) {
assert req.accountId in bankBalance,
format ("Unknown accountId {0} in the withdraw request. Valid accountIds = {1}",
@@ -139,20 +139,20 @@ An event handler can be further combined with a [Goto](statements.md#goto) state
=== "Event handler with goto only"
- ``` kotlin
+ ``` kotlin
on eWarmUpCompleted goto CoffeeMakerReady;
```
=== "Event handler with goto"
- ``` kotlin
+ ``` kotlin
on eTimeOut goto WaitForTransactions with { DoGlobalAbort(TIMEOUT); }
```
=== "Event handler with goto and input parameters"
- ``` kotlin
+ ``` kotlin
on eSpec_BankBalanceIsAlwaysCorrect_Init goto WaitForWithDrawReqAndResp with (balance: map[int, int]) {
bankBalance = balance;
}
diff --git a/Docs/docs/manual/statements.md b/Docs/docs/manual/statements.md
index 75d68b46d..fd16eb050 100644
--- a/Docs/docs/manual/statements.md
+++ b/Docs/docs/manual/statements.md
@@ -32,29 +32,29 @@ P supports common imperative programming language statement constructs like whil
| lvalue [ expr ] # CollectionLookUp
;
- /* A r-value is an expression that can’t have a value assigned to it which
+ /* A r-value is an expression that can’t have a value assigned to it which
means r-value can appear on right but not on left hand side of an assignment operator(=)*/
rvalue : expr ;
# rvalueList is a comma separated list of rvalue.
-
+
/* case block inside a receive statement */
recvCase : case eventList : anonFunction
```
-
- The `expr` is any expression in P defined by the grammar desbribed in [P Expressions](expressions.md)
+
+ The `expr` is any expression in P defined by the grammar desbribed in [P Expressions](expressions.md)
### Assert
-P allows writing local assertions using the `assert` statement.
+P allows writing local assertions using the `assert` statement.
If the program violates the assertion then a counter example is generated by the P checker.
**Syntax**: ```assert expr (, expr)? ;```
-The assert statement must have a `boolean` expression followed by an optional `string` message that is printed in the error trace.
+The assert statement must have a `boolean` expression followed by an optional `string` message that is printed in the error trace.
=== "Assert"
- ``` kotlin
+ ``` kotlin
assert (requestId > 1) && (requestId in allRequestsSet);
```
@@ -70,12 +70,12 @@ The assert statement must have a `boolean` expression followed by an optional `s
=== "Assert with Formatted Error Message"
- ``` kotlin
+ ``` kotlin
assert (requestId in allRequestsSet),
format ("requestId {0} is not in the requests set = {1}", requestId, allRequestsSet);
```
- Assert that the `requestId` is in the set of all requests.
+ Assert that the `requestId` is in the set of all requests.
You can also provide a formatted string error message to add details to the error message generated.
### Print
@@ -116,10 +116,10 @@ While statement in P is just like while loops in other popular programming langu
``` kotlin
i = 0;
while (i < 10)
- {
+ {
...
i = i + 1;
- }
+ }
```
=== "While loop iterating over collection"
@@ -127,7 +127,7 @@ While statement in P is just like while loops in other popular programming langu
``` kotlin
i = 0;
while (i < sizeof(s))
- {
+ {
...
print s[i];
i = i + 1;
@@ -154,7 +154,7 @@ Note that variable `iden` must already be declared, and in each iteration, an el
foreach(iter in ints)
{
sum = sum + iter;
- }
+ }
```
=== "Foreach (mutating collection)"
@@ -182,7 +182,7 @@ Note that variable `iden` must already be declared, and in each iteration, an el
// iterate over a set of integers
foreach(key in keys(intsM))
{
- intsM[key] = intsM[key] + delta;
+ intsM[key] = intsM[key] + delta;
}
```
One can iterate over the map using [`keys` and `values` functions](expressions.md#keys-and-values).
@@ -200,28 +200,28 @@ IfThenElse statement in P is just like conditional if statements in other popula
=== "If Statement"
``` kotlin
- if(x > 10) {
+ if(x > 10) {
...
- x = x + 20;
- }
+ x = x + 20;
+ }
```
=== "If Else Statement"
``` kotlin
- if(x > 10)
- {
- x = 0;
+ if(x > 10)
+ {
+ x = 0;
}
else
- {
- x = x + 1;
+ {
+ x = x + 1;
}
```
### Break and Continue
-`break` and `continue` statements in P are just like in other popular programming languages like C, C# or Java
+`break` and `continue` statements in P are just like in other popular programming languages like C, C# or Java
to break out of the while loop or to continue to the next iteration of the loop respectively.
=== "Break"
@@ -233,7 +233,7 @@ to break out of the while loop or to continue to the next iteration of the loop
break;
...
x = x + 1;
- }
+ }
```
=== "Continue"
@@ -308,7 +308,7 @@ Insert statement is used to insert or add an element into a collection.
**Syntax**: `lvalue += ( expr, rvalue ) ;` or `lvalue += ( rvalue ) ;`
-`lvalue` is a value of any collection type in P.
+`lvalue` is a value of any collection type in P.
=== "Insert into a Sequence"
@@ -321,7 +321,7 @@ Insert statement is used to insert or add an element into a collection.
```
!!! warning "Index for a sequence"
- The value of index `i` above should be between `0 <= i <= sizeof(sq)`.
+ The value of index `i` above should be between `0 <= i <= sizeof(sq)`.
`i = 0` inserts x at the start of `sq` and `i = sizeof(sq)` appends x at the end of `sq`
=== "Insert into a map or update map"
@@ -396,7 +396,7 @@ New statement is used to create an instance of a machine in P.
``` java
new Client((id = 1, server = this));
```
- Creates a dynamic instance of a Client machine and passes the constructor parameter `(id = 1, server = this)`
+ Creates a dynamic instance of a Client machine and passes the constructor parameter `(id = 1, server = this)`
which is delivered as a payload to the entry function of the start state of the created Client machine.
### Function Call
@@ -429,14 +429,14 @@ an exception which terminates the execution of the function stack and must be im
state HandleRequest {
entry (req: tRequest)
{
- // ohh, this is a Add request and I have a event handler for it
+ // ohh, this is a Add request and I have a event handler for it
if(req.type == "Add")
raise eAddOperation, req.Transaction; // terminates function
.....
.....
assert req.type != "Add"; // valid
}
-
+
on eAddOperation do (trans: tTransaction) { ... }
}
```
@@ -447,8 +447,8 @@ an exception which terminates the execution of the function stack and must be im
state DoAddOrRemove {
entry
{
- /* I am uncertain, at this point I may want to trigger
- a Add or Substract event-handler without sending an event
+ /* I am uncertain, at this point I may want to trigger
+ a Add or Substract event-handler without sending an event
to self which will be enqueued and then dequeued in FIFO order
I want to immediately execute this handlers before anything else */
if($)
@@ -458,7 +458,7 @@ an exception which terminates the execution of the function stack and must be im
assert false; // valid, as this is unreachable
}
-
+
on eAddOperation do (trans: tTransaction) { ... }
on eRemoveOperation do (trans: tTransaction) { ... }
}
@@ -499,9 +499,9 @@ The [Two phase commit](../tutorial/twophasecommit.md) example provides an use ca
**Syntax**: `annouce expr (, rvalue)? ;`
=== "Announce event"
-
+
``` kotlin
- spec CheckConvergedState observes eStateUpdate, eSystemConverged
+ spec CheckConvergedState observes eStateUpdate, eSystemConverged
{ ... }
```
Consider a specification monitor that continuously observes `eStateUpdate` event to keep track of the system state
@@ -509,7 +509,7 @@ The [Two phase commit](../tutorial/twophasecommit.md) example provides an use ca
We can use an announce statement to inform the monitor when the system has converged and we should to assert the global specification.
```
- announce eSystemConverged, payload;
+ announce eSystemConverged, payload;
```
!!! note
@@ -531,7 +531,7 @@ The optional payload accompanying the goto statement becomes the input parameter
if(sizeof(pendingRequests) == 0)
goto Done;
- // process requests
+ // process requests
....
}
}
@@ -565,8 +565,8 @@ receive { recvCase+ }
recvCase : case eventList : anonFunction
```
-Each `receive` statement can block or wait on a set of events, all other events are automatically deferred by the state machine.
-On receiving an event that the `receive` is blocking on (case blocks), the state machine unblocks, executes the corresponding case-handler
+Each `receive` statement can block or wait on a set of events, all other events are automatically deferred by the state machine.
+On receiving an event that the `receive` is blocking on (case blocks), the state machine unblocks, executes the corresponding case-handler
and resumes executing the next statement after receive.
=== "Receive: await single event"
@@ -581,8 +581,8 @@ and resumes executing the next statement after receive.
print "Lock Acquired!"
}
```
- Note that when executing the AcquireLock function the state machine blocks at the receive statement,
- it automatically defers all the events except the `eLockGranted` event. On receiving the `eLockGranted`,
+ Note that when executing the AcquireLock function the state machine blocks at the receive statement,
+ it automatically defers all the events except the `eLockGranted` event. On receiving the `eLockGranted`,
the case-handler is executed and then the print statement.
=== "Receive: await multiple events"
diff --git a/Docs/docs/manual/testcases.md b/Docs/docs/manual/testcases.md
index d739b29de..062046146 100644
--- a/Docs/docs/manual/testcases.md
+++ b/Docs/docs/manual/testcases.md
@@ -19,5 +19,5 @@ P allows programmers to write different scenarios under which we would like to c
!!! info "Properties checked for a Test Case"
- For each testcase, the P checker by default asserts that for each execution of the system (i.e., `module_under_test`): (1) there are no `unhandled event` exceptions; (2) all local assertions in the program hold; (3) there are no deadlocks; and finally (4) based on the [specification monitors that are attached](modulesystem.md#assert-monitors-module) to the module, these safety and liveness properties asserted by the monitors always hold.
+ For each testcase, the P checker by default asserts that for each execution of the system (i.e., `module_under_test`): (1) there are no `unhandled event` exceptions; (2) all local assertions in the program hold; (3) there are no deadlocks; and finally (4) based on the [specification monitors that are attached](modulesystem.md#assert-monitors-module) to the module, these safety and liveness properties asserted by the monitors always hold.
diff --git a/Docs/docs/manualoutline.md b/Docs/docs/manualoutline.md
index f36b188d2..4aa82e8ec 100644
--- a/Docs/docs/manualoutline.md
+++ b/Docs/docs/manualoutline.md
@@ -1,4 +1,4 @@
-!!! tip ""
+!!! tip ""
**We recommend that you start with the [Tutorials](tutsoutline.md) to get familiar with
the P language and its tool chain.**
@@ -30,7 +30,7 @@ A P program consists of a collection of following top-level declarations:
| [Module System](manual/modulesystem.md) | P supports a module system for implementing and testing the system modularly by dividing it into separate components |
| [Test Cases](manual/testcases.md) | P test cases help programmers to write different finite scenarios under which they would like to check the correctness of their system |
-!!! Tip "Models, Specifications, Model Checking Scenario"
+!!! Tip "Models, Specifications, Model Checking Scenario"
A quick primer on what a model
is, versus a specification, and model checking scenarios: (1) A specification says what
the system should do (correctness properties). (2) A model captures the details of how the
diff --git a/Docs/docs/old/advanced/debuggingerror.md b/Docs/docs/old/advanced/debuggingerror.md
index d36fd0f73..982574c9b 100644
--- a/Docs/docs/old/advanced/debuggingerror.md
+++ b/Docs/docs/old/advanced/debuggingerror.md
@@ -43,7 +43,7 @@ trace and single step through the P program with the generated error trace for d
The `*.txt` file contains a textual error trace representing the sequence of steps (i.e, messages sent, messages received, machines created) from the initial state to the final error state. In the end of the error trace is the final error message, for example, in the case of ClientServer example above, you must see the following in the end of the error trace.
``` xml
- Assertion Failed: Bank must accept the with draw request for 1,
+ Assertion Failed: Bank must accept the with draw request for 1,
bank balance is 11!
```
@@ -66,7 +66,7 @@ For debugging the error trace, you must open the generated `csproj` file (its ge
```c# hl_lines="7 9" linenums="1"
public class _TestRegression {
public static void Main(string[] args)
- {
+ {
Configuration configuration = Configuration.Create();
configuration.WithVerbosityEnabled(true);
// update the path to the schedule file.
@@ -79,7 +79,7 @@ public class _TestRegression {
{
Console.WriteLine(bug);
}
-
+
}
}
```
@@ -102,11 +102,11 @@ String.Format("Bank must accept the with draw request for {0}, bank balance is {
One can also replay the error schedule using commandline and enabling verbose feature to dump out the error trace on the commandline.
```
-pmc .dll --schedule .schedule -m -v
+pmc .dll --schedule .schedule -m -v
```
For example,
```
-pmc ClientServer.dll --schedule ClientServer_0_0.schedule -m PImplementation.tcSingleClientAbstractServer.Execute -v
+pmc ClientServer.dll --schedule ClientServer_0_0.schedule -m PImplementation.tcSingleClientAbstractServer.Execute -v
```
diff --git a/Docs/docs/old/getstarted/install.md b/Docs/docs/old/getstarted/install.md
index 59fa39378..4907f1dbb 100644
--- a/Docs/docs/old/getstarted/install.md
+++ b/Docs/docs/old/getstarted/install.md
@@ -17,12 +17,12 @@ To install .Net Core 3.1 SDK use:
brew tap isen-ng/dotnet-sdk-versions
brew install --cask dotnet-sdk3-1-400
```
- Dont have Homebrew? :upside_down_face: Install directly using the [installer](https://dotnet.microsoft.com/download/dotnet/thank-you/sdk-3.1.412-macos-x64-installer).
+ Dont have Homebrew? :upside_down_face: Install directly using the [installer](https://dotnet.microsoft.com/download/dotnet/thank-you/sdk-3.1.412-macos-x64-installer).
=== "Ubuntu"
Installing .Net SDK on Ubuntu ([details](https://docs.microsoft.com/en-us/dotnet/core/install/linux-ubuntu))
-
+
```
wget https://packages.microsoft.com/config/ubuntu/21.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
@@ -69,12 +69,12 @@ To install Java use:
```
brew install java
```
- Dont have Homebrew? Directly use [installer](https://www.java.com/en/download/help/mac_install.html).
+ Dont have Homebrew? Directly use [installer](https://www.java.com/en/download/help/mac_install.html).
=== "Ubuntu"
Installing Java on Ubuntu ([details](https://ubuntu.com/tutorials/install-jre#2-installing-openjdk-jre))
-
+
```
sudo apt install default-jre
```
@@ -143,7 +143,7 @@ We highly recommend that you create the following alias as we use it in the rest
=== "On MacOS or Linux"
- Add following alias to the bash profile (`~/.bash_profile` or the equivalent on your system)
+ Add following alias to the bash profile (`~/.bash_profile` or the equivalent on your system)
so that you can invoke the P checker (`pmc`) directly.
```shell
alias pmc='coyote test'
@@ -151,7 +151,7 @@ We highly recommend that you create the following alias as we use it in the rest
=== "On Windows"
- We recommend that you add the following to the `Microsoft.PowerShell_profile`
+ We recommend that you add the following to the `Microsoft.PowerShell_profile`
normally found in `D:\Users\\Documents\WindowsPowerShell`
```shell
diff --git a/Docs/docs/old/getstarted/usingP.md b/Docs/docs/old/getstarted/usingP.md
index 53b826b94..8a0b888bc 100644
--- a/Docs/docs/old/getstarted/usingP.md
+++ b/Docs/docs/old/getstarted/usingP.md
@@ -1,6 +1,6 @@
# Using P Compiler and Checker
-!!! check ""
+!!! check ""
Before moving forward, we assume that you have successfully installed the
[P Compiler and Checker](install.md#step-3-install-p-compiler).
@@ -10,12 +10,12 @@ section, we provide an overview of the steps involved in compiling and testing a
using the [client server](../../tutorial/clientserver.md) example in Tutorials.
-??? info "Get the Client Server Example Locally"
+??? info "Get the Client Server Example Locally"
We will use the [ClientServer](https://github.com/p-org/P/tree/master/Tutorial/1_ClientServer) example from Tutorial folder in P repository to describe the process of compiling and testing a P program. Please clone the P repo and navigate to the
ClientServer example in Tutorial.
Clone P Repo locally:
- ```shell
+ ```shell
git clone https://github.com/p-org/P.git
```
Navigate to the ClientServer examples folder:
@@ -32,23 +32,23 @@ There are two ways of compiling a P program:
1. Using a **P project file** (`*.pproj`) to provides all the required inputs to the compiler or
2. Passing all the P files (`*.p`) along with other options (e.g., `-generate`) **as commandline arguments** to the compiler.
-!!! tip "Recommendation"
+!!! tip "Recommendation"
We recommend using the P project files to compile a P program.
??? help "P Compiler commandline options:"
The P compiler provides the following commandline options:
```shell
- ------------------------------------------
- Recommended usage:
-
+ ------------------------------------------
+ Recommended usage:
+
>> pc -proj:<.pproj file>
-
- ------------------------------------------
- Optional usage:
-
+
+ ------------------------------------------
+ Optional usage:
+
>> pc file1.p [file2.p ...][options]
-
+
options:
-t:[target project name] -- project name (as well as the generated file) if not supplied, use file1
-outputDir:[path] -- where to write the generated files
@@ -68,7 +68,7 @@ There are two ways of compiling a P program:
``` shell
pc -proj:ClientServer.pproj
```
-
+
??? info "Expected Output"
```
$ pc -proj:ClientServer.pproj
@@ -118,12 +118,12 @@ There are two ways of compiling a P program:
./PGenerated/
```
- The `` block provides all the P files that must be compiled together for this project.
+ The `` block provides all the P files that must be compiled together for this project.
In `` one can either specify the path to a P file or to a folder and the P compiler includes all the `*.p` files in the folder during compilation.
The `` block provides the name for the project which is used as the output file name for the generated code.
The `` block provides the output directory for the generated code.
- Finally, the `` block provides a path to other P projects that must be included as dependencies during compilation.
- The P compiler simply recursively copies all the P files in the dependency projects (transitively including all P files in dependent projects) and compiles them together.
+ Finally, the `` block provides a path to other P projects that must be included as dependencies during compilation.
+ The P compiler simply recursively copies all the P files in the dependency projects (transitively including all P files in dependent projects) and compiles them together.
This feature provides a way to split the P models for a large system into sub projects that can share models.
=== "Compile P files directly"
@@ -133,9 +133,9 @@ There are two ways of compiling a P program:
pc PSpec/*.p PSrc/*.p PTst/*.p \
-generate:csharp -outputDir:PGenerated -target:ClientServer
```
-
+
??? info "Expected Output"
-
+
```
----------------------------------------
....... includes p file: P/Tutorial/1_ClientServer/PSpec/BankBalanceCorrect.p
@@ -187,7 +187,7 @@ Expected Output:
```shell hl_lines="5 6 7"
pmc /ClientServer.dll
-Provide /method or -m flag to qualify the test method name you wish to use.
+Provide /method or -m flag to qualify the test method name you wish to use.
Possible options are::
PImplementation.tcSingleClient.Execute
PImplementation.tcMultipleClients.Execute
diff --git a/Docs/docs/tutorial/clientserver.md b/Docs/docs/tutorial/clientserver.md
index d684a0b55..35c3c3ba0 100644
--- a/Docs/docs/tutorial/clientserver.md
+++ b/Docs/docs/tutorial/clientserver.md
@@ -1,7 +1,7 @@
??? note "How to use this example"
We assume that you have cloned the P repository locally.
- ```shell
+ ```shell
git clone https://github.com/p-org/P.git
```
@@ -24,10 +24,10 @@ The [1_ClientServer](https://github.com/p-org/P/tree/master/Tutorial/1_ClientSer
### Models
-The P models ([PSrc](https://github.com/p-org/P/tree/master/Tutorial/1_ClientServer/PSrc)) for the ClientServer example consist of four files:
+The P models ([PSrc](https://github.com/p-org/P/tree/master/Tutorial/1_ClientServer/PSrc)) for the ClientServer example consist of four files:
- [Client.p](https://github.com/p-org/P/blob/master/Tutorial/1_ClientServer/PSrc/Client.p): Implements the Client state machine.
-
+
??? tip "[Expand]: Let's walk through Client.p"
- ([L19 - L22](https://github.com/p-org/P/blob/master/Tutorial/1_ClientServer/PSrc/Client.p#L19-L22)) → Events `eWithDrawReq` and `eWithDrawResp` are used to communicate between the `Client` and the `Server` machines (manual: [event declaration](../manual/events.md)).
- ([L3 - L17](https://github.com/p-org/P/blob/master/Tutorial/1_ClientServer/PSrc/Client.p#L3-L17)) → Declares the payload types for the `eWithDrawReq` and `eWithDrawResp` events (manual: [user defined type](../manual/datatypes.md#user-defined)).
@@ -38,7 +38,7 @@ The P models ([PSrc](https://github.com/p-org/P/tree/master/Tutorial/1_ClientSer
- [Server.p](https://github.com/p-org/P/blob/master/Tutorial/1_ClientServer/PSrc/Server.p): Implements the BankServer and the backend Database state machines.
-
+
??? tip "[Expand]: Let's walk through Server.p"
- ([L1 - L7](https://github.com/p-org/P/blob/master/Tutorial/1_ClientServer/PSrc/Server.p#L1-L7)) → Declares the events used to communicate between the bank server and the backend database.
- ([L9 - L48](https://github.com/p-org/P/blob/master/Tutorial/1_ClientServer/PSrc/Server.p#L9-L48)) → Declares the `BankServer` machine. The BankServer machine uses a database machine as a service to store the bank balance for all its clients.
@@ -60,7 +60,7 @@ The P models ([PSrc](https://github.com/p-org/P/tree/master/Tutorial/1_ClientSer
- [ClientServerModules.p](https://github.com/p-org/P/blob/master/Tutorial/1_ClientServer/PSrc/ClientServerModules.p): Declares the P modules corresponding to each component in the system.
??? tip "[Expand]: Let's walk through ClientServerModules.p"
- - ([L1 - L5](https://github.com/p-org/P/blob/master/Tutorial/1_ClientServer/PSrc/ClientServerModules.p#L1-L5)) → Declares the `Client` and `Bank` modules. A module in P is a collection of state machines that together implement that module or component. A system model in P is then a composition or union of modules. The `Client` module consists of a single machine `Client` and the `Bank` module is implemented by machines `BankServer` and `Database` together (manual: [P module system](../manual/modulesystem.md)).
+ - ([L1 - L5](https://github.com/p-org/P/blob/master/Tutorial/1_ClientServer/PSrc/ClientServerModules.p#L1-L5)) → Declares the `Client` and `Bank` modules. A module in P is a collection of state machines that together implement that module or component. A system model in P is then a composition or union of modules. The `Client` module consists of a single machine `Client` and the `Bank` module is implemented by machines `BankServer` and `Database` together (manual: [P module system](../manual/modulesystem.md)).
- ([L7 - L8](https://github.com/p-org/P/blob/master/Tutorial/1_ClientServer/PSrc/ClientServerModules.p#L7-L8)) → The `AbstractBank` module uses the `binding` feature in P modules to bind the `BankServer` machine to the `AbstractBankServer` machine. Basically, what this implies is that whenever `AbstractBank` module is used the creation of the `BankServer` machine will result in creation of `AbstractBankServer`, replacing the implementation with its abstraction (manual: [primitive modules](../manual/modulesystem.md#primitive-module)).
### Specifications
@@ -87,7 +87,7 @@ The test scenarios folder for ClientServer ([PTst](https://github.com/p-org/P/tr
??? tip "[Expand]: Let's walk through TestDriver.p"
- ([L36 - L60](https://github.com/p-org/P/blob/master/Tutorial/1_ClientServer/PTst/TestDriver.p#L36-L60)) → Function `SetupClientServerSystem` takes as input the number of clients to be created and configures the ClientServer system by creating the `Client` and `BankServer` machines. The [`CreateRandomInitialAccounts`](https://github.com/p-org/P/blob/master/Tutorial/1_ClientServer/PTst/TestDriver.p#L25-L34) function uses the [`choose`](../manual/expressions.md#choose) primitive to randomly initialize the accounts map.
- The function also [`announce` the event](https://github.com/p-org/P/blob/master/Tutorial/1_ClientServer/PTst/TestDriver.p#L49-L51) `eSpec_BankBalanceIsAlwaysCorrect_Init` to initialize the monitors with initial balance for all accounts (manual: [annouce statement](../manual/statements.md#announce)).
+ The function also [`announce` the event](https://github.com/p-org/P/blob/master/Tutorial/1_ClientServer/PTst/TestDriver.p#L49-L51) `eSpec_BankBalanceIsAlwaysCorrect_Init` to initialize the monitors with initial balance for all accounts (manual: [annouce statement](../manual/statements.md#announce)).
- ([L3 - L22](https://github.com/p-org/P/blob/master/Tutorial/1_ClientServer/PTst/TestDriver.p#L3-L22)) → Machines `TestWithSingleClient` and `TestWithMultipleClients` are simple test driver machines that configure the system to be checked by the P checker for different scenarios. In this case, test the ClientServer system by first randomly initializing the accounts map and then checking it with either one `Client` or with multiple `Client`s (between 2 and 4)).
??? tip "[Expand]: Let's walk through TestScript.p"
@@ -130,14 +130,14 @@ p compile
Determining projects to restore...
Restored P/Tutorial/1_ClientServer/PGenerated/CSharp/ClientServer.csproj (in 102 ms).
ClientServer -> P/Tutorial/1_ClientServer/PGenerated/CSharp/net6.0/ClientServer.dll
-
+
Build succeeded.
0 Warning(s)
0 Error(s)
-
+
Time Elapsed 00:00:02.25
-
-
+
+
----------------------------------------
~~ [PTool]: Thanks for using P! ~~
```
@@ -163,7 +163,7 @@ p check
tcSingleClient
tcMultipleClients
tcAbstractServer
-
+
~~ [PTool]: Thanks for using P! ~~
```
diff --git a/Docs/docs/tutorial/common.md b/Docs/docs/tutorial/common.md
index bbbca48fa..4b0498a9f 100644
--- a/Docs/docs/tutorial/common.md
+++ b/Docs/docs/tutorial/common.md
@@ -1,3 +1,3 @@
-We also describe how to model system's interaction with an OS Timer [Timer](https://github.com/p-org/P/blob/master/Tutorial/Common/Timer/), and how to model injecting node failures in the system [Failure Injector](https://github.com/p-org/P/tree/master/Tutorial/Common/FailureInjector). These models are used in the Two Phase Commit, Espresso Machine, and Failure Detector models.
+We also describe how to model system's interaction with an OS Timer [Timer](https://github.com/p-org/P/blob/master/Tutorial/Common/Timer/), and how to model injecting node failures in the system [Failure Injector](https://github.com/p-org/P/tree/master/Tutorial/Common/FailureInjector). These models are used in the Two Phase Commit, Espresso Machine, and Failure Detector models.
P is a purely messaging passing based programming language and hence does not support primitives for modeling shared memory based concurrency. But one can always model shared memory concurrency using message passing. We have used this style of modeling when checking the correctness of single node file systems. Please check out [shared memory project](https://github.com/p-org/P/tree/master/Tutorial/Common/SharedMemory) on how to model shared memory concurrency using P.
diff --git a/Docs/docs/tutorial/espressomachine.md b/Docs/docs/tutorial/espressomachine.md
index a0b2ecc13..4e3a38fe9 100644
--- a/Docs/docs/tutorial/espressomachine.md
+++ b/Docs/docs/tutorial/espressomachine.md
@@ -1,7 +1,7 @@
??? note "How to use this example"
We assume that you have cloned the P repository locally.
- ```shell
+ ```shell
git clone https://github.com/p-org/P.git
```
@@ -31,14 +31,14 @@ The [3_EspressoMachine](https://github.com/p-org/P/tree/master/Tutorial/3_Espres
The P models ([PSrc](https://github.com/p-org/P/tree/master/Tutorial/3_EspressoMachine/PSrc)) for the EspressoMachine example consist of three files:
- [CoffeeMakerControlPanel.p](https://github.com/p-org/P/blob/master/Tutorial/3_EspressoMachine/PSrc/CoffeeMakerControlPanel.p): Implements the CoffeeMakerControlPanel state machine. Basically, the control panel starts in the initial state and kicks off by warming up the coffee maker. After warming is successful, it moves to the ready state where it can either make coffee or start the steamer. When asked to make coffee, it first grinds the beans and then brews coffee. In any of these states, if there is an error due to. e.g, no water or no beans, the control panel informs the user of the error and moves to the error state waiting for the user to reset the machine.
-
+
??? tip "[Expand]: Let's walk through CoffeeMakerControlPanel.p"
- ([L2 - L19](https://github.com/p-org/P/blob/master/Tutorial/3_EspressoMachine/PSrc/CoffeeMakerControlPanel.p#L2-L19)) → Declare events that are used to communicate between the `User` and the `ControlPanel` machines (manual: [event declaration](../manual/events.md)). These are events that represent the operations performed by the user, e.g., resetting the machine, pressing the steamer button on and off, etc.
- ([L34 - L231](https://github.com/p-org/P/blob/master/Tutorial/3_EspressoMachine/PSrc/CoffeeMakerControlPanel.p#L34-L231)) → Declares the `CoffeeMakerControlPanel` state machine. The interesting points that we would like to highlight are: (1) the state machine transitions from one mode (or state) to another based on the events received from the user and the `CoffeeMaker` machine; (2) in all the states, the state machine appropriately handles different events that can be received, including ignoring or deferring them if they are stale events.
- [CoffeeMaker.p](https://github.com/p-org/P/blob/master/Tutorial/3_EspressoMachine/PSrc/CoffeeMaker.p): Implements the CoffeeMaker state machine.
-
+
??? tip "[Expand]: Let's walk through CoffeeMaker.p"
- ([L4 - L29](https://github.com/p-org/P/blob/master/Tutorial/3_EspressoMachine/PSrc/CoffeeMaker.p#L4-L29)) → Declares the events used to communicate between the control panel and the backend coffee maker.
- ([L31 - L78](https://github.com/p-org/P/blob/master/Tutorial/3_EspressoMachine/PSrc/CoffeeMaker.p#L31-L78)) → Declares the `EspressoCoffeeMaker` machine. EspressoCoffeeMaker receives requests from the control panel of the coffee machine and
@@ -61,7 +61,7 @@ it is reset and after which it returns to the `Warmup` state.
The test scenarios folder in P has two parts: TestDrivers and TestScripts. TestDrivers are collections of state machines that implement the test harnesses (or environment state machines) for different test scenarios. TestScripts are collections of test cases that are automatically run by the P checker.
-The test scenarios folder for EspressoMachine ([PTst](https://github.com/p-org/P/tree/master/Tutorial/1_EspressoMachine/PTst)) consists of three files: [TestDriver.p](https://github.com/p-org/P/blob/master/Tutorial/3_EspressoMachine/PTst/TestDrivers.p) and [TestScript.p](https://github.com/p-org/P/blob/master/Tutorial/3_EspressoMachine/PTst/TestScripts.p) are just like other previous examples. The [User.p](https://github.com/p-org/P/blob/master/Tutorial/3_EspressoMachine/PTst/Users.p) declares two machines: (1) a [`SaneUser` machine](https://github.com/p-org/P/blob/master/Tutorial/3_EspressoMachine/PTst/Users.p#L4-L51) that uses the EspressoMachine with care, pressing the buttons in the right order, and cleaning up the grounds after the coffee is made; and (2) a [`CrazyUser` machine](https://github.com/p-org/P/blob/master/Tutorial/3_EspressoMachine/PTst/Users.p#L66-L136) who has never used an espresso machine before, gets too excited, and starts pushing random buttons on the control panel.
+The test scenarios folder for EspressoMachine ([PTst](https://github.com/p-org/P/tree/master/Tutorial/1_EspressoMachine/PTst)) consists of three files: [TestDriver.p](https://github.com/p-org/P/blob/master/Tutorial/3_EspressoMachine/PTst/TestDrivers.p) and [TestScript.p](https://github.com/p-org/P/blob/master/Tutorial/3_EspressoMachine/PTst/TestScripts.p) are just like other previous examples. The [User.p](https://github.com/p-org/P/blob/master/Tutorial/3_EspressoMachine/PTst/Users.p) declares two machines: (1) a [`SaneUser` machine](https://github.com/p-org/P/blob/master/Tutorial/3_EspressoMachine/PTst/Users.p#L4-L51) that uses the EspressoMachine with care, pressing the buttons in the right order, and cleaning up the grounds after the coffee is made; and (2) a [`CrazyUser` machine](https://github.com/p-org/P/blob/master/Tutorial/3_EspressoMachine/PTst/Users.p#L66-L136) who has never used an espresso machine before, gets too excited, and starts pushing random buttons on the control panel.
### Compiling EspressoMachine
@@ -97,14 +97,14 @@ p compile
Determining projects to restore...
Restored P/Tutorial/3_EspressoMachine/PGenerated/CSharp/EspressoMachine.csproj (in 102 ms).
EspressoMachine -> P/Tutorial/3_EspressoMachine/PGenerated/CSharp/net6.0/EspressoMachine.dll
-
+
Build succeeded.
0 Warning(s)
0 Error(s)
-
+
Time Elapsed 00:00:04.57
-
-
+
+
----------------------------------------
~~ [PTool]: Thanks for using P! ~~
```
@@ -129,7 +129,7 @@ p check
Possible options are:
tcSaneUserUsingCoffeeMachine
tcCrazyUserUsingCoffeeMachine
-
+
~~ [PTool]: Thanks for using P! ~~
```
diff --git a/Docs/docs/tutorial/failuredetector.md b/Docs/docs/tutorial/failuredetector.md
index afb1061d0..a448f103e 100644
--- a/Docs/docs/tutorial/failuredetector.md
+++ b/Docs/docs/tutorial/failuredetector.md
@@ -6,7 +6,7 @@ By this point in the tutorial, we have gotten familiar with the P language and m
??? note "How to use this example"
We assume that you have cloned the P repository locally.
- ```shell
+ ```shell
git clone https://github.com/p-org/P.git
```
@@ -29,7 +29,7 @@ The [4_FailureDetector](https://github.com/p-org/P/tree/master/Tutorial/4_Failur
The P models ([PSrc](https://github.com/p-org/P/tree/master/Tutorial/4_FailureDetector/PSrc)) for the FailureDetector example consist of four files:
- [FailureDetector.p](https://github.com/p-org/P/blob/master/Tutorial/4_FailureDetector/PSrc/FailureDetector.p): Implements the `FailureDetector` machine.
-
+
??? tip "[Expand]: Let's walk through FailureDetector.p"
- ([L1 - L4](https://github.com/p-org/P/blob/master/Tutorial/4_FailureDetector/PSrc/FailureDetector.p#L1-L4)) → Event `ePing` and `ePong` are used to communicate between the `FailureDetector` and the `Node` state machines (manual: [event declaration](../manual/events.md)).
@@ -37,7 +37,7 @@ The P models ([PSrc](https://github.com/p-org/P/tree/master/Tutorial/4_FailureDe
- ([L14 - L129](https://github.com/p-org/P/blob/master/Tutorial/4_FailureDetector/PSrc/FailureDetector.p#L14-L129)) → Declares the `FailureDetector` state machine (manual: [P state machine](../manual/statemachines.md)). The key points to note in the `FailureDetector` machine are the usage of the [Timer](https://github.com/p-org/P/tree/master/Tutorial/Common/Timer) machine to model the usage of OS timer, the usage of [ReliableBroadCast](https://github.com/p-org/P/blob/master/Tutorial/4_FailureDetector/PSrc/FailureDetector.p#L81), and the usage of [UnReliableBroadCast](https://github.com/p-org/P/blob/master/Tutorial/4_FailureDetector/PSrc/FailureDetector.p#L48) defined in [NetworkFunctions.p](https://github.com/p-org/P/blob/master/Tutorial/Common/FailureInjector/PSrc/NetworkFunctions.p).
- [Node.p](https://github.com/p-org/P/blob/master/Tutorial/4_FailureDetector/PSrc/Node.p): Implements the `Node` machine.
-
+
??? tip "[Expand]: Let's walk through Node.p"
- ([L4 - L14](https://github.com/p-org/P/blob/master/Tutorial/4_FailureDetector/PSrc/Node.p#L4-L14)) → Declares the `Node` state machine. The `Node` machine responds with a `ePong` message on receiving a `ePing` message from the `FailureDetector`. On receiving a `eShutDown` message from the `FailureInjector`, the machine halts itself.
@@ -45,7 +45,7 @@ The P models ([PSrc](https://github.com/p-org/P/tree/master/Tutorial/4_FailureDe
??? tip "[Expand]: Let's walk through Client.p"
The `Client` machine is a dummy machine that gets a set of alive nodes when the system starts and maintains the set of currently alive nodes by removing the nodes that are marked as down by the `FailureDetector`.
-
+
- [FailureDetectorModules.p](https://github.com/p-org/P/blob/master/Tutorial/4_FailureDetector/PSrc/FailureDetectorModules.p): Declares the `FailureDetector` module.
??? tip "[Expand]: Let's walk through FailureDetectorModules.p"
@@ -72,7 +72,7 @@ The test scenarios folder for FailureDetector ([PTst](https://github.com/p-org/P
This file consists of a single test driver machine that sets up the system under test given the number of nodes and clients in the system. The [`SetupSystemWithFailureInjector`](https://github.com/p-org/P/blob/master/Tutorial/4_FailureDetector/PTst/TestDriver.p#L20-L42) function creates the clients, nodes, failure injector and the failure detector machines.
??? tip "[Expand]: Let's walk through TestScript.p"
- There is a single testcase ([TestFailureDetector](https://github.com/p-org/P/blob/master/Tutorial/4_FailureDetector/PTst/TestScript.p#L1-L3)) defined for the FailureDetector system. The test case asserts the `ReliableFailureDetector` specification on a system which is a composition of the `FailureDetector`, `FailureInjector`, and the test-driver `TestMultipleClients`.
+ There is a single testcase ([TestFailureDetector](https://github.com/p-org/P/blob/master/Tutorial/4_FailureDetector/PTst/TestScript.p#L1-L3)) defined for the FailureDetector system. The test case asserts the `ReliableFailureDetector` specification on a system which is a composition of the `FailureDetector`, `FailureInjector`, and the test-driver `TestMultipleClients`.
### Compiling FailureDetector
@@ -114,14 +114,14 @@ p compile
Determining projects to restore...
Restored P/Tutorial/4_FailureDetector/PGenerated/CSharp/FailureDetector.csproj (in 93 ms).
FailureDetector -> P/Tutorial/4_FailureDetector/PGenerated/CSharp/net6.0/FailureDetector.dll
-
+
Build succeeded.
0 Warning(s)
0 Error(s)
-
+
Time Elapsed 00:00:04.42
-
-
+
+
----------------------------------------
~~ [PTool]: Thanks for using P! ~~
```
diff --git a/Docs/docs/tutorial/twophasecommit.md b/Docs/docs/tutorial/twophasecommit.md
index b7cf268e3..819659ab3 100644
--- a/Docs/docs/tutorial/twophasecommit.md
+++ b/Docs/docs/tutorial/twophasecommit.md
@@ -1,7 +1,7 @@
??? note "How to use this example"
We assume that you have cloned the P repository locally.
- ```shell
+ ```shell
git clone https://github.com/p-org/P.git
```
@@ -32,7 +32,7 @@ Please feel free to read details about the recommended [P program structure](../
The P models ([PSrc](https://github.com/p-org/P/tree/master/Tutorial/2_TwoPhaseCommit/PSrc)) for the TwoPhaseCommit example consists of three files:
- [Coordinator.p](https://github.com/p-org/P/blob/master/Tutorial/2_TwoPhaseCommit/PSrc/Coordinator.p): Implements the Coordinator state machine.
-
+
??? tip "[Expand]: Let's walk through Coordinator.p"
- ([L25 - L33](https://github.com/p-org/P/blob/master/Tutorial/2_TwoPhaseCommit/PSrc/Coordinator.p#L25-L33)) → Declares the `write` and `read` transaction events used to communicate between the coordinator and the client machines (manual: [event declaration](../manual/events.md)).
- ([L35 - L43](https://github.com/p-org/P/blob/master/Tutorial/2_TwoPhaseCommit/PSrc/Coordinator.p#L35-L43)) → Declares the `prepare`, `commit`, and `abort` events used to communicate between the coordinator and the participants in the system.
@@ -45,12 +45,12 @@ The P models ([PSrc](https://github.com/p-org/P/tree/master/Tutorial/2_TwoPhaseC
times out and aborts the transaction. On receiving a read transaction, the coordinator randomly selects
a participant and forwards the read request to that participant.
- [Participant.p](https://github.com/p-org/P/blob/master/Tutorial/2_TwoPhaseCommit/PSrc/Participant.p): Implements the Participant state machine.
-
+
??? tip "[Expand]: Let's walk through Participant.p"
- Unlike the `Coordinator` state machine that has multiple states, the `Participant` state machine is fairly simple. Each participant waits for requests from the `Coordinator` and sends the response back based on whether the request can be accepted or has to be rejected.
- On receiving an `eShutDown` event, the participant executes a `raise halt` to destroy itself. To know more about the special `halt` event, please check the manual: [halt event](../manual/expressions.md#primitive).
- Each participant maintains a local key-value store which is updated based on the transactions committed by the coordinator. On receiving a prepare request from the coordinator, the participant chooses to either accept or reject the transaction based on the associated transaction id.
-
+
- [TwoPhaseCommitModules.p](https://github.com/p-org/P/blob/master/Tutorial/2_TwoPhaseCommit/PSrc/TwoPhaseCommitModules.p): Declares the P module corresponding to the two phase commit system.
### Timer and Failure Injector
@@ -86,12 +86,12 @@ The test scenarios folder for TwoPhaseCommit ([PTst](https://github.com/p-org/P/
P allows programmers to write different test cases. Each test case is checked separately and can use a different test driver. Using different test drivers triggers different behaviors in the system under test, as it implies different system configurations and input generators. To better understand the P test cases, please look at manual: [P test cases](../manual/testcases.md).
- ([L1 - L12](https://github.com/p-org/P/blob/master/Tutorial/2_TwoPhaseCommit/PTst/TestScripts.p#L1-L12)) → Declares three test cases each checking a different scenario in the system. The system under test is the `union` of the modules representing each component in the system (manual: [P module system](../manual/modulesystem.md#union-module)). The `assert` module constructor is used to attach monitors or specifications to be checked on the modules (manual: [assert](../manual/modulesystem.md#assert-monitors-module)).
-
+
??? tip "[Expand]: Let's walk through Client.p"
The `Client` machine implements the client of the two-phase-commit transaction service. Each client issues N non-deterministic write-transactions, if the transaction succeeds then it performs a read-transaction on the same key and asserts that the value read is same as what was written by the write transaction.
- ([L60](https://github.com/p-org/P/blob/master/Tutorial/2_TwoPhaseCommit/PTst/Client.p#L60)) → Declares a foreign function in P. Foreign functions are functions that are declared in P but implemented in the external foreign language. Please read the example in [P foreign interface](../manual/foriegntypesfunctions.md) to know more about this functionality. In this example, the `ChooseRandomTransaction` function could have been very easily written in P itself but it's implemented as foreign function just to demonstrate that P supports this functionality.
-
+
### Compiling TwoPhaseCommit
Navigate to the [2_TwoPhaseCommit](https://github.com/p-org/P/tree/master/Tutorial/2_TwoPhaseCommit) folder and run the following command to compile the TwoPhaseCommit project:
@@ -133,14 +133,14 @@ p compile
Determining projects to restore...
Restored P/Tutorial/2_TwoPhaseCommit/PGenerated/CSharp/TwoPhaseCommit.csproj (in 92 ms).
TwoPhaseCommit -> P/Tutorial/2_TwoPhaseCommit/PGenerated/CSharp/net6.0/TwoPhaseCommit.dll
-
+
Build succeeded.
0 Warning(s)
0 Error(s)
-
+
Time Elapsed 00:00:04.65
-
-
+
+
----------------------------------------
~~ [PTool]: Thanks for using P! ~~
```
@@ -166,7 +166,7 @@ p check
tcSingleClientNoFailure
tcMultipleClientsNoFailure
tcMultipleClientsWithFailure
-
+
~~ [PTool]: Thanks for using P! ~~
```
@@ -202,7 +202,7 @@ p check -tc tcMultipleClientsWithFailure -s 10000
```
!!! danger "Error"
- `tcMultipleClientsWithFailure` demonstrates the known case where in the presence of node failures the two phase commit protocol does not guarantee progress.
+ `tcMultipleClientsWithFailure` demonstrates the known case where in the presence of node failures the two phase commit protocol does not guarantee progress.
` Deadlock detected. Client(7) is waiting to receive an event, but no other controlled tasks are enabled.`
diff --git a/Docs/docs/tutsoutline.md b/Docs/docs/tutsoutline.md
index 090d67f0b..edd32ca3f 100644
--- a/Docs/docs/tutsoutline.md
+++ b/Docs/docs/tutsoutline.md
@@ -9,7 +9,7 @@ In this tutorial, we use a series of examples along with exercise problems to he
We recommend that you work through these examples one-by-one by solving the accompanying exercise problems before moving to the next example. If you have any doubts or questions, **please feel free to ask them in [discussions](https://github.com/p-org/P/discussions/categories/q-a) or create an [issue](https://github.com/p-org/P/issues)**.
Also, we assume that you have cloned the P repository locally.
- ```shell
+ ```shell
git clone https://github.com/p-org/P.git
```
@@ -34,7 +34,7 @@ Now that we understand the basic features of the P language, lets spice things u
### **[[Example 2] Two Phase Commit](tutorial/twophasecommit.md)**
-We use a simplified version of the [classic two phase commit protocol](https://s2.smu.edu/~mhd/8330f11/p133-gray.pdf) to model a transaction commit service.
+We use a simplified version of the [classic two phase commit protocol](https://s2.smu.edu/~mhd/8330f11/p133-gray.pdf) to model a transaction commit service.
The protocol uses a (single) coordinator to achieve consensus for a transaction spanning across multiple participants. A transaction in our case is simply a `put` operation for a key-value data store where the data store is replicated across participants.
**Assumptions:** Note that our transaction commit system is ridiculously simplified, for example, it is not fault tolerant to node failures, failure of either coordinator or any of the participants will block the progress forever. Also, we rely on [P's send semantics](advanced/psemantics.md) to model the behavior of the underlying network.
diff --git a/Docs/docs/videos.md b/Docs/docs/videos.md
index 3ad182a3a..59c0fb3ff 100644
--- a/Docs/docs/videos.md
+++ b/Docs/docs/videos.md
@@ -1,7 +1,7 @@
## Introductory tutorial on P
Background and motivation behind P :: what worked and what didn't: [Apple Podcast](https://podcasts.apple.com/us/podcast/episode-20-ankush-desai-p-the-modeling-language-that-could/id1537190695?i=1000559001558) and [Youtube Podcast](https://www.youtube.com/watch?v=ivFc79l6VpM).
-
+
## Tech Talks and Presentations
diff --git a/Docs/docs/whatisP.md b/Docs/docs/whatisP.md
index 0adf5e150..d81051872 100644
--- a/Docs/docs/whatisP.md
+++ b/Docs/docs/whatisP.md
@@ -39,7 +39,7 @@ The P module system enables programmers to model their system _modularly_ and
perform _compositional_ testing to scale the analysis to large distributed systems.
-!!! Tip "Models, Specifications, Model Checking Scenario"
+!!! Tip "Models, Specifications, Model Checking Scenario"
A quick primer on what a model
is, versus a specification, and model checking scenarios: (1) a specification says what
the system should do (correctness properties); (2) a model captures the details of how the
diff --git a/Docs/mkdocs.yml b/Docs/mkdocs.yml
index 0eadca4ce..38a1e05ca 100644
--- a/Docs/mkdocs.yml
+++ b/Docs/mkdocs.yml
@@ -112,7 +112,7 @@ markdown_extensions:
- pymdownx.emoji:
emoji_index: !!python/name:materialx.emoji.twemoji
emoji_generator: !!python/name:materialx.emoji.to_svg
-
+
plugins:
- search:
diff --git a/README.md b/README.md
index 1d76986d8..6b30ceff1 100644
--- a/README.md
+++ b/README.md
@@ -10,11 +10,11 @@
![GitHub Action (CI on MacOS)](https://github.com/p-org/P/workflows/CI%20on%20MacOS/badge.svg)
[![Tutorials](https://github.com/p-org/P/actions/workflows/tutorials.yml/badge.svg)](https://github.com/p-org/P/actions/workflows/tutorials.yml)
-**Challenge**:
+**Challenge**:
Distributed systems are notoriously hard to get right. Programming these systems is challenging because of the need to reason about correctness in the presence of myriad possible interleaving of messages and failures. Unsurprisingly, it is common for service teams to uncover correctness bugs after deployment. Formal methods can play an important role in addressing this challenge!
-**P Overview:**
+**P Overview:**
P is a state machine based programming language for formally modeling and specifying complex
distributed systems. P allows programmers to model their system design as a collection of
communicating state machines. P supports several backend analysis engines
diff --git a/Src/CMakeLists.txt b/Src/CMakeLists.txt
index e2f1f3f35..55d145315 100644
--- a/Src/CMakeLists.txt
+++ b/Src/CMakeLists.txt
@@ -44,7 +44,7 @@ macro ( Publish_Library_Header target )
file ( GLOB incl_files ${incl_file_path}/*.h )
foreach(incl_file ${incl_files})
add_custom_command(TARGET ${target} POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E copy_if_different
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different
${incl_file}
${LIBRARY_OUTPUT_INCLUDE_PATH}
)
diff --git a/Src/PChecker/CheckerCore/Actors/Actor.cs b/Src/PChecker/CheckerCore/Actors/Actor.cs
index a9ecb21ac..1804591e2 100644
--- a/Src/PChecker/CheckerCore/Actors/Actor.cs
+++ b/Src/PChecker/CheckerCore/Actors/Actor.cs
@@ -113,7 +113,7 @@ protected internal virtual Guid OperationGroupId
/// The installed runtime logger.
///
protected TextWriter Logger => Runtime.Logger;
-
+
///
/// The installed runtime json logger.
///
diff --git a/Src/PChecker/CheckerCore/Actors/ActorRuntime.cs b/Src/PChecker/CheckerCore/Actors/ActorRuntime.cs
index 209bb26b7..1959d9c76 100644
--- a/Src/PChecker/CheckerCore/Actors/ActorRuntime.cs
+++ b/Src/PChecker/CheckerCore/Actors/ActorRuntime.cs
@@ -41,7 +41,7 @@ internal class ActorRuntime : CoyoteRuntime, IActorRuntime
/// to replace the logger with a custom one.
///
public override TextWriter Logger => LogWriter.Logger;
-
+
///
/// Used to log json trace outputs.
///
@@ -392,7 +392,7 @@ private async Task RunActorEventHandlerAsync(Actor actor, Event initialEvent, bo
return;
}
}
-
+
///
internal override void TryCreateMonitor(Type type)
{
@@ -696,7 +696,7 @@ internal void NotifyMonitorError(Monitor monitor)
///
public override TextWriter SetLogger(TextWriter logger) => LogWriter.SetLogger(logger);
-
+
///
/// Sets the JsonLogger in LogWriter.cs
///
diff --git a/Src/PChecker/CheckerCore/Actors/Logging/ActorRuntimeLogJsonFormatter.cs b/Src/PChecker/CheckerCore/Actors/Logging/ActorRuntimeLogJsonFormatter.cs
index 0d2495220..e1718377d 100644
--- a/Src/PChecker/CheckerCore/Actors/Logging/ActorRuntimeLogJsonFormatter.cs
+++ b/Src/PChecker/CheckerCore/Actors/Logging/ActorRuntimeLogJsonFormatter.cs
@@ -17,7 +17,7 @@ public class ActorRuntimeLogJsonFormatter : IActorRuntimeLog
public JsonWriter Writer { get; set; }
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
protected ActorRuntimeLogJsonFormatter()
{
diff --git a/Src/PChecker/CheckerCore/Actors/Logging/IActorRuntimeLog.cs b/Src/PChecker/CheckerCore/Actors/Logging/IActorRuntimeLog.cs
index 49e92e4f0..ed4cb0b95 100644
--- a/Src/PChecker/CheckerCore/Actors/Logging/IActorRuntimeLog.cs
+++ b/Src/PChecker/CheckerCore/Actors/Logging/IActorRuntimeLog.cs
@@ -114,7 +114,7 @@ void OnSendEvent(ActorId targetActorId, string senderName, string senderType, st
/// The name of the current state.
/// The target state of the transition.
void OnGotoState(ActorId id, string currentStateName, string newStateName);
-
+
///
/// Invoked when the specified actor is idle (there is nothing to dequeue) and the default
@@ -166,7 +166,7 @@ void OnSendEvent(ActorId targetActorId, string senderName, string senderType, st
/// The name of the action being executed.
/// The exception.
void OnExceptionHandled(ActorId id, string stateName, string actionName, Exception ex);
-
+
///
/// Invoked when the specified monitor has been created.
diff --git a/Src/PChecker/CheckerCore/Actors/Logging/JsonWriter.cs b/Src/PChecker/CheckerCore/Actors/Logging/JsonWriter.cs
index 76bd274e9..2802f9e71 100644
--- a/Src/PChecker/CheckerCore/Actors/Logging/JsonWriter.cs
+++ b/Src/PChecker/CheckerCore/Actors/Logging/JsonWriter.cs
@@ -15,7 +15,7 @@ internal class VectorClockGenerator
{
///
/// Nested class for handling FIFO send receive requests.
- /// NOTE: In the case of sending to a the same machine with the same event and same payload.
+ /// NOTE: In the case of sending to a the same machine with the same event and same payload.
///
private class FifoSendReceiveMapping
{
@@ -141,8 +141,8 @@ private static Dictionary CopyVcMap(Dictionary vcMap)
// If no payload, return empty string
case null:
return string.Empty;
-
- // If payload is of Dictionary, iterate through key, value pair and build string. Recurse on the value
+
+ // If payload is of Dictionary, iterate through key, value pair and build string. Recurse on the value
// in the case that the value is another dictionary/list rather than a primitive type
case IDictionary eventPayloadDict:
{
@@ -152,17 +152,17 @@ private static Dictionary CopyVcMap(Dictionary vcMap)
{
stringBuilder.Append($"{key}: {ConvertPayloadToString(eventPayloadDict[key])}, ");
}
-
+
// Remove the last ", "
if (stringBuilder.Length >= 2)
{
stringBuilder.Length -= 2;
}
-
+
// Surround string with { and }
return $"{{ {stringBuilder} }}";
}
-
+
// If payload is of List, iterate through each item, and build string. Recurse on the item value
// in the case that the value is another dictionary/list rather than a primitive type
case IList eventPayloadList:
@@ -172,17 +172,17 @@ private static Dictionary CopyVcMap(Dictionary vcMap)
{
stringBuilder.Append($"{ConvertPayloadToString(value)}, ");
}
-
+
// Remove the last ", "
if (stringBuilder.Length >= 2)
{
stringBuilder.Length -= 2;
}
-
+
// Surround string with [ and ]
return $"[ {stringBuilder} ]";
}
-
+
// Just convert primitive types to string
default:
return eventPayload.ToString();
@@ -276,7 +276,7 @@ public void HandleLogEntry(LogEntry logEntry)
_unhandledSendRequests.Add(hashedSendReqId, CopyVcMap(_contextVcMap[machine]));
break;
- // For MonitorProcessEvents, tie it to the senderMachine's current vector clock
+ // For MonitorProcessEvents, tie it to the senderMachine's current vector clock
// so that there is some association in the timeline
case "MonitorProcessEvent":
if (logDetails.Sender != null) updateMachineVcMap(machine, _contextVcMap[logDetails.Sender]);
@@ -322,7 +322,7 @@ public void HandleLogEntry(LogEntry logEntry)
}
///
- ///
+ ///
///
public class LogEntry
{
@@ -337,7 +337,7 @@ public class LogEntry
public LogDetails Details { get; set; }
///
- /// LogEntry constructor.
+ /// LogEntry constructor.
///
public LogEntry()
{
@@ -353,7 +353,7 @@ public LogEntry()
/// are changed for simplicity.
/// I.e., for OnRaiseEvent(ActorId id, string, stateName, Event e), it
/// will have attributes id, state (simplified from stateName, event
- /// (simplified from eventName within Event e), and payload (in Event e).
+ /// (simplified from eventName within Event e), and payload (in Event e).
///
public class LogDetails
{
@@ -388,7 +388,7 @@ public class LogDetails
/// Type of creator.
///
public string? CreatorType { get; set; }
-
+
///
/// The state associated with an event, machine, etc...
///
@@ -539,7 +539,7 @@ public class JsonWriter
/// Getter for accessing log entry details.
///
public LogDetails LogDetails => _log.Details;
-
+
///
/// Getter for accessing logs.
///
@@ -680,12 +680,12 @@ public enum LogType
/// Invoked when the specified actor waits to receive multiple events of a specified type.
///
WaitMultipleEvents,
-
+
///
/// Invoked on a print statement
///
Print,
-
+
///
/// Invoked on a print statement
///
diff --git a/Src/PChecker/CheckerCore/Actors/Logging/LogWriter.cs b/Src/PChecker/CheckerCore/Actors/Logging/LogWriter.cs
index f92e5d13e..aad60d8aa 100644
--- a/Src/PChecker/CheckerCore/Actors/Logging/LogWriter.cs
+++ b/Src/PChecker/CheckerCore/Actors/Logging/LogWriter.cs
@@ -25,7 +25,7 @@ internal sealed class LogWriter
/// Used to log messages.
///
internal TextWriter Logger { get; private set; }
-
+
///
/// Used to log json messages.
///
@@ -566,7 +566,7 @@ internal TextWriter SetLogger(TextWriter logger)
return prevLogger;
}
-
+
///
/// Sets the JsonLogger to an instance created on runtime.
///
@@ -618,14 +618,14 @@ internal void RegisterLog(IActorRuntimeLog log)
a.Logger = Logger;
}
}
-
+
// If log is or of subclass ActorRuntimeLogJsonFormatter (i.e. when log is PJsonFormatter),
// update the Writer reference to the JsonLogger instance defined within LogWriter.cs
if (log is ActorRuntimeLogJsonFormatter tempJsonFormatter)
{
tempJsonFormatter.Writer = JsonLogger;
}
-
+
Logs.Add(log);
}
diff --git a/Src/PChecker/CheckerCore/CheckerConfiguration.cs b/Src/PChecker/CheckerCore/CheckerConfiguration.cs
index 01a6e406d..43e557cf9 100644
--- a/Src/PChecker/CheckerCore/CheckerConfiguration.cs
+++ b/Src/PChecker/CheckerCore/CheckerConfiguration.cs
@@ -23,19 +23,19 @@ public class CheckerConfiguration
///
[DataMember]
public string PCompiledPath;
-
+
///
/// The output path.
///
[DataMember]
public string OutputPath;
-
+
///
/// Timeout in seconds.
///
[DataMember]
public string OutputDirectory;
-
+
///
/// Timeout in seconds.
///
@@ -170,7 +170,7 @@ public int MaxSchedulingSteps
/// If this option is enabled, the tester is hashing the program state.
///
[DataMember] public bool IsProgramStateHashingEnabled;
-
+
///
/// The schedule file to be replayed.
///
@@ -223,14 +223,14 @@ public int MaxSchedulingSteps
///
[DataMember]
public bool IsXmlLogEnabled { get; set; }
-
+
///
/// Produce a JSON formatted runtime log file.
/// Defaults to true.
///
[DataMember]
public bool IsJsonLogEnabled { get; set; } = true;
-
+
///
/// If specified, requests a custom runtime log to be used instead of the default.
/// This is the AssemblyQualifiedName of the type to load.
@@ -328,7 +328,7 @@ protected CheckerConfiguration()
IsVerbose = false;
EnableDebugging = false;
-
+
EnableColoredConsoleOutput = false;
DisableEnvironmentExit = true;
@@ -379,7 +379,7 @@ public CheckerConfiguration WithPCTStrategy(bool isFair, uint numPrioritySwitchP
StrategyBound = (int)numPrioritySwitchPoints;
return this;
}
-
+
///
/// Updates the configuration to use the reinforcement learning (RL) scheduling strategy
/// during systematic testing.
@@ -390,7 +390,7 @@ public CheckerConfiguration WithRLStrategy()
this.IsProgramStateHashingEnabled = true;
return this;
}
-
+
///
/// Updates the checkerConfiguration to use the dfs scheduling strategy during systematic testing.
///
@@ -515,7 +515,7 @@ public CheckerConfiguration WithXmlLogEnabled(bool isEnabled = true)
IsXmlLogEnabled = isEnabled;
return this;
}
-
+
///
/// Set the to either the user-specified
/// or to a unique output directory name in the same directory as
diff --git a/Src/PChecker/CheckerCore/Coverage/ActivityCoverageReporter.cs b/Src/PChecker/CheckerCore/Coverage/ActivityCoverageReporter.cs
index 6401efb0b..e0b29a15c 100644
--- a/Src/PChecker/CheckerCore/Coverage/ActivityCoverageReporter.cs
+++ b/Src/PChecker/CheckerCore/Coverage/ActivityCoverageReporter.cs
@@ -53,7 +53,10 @@ public void EmitCoverageReport(string coverageFile)
{
using (var writer = new StreamWriter(coverageFile))
{
- WriteCoverageText(writer);
+ if (CoverageInfo.CoverageGraph != null)
+ {
+ WriteCoverageText(writer);
+ }
}
}
@@ -353,7 +356,7 @@ private static string GetMachineId(string nodeId)
private static string GetStateId(string machineName, string stateName) =>
string.Format("{0}::{1}", stateName, machineName);
-
+
private static string GetSanitizedName(string name)
{
var i = name.LastIndexOf(".");
@@ -361,7 +364,7 @@ private static string GetSanitizedName(string name)
{
return name.Substring(i + 1);
}
-
+
return name;
}
}
diff --git a/Src/PChecker/CheckerCore/ExhaustiveSearch/ExhaustiveSearch.cs b/Src/PChecker/CheckerCore/ExhaustiveSearch/ExhaustiveSearch.cs
index bd8fb162c..e0e1f88cc 100644
--- a/Src/PChecker/CheckerCore/ExhaustiveSearch/ExhaustiveSearch.cs
+++ b/Src/PChecker/CheckerCore/ExhaustiveSearch/ExhaustiveSearch.cs
@@ -85,25 +85,25 @@ private String CreateArguments()
Error.ReportAndExit($"Unexpected checker mode: {_checkerConfiguration.Mode}.");
break;
}
-
+
arguments.Append($"--timeout {_checkerConfiguration.Timeout} ");
-
+
arguments.Append($"--memout {_checkerConfiguration.MemoryLimit} ");
if (_checkerConfiguration.IsVerbose)
{
arguments.Append($"--verbose 1 ");
}
-
+
arguments.Append($"--schedules {_checkerConfiguration.TestingIterations} ");
-
+
arguments.Append($"--max-steps {_checkerConfiguration.MaxUnfairSchedulingSteps} ");
if (_checkerConfiguration.ConsiderDepthBoundHitAsBug)
{
arguments.Append("--fail-on-maxsteps ");
}
-
+
if (_checkerConfiguration.RandomGeneratorSeed.HasValue)
{
arguments.Append($"--seed {_checkerConfiguration.RandomGeneratorSeed.Value} ");
@@ -143,9 +143,9 @@ private async Task CreateTaskFromProcess(Process proc)
CancellationTokenSource.CancelAfter(
(_checkerConfiguration.Timeout + 30) * 1000);
}
-
+
await proc.WaitForExitAsync(CancellationTokenSource.Token);
-
+
switch (proc.ExitCode)
{
case 0:
@@ -190,7 +190,7 @@ public void Run()
proc.Start();
Task task = CreateTaskFromProcess(proc);
bool interrupted = false;
-
+
// For graceful shutdown, trap unload event
AppDomain.CurrentDomain.ProcessExit += delegate
{
diff --git a/Src/PChecker/CheckerCore/Scheduling/TestingProcessScheduler.cs b/Src/PChecker/CheckerCore/Scheduling/TestingProcessScheduler.cs
index 026384b48..fa59f57ec 100644
--- a/Src/PChecker/CheckerCore/Scheduling/TestingProcessScheduler.cs
+++ b/Src/PChecker/CheckerCore/Scheduling/TestingProcessScheduler.cs
@@ -52,7 +52,7 @@ public class TestingProcessScheduler
/// The scheduler lock.
///
private readonly object SchedulerLock;
-
+
///
/// Set if ctrl-c or ctrl-break occurred.
@@ -74,7 +74,7 @@ private TestingProcessScheduler(CheckerConfiguration checkerConfiguration)
GlobalTestReport = new TestReport(checkerConfiguration);
Profiler = new Profiler();
SchedulerLock = new object();
-
+
IsVerbose = checkerConfiguration.IsVerbose;
checkerConfiguration.EnableColoredConsoleOutput = true;
@@ -98,7 +98,7 @@ public void Run()
Profiler.StartMeasuringExecutionTime();
CreateAndRunInMemoryTestingProcess();
-
+
Profiler.StopMeasuringExecutionTime();
if (!IsProcessCanceled)
diff --git a/Src/PChecker/CheckerCore/Specifications/Monitor.cs b/Src/PChecker/CheckerCore/Specifications/Monitor.cs
index 15de7d513..acf62c8dc 100644
--- a/Src/PChecker/CheckerCore/Specifications/Monitor.cs
+++ b/Src/PChecker/CheckerCore/Specifications/Monitor.cs
@@ -103,7 +103,7 @@ public abstract class Monitor
/// See Logging for more information.
///
protected TextWriter Logger => Runtime.Logger;
-
+
///
/// The runtime installed json logger;
///
diff --git a/Src/PChecker/CheckerCore/SystematicTesting/ControlledRuntime.cs b/Src/PChecker/CheckerCore/SystematicTesting/ControlledRuntime.cs
index 4f09f8113..c5983e709 100644
--- a/Src/PChecker/CheckerCore/SystematicTesting/ControlledRuntime.cs
+++ b/Src/PChecker/CheckerCore/SystematicTesting/ControlledRuntime.cs
@@ -65,7 +65,7 @@ internal sealed class ControlledRuntime : ActorRuntime
///
internal readonly int? RootTaskId;
-
+
///
/// Returns the current hashed state of the monitors.
///
@@ -89,7 +89,7 @@ private int GetHashedMonitorState()
return hash;
}
}
-
+
///
/// Returns the current hashed state of the execution.
///
@@ -822,7 +822,7 @@ private void CheckIfSchedulingStepsBoundIsReached()
{
Scheduler.CheckIfSchedulingStepsBoundIsReached();
}
-
+
///
/// Schedules the next controlled asynchronous operation. This method
/// is only used during testing.
diff --git a/Src/PChecker/CheckerCore/SystematicTesting/OperationScheduler.cs b/Src/PChecker/CheckerCore/SystematicTesting/OperationScheduler.cs
index 7815e8788..e21e6770e 100644
--- a/Src/PChecker/CheckerCore/SystematicTesting/OperationScheduler.cs
+++ b/Src/PChecker/CheckerCore/SystematicTesting/OperationScheduler.cs
@@ -139,10 +139,10 @@ internal void ScheduleNextEnabledOperation(AsyncOperationType type)
// Checks if the scheduling steps bound has been reached.
CheckIfSchedulingStepsBoundIsReached();
-
+
// Update the operation type.
current.Type = type;
-
+
if (CheckerConfiguration.IsProgramStateHashingEnabled)
{
// Update the current operation with the hashed program state.
diff --git a/Src/PChecker/CheckerCore/SystematicTesting/Operations/AsyncOperation.cs b/Src/PChecker/CheckerCore/SystematicTesting/Operations/AsyncOperation.cs
index 7e31e1c38..cac165309 100644
--- a/Src/PChecker/CheckerCore/SystematicTesting/Operations/AsyncOperation.cs
+++ b/Src/PChecker/CheckerCore/SystematicTesting/Operations/AsyncOperation.cs
@@ -23,7 +23,7 @@ internal abstract class AsyncOperation : IAsyncOperation
///
public AsyncOperationStatus Status { get; internal set; }
-
+
///
/// The type of the operation.
///
diff --git a/Src/PChecker/CheckerCore/SystematicTesting/Strategies/Probabilistic/RandomStrategy.cs b/Src/PChecker/CheckerCore/SystematicTesting/Strategies/Probabilistic/RandomStrategy.cs
index be3997192..7bd654b61 100644
--- a/Src/PChecker/CheckerCore/SystematicTesting/Strategies/Probabilistic/RandomStrategy.cs
+++ b/Src/PChecker/CheckerCore/SystematicTesting/Strategies/Probabilistic/RandomStrategy.cs
@@ -37,7 +37,7 @@ public RandomStrategy(int maxSteps, IRandomValueGenerator random)
MaxScheduledSteps = maxSteps;
ScheduledSteps = 0;
}
-
+
///
public virtual bool GetNextOperation(AsyncOperation current, IEnumerable ops, out AsyncOperation next)
{
diff --git a/Src/PChecker/CheckerCore/SystematicTesting/TestMethodInfo.cs b/Src/PChecker/CheckerCore/SystematicTesting/TestMethodInfo.cs
index 626dcbdf5..c7df5035c 100644
--- a/Src/PChecker/CheckerCore/SystematicTesting/TestMethodInfo.cs
+++ b/Src/PChecker/CheckerCore/SystematicTesting/TestMethodInfo.cs
@@ -119,10 +119,10 @@ private static (Delegate testMethod, string testName) GetTestMethod(Assembly ass
// Filter by test method name
// find the test case with exact match
var findExactMatch = testMethods.FindAll(mi => mi.DeclaringType.Name == (methodName));
- var filteredTestMethods =
+ var filteredTestMethods =
findExactMatch.Any()? findExactMatch: testMethods.FindAll(mi => mi.DeclaringType.Name.Contains(methodName));
-
-
+
+
if (filteredTestMethods.Count == 0)
{
if (testMethods.Count > 0)
diff --git a/Src/PChecker/CheckerCore/SystematicTesting/TestingEngine.cs b/Src/PChecker/CheckerCore/SystematicTesting/TestingEngine.cs
index 880604b9f..0c7fb0bca 100644
--- a/Src/PChecker/CheckerCore/SystematicTesting/TestingEngine.cs
+++ b/Src/PChecker/CheckerCore/SystematicTesting/TestingEngine.cs
@@ -82,7 +82,7 @@ public class TestingEngine
/// checkerConfiguration is specified.
///
private JsonWriter JsonLogger;
-
+
///
/// Field declaration for the JsonVerboseLogs
/// Structure representation is a list of the JsonWriter logs.
@@ -99,7 +99,7 @@ public class TestingEngine
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
WriteIndented = true
};
-
+
///
/// The profiler.
///
@@ -126,7 +126,7 @@ public class TestingEngine
/// checkerConfiguration is specified.
///
private StringBuilder XmlLog;
-
+
///
/// The readable trace, if any.
///
@@ -169,7 +169,7 @@ public static TestingEngine Create(CheckerConfiguration checkerConfiguration, As
{
Console.Out.WriteLine($"{mi.DeclaringType.Name}");
}
-
+
Environment.Exit(0);
}
catch
@@ -177,7 +177,7 @@ public static TestingEngine Create(CheckerConfiguration checkerConfiguration, As
Error.ReportAndExit($"Failed to list test methods from assembly '{assembly.FullName}'");
}
}
-
+
TestMethodInfo testMethodInfo = null;
try
{
@@ -265,7 +265,7 @@ private TestingEngine(CheckerConfiguration checkerConfiguration, TestMethodInfo
{
JsonVerboseLogs = new List>();
}
-
+
if (checkerConfiguration.SchedulingStrategy is "replay")
{
var scheduleDump = GetScheduleForReplay(out var isFair);
@@ -463,7 +463,7 @@ _checkerConfiguration.SchedulingStrategy is "probabilistic" ||
using var jsonStreamFile = File.Create(jsonVerbosePath);
JsonSerializer.Serialize(jsonStreamFile, JsonVerboseLogs, jsonSerializerConfig);
}
-
+
}, CancellationTokenSource.Token);
}
@@ -502,7 +502,7 @@ private void RunNextIteration(int schedule)
// Always output a json log of the error
JsonLogger = new JsonWriter();
runtime.SetJsonLogger(JsonLogger);
-
+
// If verbosity is turned off, then intercept the program log, and also redirect
// the standard output and error streams to a nul logger.
if (!_checkerConfiguration.IsVerbose)
@@ -547,7 +547,7 @@ private void RunNextIteration(int schedule)
{
JsonVerboseLogs.Add(JsonLogger.Logs);
}
-
+
runtime.LogWriter.LogCompletion();
GatherTestingStatistics(runtime);
@@ -684,12 +684,12 @@ public void TryEmitTraces(string directory, string file)
Logger.WriteLine($"..... Writing {xmlPath}");
File.WriteAllText(xmlPath, XmlLog.ToString());
}
-
+
if (_checkerConfiguration.IsJsonLogEnabled)
{
var jsonPath = directory + file + "_" + index + ".trace.json";
Logger.WriteLine($"..... Writing {jsonPath}");
-
+
// Remove the null objects from payload recursively for each log event
for(int i=0; i SimplifyStatement(IPStmt statement)
{
return assertDeps.Concat(messageDeps).Concat(new []{new AssertStmt(location, assertExpr, messageExpr)}).ToList();
}
-
+
var ifStmtForAssert = new IfStmt(location, assertExpr, new NoStmt(location), new CompoundStmt(
location, messageDeps.Concat(new[]
{
@@ -621,17 +621,17 @@ private IPStmt SimplifyForeachStmt(ForeachStmt foreachStmt)
newBody.Add(new AssignStmt(location, new VariableAccessExpr(location, sizeVar), new SizeofExpr(location, collectionCopy)));
// while(i < (sizeof - 1))
- IPExpr cond = new BinOpExpr(location, BinOpType.Lt,
- new VariableAccessExpr(location, iVar),
- new BinOpExpr(location, BinOpType.Sub,
- new VariableAccessExpr(location, sizeVar),
+ IPExpr cond = new BinOpExpr(location, BinOpType.Lt,
+ new VariableAccessExpr(location, iVar),
+ new BinOpExpr(location, BinOpType.Sub,
+ new VariableAccessExpr(location, sizeVar),
new IntLiteralExpr(location, 1)));
// inside loop: i = i+1;
- IPStmt incrementI = new AssignStmt(location, new VariableAccessExpr(location, iVar),
- new BinOpExpr(location,
+ IPStmt incrementI = new AssignStmt(location, new VariableAccessExpr(location, iVar),
+ new BinOpExpr(location,
BinOpType.Add,
- new VariableAccessExpr(location, iVar),
+ new VariableAccessExpr(location, iVar),
new IntLiteralExpr(location, 1)));
// inside loop: item = collection[i]
diff --git a/Src/PCompiler/CompilerCore/Backend/Java/Constants.cs b/Src/PCompiler/CompilerCore/Backend/Java/Constants.cs
index ecd1fca56..20de91eb6 100644
--- a/Src/PCompiler/CompilerCore/Backend/Java/Constants.cs
+++ b/Src/PCompiler/CompilerCore/Backend/Java/Constants.cs
@@ -171,7 +171,7 @@ internal static string AsFFIComment(string line)
.
";
-
+
internal static readonly string pomForeignTemplate =
@"
diff --git a/Src/PCompiler/CompilerCore/Backend/Java/JavaCompiler.cs b/Src/PCompiler/CompilerCore/Backend/Java/JavaCompiler.cs
index b966e9e78..c181f4b51 100644
--- a/Src/PCompiler/CompilerCore/Backend/Java/JavaCompiler.cs
+++ b/Src/PCompiler/CompilerCore/Backend/Java/JavaCompiler.cs
@@ -15,7 +15,7 @@ public void GenerateBuildScript(ICompilerConfiguration job)
// create the pom.xml file
var pomTemplate = Constants.pomTemplate;
pomTemplate = pomTemplate.Replace("-package-name-",job.PObservePackageName);
-
+
string foreignInclude = "";
var foreignFiles = job.InputForeignFiles.Where(x => x.EndsWith(".java"));
if (foreignFiles.Any())
@@ -39,7 +39,7 @@ public void GenerateBuildScript(ICompilerConfiguration job)
foreignInclude = foreignInclude.Replace("-foreign-source-include-", foreignSourceInclude);
}
pomTemplate = pomTemplate.Replace("-foreign-include-", foreignInclude);
-
+
File.WriteAllText(pomPath, pomTemplate);
job.Output.WriteInfo("Generated " + Constants.BuildFileName);
diff --git a/Src/PCompiler/CompilerCore/Backend/Java/MachineGenerator.cs b/Src/PCompiler/CompilerCore/Backend/Java/MachineGenerator.cs
index 1efb3d06e..5d8beb352 100644
--- a/Src/PCompiler/CompilerCore/Backend/Java/MachineGenerator.cs
+++ b/Src/PCompiler/CompilerCore/Backend/Java/MachineGenerator.cs
@@ -15,7 +15,7 @@ internal class MachineGenerator : JavaSourceGenerator
{
private Machine _currentMachine; // Some generated code is machine-dependent, so stash the current machine here.
- private HashSet _calledStaticFunctions = new HashSet(); // static functions allowed
+ private HashSet _calledStaticFunctions = new HashSet(); // static functions allowed
private bool debug = false;
internal MachineGenerator(ICompilerConfiguration job, string filename) : base(job, filename)
@@ -56,13 +56,13 @@ protected override void GenerateCodeImpl()
}
_currentMachine = null;
}
-
+
// static functions
foreach (var f in _calledStaticFunctions)
{
WriteFunction(f);
}
-
+
WriteLine("}");
}
diff --git a/Src/PCompiler/CompilerCore/Backend/Java/TypeManager.cs b/Src/PCompiler/CompilerCore/Backend/Java/TypeManager.cs
index 595cfa892..b06f3a266 100644
--- a/Src/PCompiler/CompilerCore/Backend/Java/TypeManager.cs
+++ b/Src/PCompiler/CompilerCore/Backend/Java/TypeManager.cs
@@ -89,10 +89,10 @@ internal string ReferenceTypeName
///
internal virtual string MutatorMethodName =>
throw new Exception($"MutatorMethodName not implemented for {TypeName}");
-
+
internal virtual string InsertMethodName =>
throw new Exception($"MutatorMethodName not implemented for {TypeName}");
-
+
///
/// The name of the method K -> void that removes key K from the collection. Throws for
/// non-collection types!
diff --git a/Src/PCompiler/CompilerCore/Backend/Java/TypesGenerator.cs b/Src/PCompiler/CompilerCore/Backend/Java/TypesGenerator.cs
index 06d3cebcb..dce2feddc 100644
--- a/Src/PCompiler/CompilerCore/Backend/Java/TypesGenerator.cs
+++ b/Src/PCompiler/CompilerCore/Backend/Java/TypesGenerator.cs
@@ -219,7 +219,7 @@ private void WriteNamedTupleToString(string tname, List<(TypeManager.JType, stri
// Write toString() in the same output style as a Java record.
WriteLine("public String toString() {");
WriteLine($"StringBuilder sb = new StringBuilder(\"{tname}\");");
-
+
WriteLine("sb.append(\"[\");");
foreach (var (sep, (_, fieldName)) in fields.WithPrefixSep(", "))
{
diff --git a/Src/PCompiler/CompilerCore/Backend/NameManagerBase.cs b/Src/PCompiler/CompilerCore/Backend/NameManagerBase.cs
index 607a21b8e..e03b2e4e5 100644
--- a/Src/PCompiler/CompilerCore/Backend/NameManagerBase.cs
+++ b/Src/PCompiler/CompilerCore/Backend/NameManagerBase.cs
@@ -66,6 +66,6 @@ private bool TryGetNameForNode(IPDecl node, out string name)
{
return declNames.TryGetValue(node, out name);
}
-
+
}
}
\ No newline at end of file
diff --git a/Src/PCompiler/CompilerCore/Backend/Stately/StatelyCodeGenerator.cs b/Src/PCompiler/CompilerCore/Backend/Stately/StatelyCodeGenerator.cs
index 64e63107b..7b0a4cb0e 100644
--- a/Src/PCompiler/CompilerCore/Backend/Stately/StatelyCodeGenerator.cs
+++ b/Src/PCompiler/CompilerCore/Backend/Stately/StatelyCodeGenerator.cs
@@ -47,7 +47,7 @@ private void WriteDecl(CompilationContext context, StringWriter output, IPDecl d
}
}
- //Collects all the go-to's within a function call, iteratively
+ //Collects all the go-to's within a function call, iteratively
private List WriteStmt(IPStmt statement)
{
var gotoStmts = new List();
@@ -107,22 +107,22 @@ private List WriteStmt(IPStmt statement)
return gotoStmts;
}
-
+
//Handles writing all instances of a machine
private void WriteMachine(CompilationContext context, StringWriter output, Machine machine)
{
context.WriteLine(output, $"const {machine.Name} = createMachine({{");
context.WriteLine(output, $"id: \"{machine.Name}\",");
-
+
//Code start state of machine.
context.WriteLine(output,$"initial: \"{machine.StartState.Name}\", ");
-
+
//Code up the states in each machine.
context.WriteLine(output, "states: {");
foreach (State state in machine.States)
{
-
+
context.WriteLine(output,$"{state.Name}: {{");
WriteState(context, output, state);
context.WriteLine(output, state.Equals(machine.States.Last()) ? "}" : "},");
@@ -130,7 +130,7 @@ private void WriteMachine(CompilationContext context, StringWriter output, Machi
context.WriteLine(output, "}");
context.WriteLine(output, "});");
}
-
+
//Handles writing all instances of states (within a machine)
private void WriteState(CompilationContext context, StringWriter output, State state)
{
@@ -160,7 +160,7 @@ private void WriteState(CompilationContext context, StringWriter output, State s
foreach (var pair in state.AllEventHandlers)
{
var handledEvent = pair.Key;
-
+
//context.WriteLine(output, $"{pair.Value}");
switch (pair.Value)
{
@@ -181,10 +181,10 @@ private void WriteState(CompilationContext context, StringWriter output, State s
gotoStmts[doAct.Trigger.Name].UnionWith(WriteStmt(stmt));
}
break;
-
+
}
}
-
+
//Writes out all the Go-To Statements collected within a state into the code.
if (gotoStmts.Any())
{
diff --git a/Src/PCompiler/CompilerCore/Backend/Symbolic/CompilationContext.cs b/Src/PCompiler/CompilerCore/Backend/Symbolic/CompilationContext.cs
index 4dda3ab55..84944ef9c 100644
--- a/Src/PCompiler/CompilerCore/Backend/Symbolic/CompilationContext.cs
+++ b/Src/PCompiler/CompilerCore/Backend/Symbolic/CompilationContext.cs
@@ -133,7 +133,7 @@ internal void WriteCommaSeparated(TextWriter output, IEnumerable items, Ac
needComma = true;
}
}
-
+
private static bool IsAsciiAlphabetic(char c)
{
return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z');
diff --git a/Src/PCompiler/CompilerCore/Backend/Symbolic/Constants.cs b/Src/PCompiler/CompilerCore/Backend/Symbolic/Constants.cs
index c94f55d0a..f16b74c82 100644
--- a/Src/PCompiler/CompilerCore/Backend/Symbolic/Constants.cs
+++ b/Src/PCompiler/CompilerCore/Backend/Symbolic/Constants.cs
@@ -82,7 +82,7 @@ internal class Constants
";
-
+
internal static readonly string pomForeignTemplate =
@"
diff --git a/Src/PCompiler/CompilerCore/Backend/Symbolic/Continuation.cs b/Src/PCompiler/CompilerCore/Backend/Symbolic/Continuation.cs
index 304032688..56df9df64 100644
--- a/Src/PCompiler/CompilerCore/Backend/Symbolic/Continuation.cs
+++ b/Src/PCompiler/CompilerCore/Backend/Symbolic/Continuation.cs
@@ -30,7 +30,7 @@ public void AddParameter(Variable local, Variable store)
}
public IReadOnlyDictionary Cases { get; }
- public IPStmt After { get; }
+ public IPStmt After { get; }
public IEnumerable StoreParameters => storeParameters;
public IEnumerable LocalParameters => localParameters;
public IEnumerable StoreStmts => storeStmts;
diff --git a/Src/PCompiler/CompilerCore/Backend/Symbolic/ReceiveSplitStmt.cs b/Src/PCompiler/CompilerCore/Backend/Symbolic/ReceiveSplitStmt.cs
index 338048dfa..60ccab534 100644
--- a/Src/PCompiler/CompilerCore/Backend/Symbolic/ReceiveSplitStmt.cs
+++ b/Src/PCompiler/CompilerCore/Backend/Symbolic/ReceiveSplitStmt.cs
@@ -11,7 +11,7 @@ public ReceiveSplitStmt(ParserRuleContext location, Continuation continuation)
Cont = continuation;
}
- public Continuation Cont { get; }
+ public Continuation Cont { get; }
public ParserRuleContext SourceLocation { get; }
}
}
\ No newline at end of file
diff --git a/Src/PCompiler/CompilerCore/Backend/Symbolic/SymbolicCodeGenerator.cs b/Src/PCompiler/CompilerCore/Backend/Symbolic/SymbolicCodeGenerator.cs
index b8e0fc169..9b4ef08a2 100644
--- a/Src/PCompiler/CompilerCore/Backend/Symbolic/SymbolicCodeGenerator.cs
+++ b/Src/PCompiler/CompilerCore/Backend/Symbolic/SymbolicCodeGenerator.cs
@@ -34,11 +34,11 @@ public void Compile(ICompilerConfiguration job)
var pomPath = Path.Combine(job.OutputDirectory.FullName, "pom.xml");
var stdout = "";
var stderr = "";
-
+
// create the pom.xml file
var pomTemplate = Constants.pomTemplate;
pomTemplate = pomTemplate.Replace("-project-name-",job.ProjectName);
-
+
string foreignInclude = "";
var foreignFiles = job.InputForeignFiles.Where(x => x.EndsWith(".java"));
if (foreignFiles.Any())
@@ -62,7 +62,7 @@ public void Compile(ICompilerConfiguration job)
foreignInclude = foreignInclude.Replace("-foreign-source-include-", foreignSourceInclude);
}
pomTemplate = pomTemplate.Replace("-foreign-include-", foreignInclude);
-
+
File.WriteAllText(pomPath, pomTemplate);
// compile the csproj file
@@ -214,7 +214,7 @@ private void WriteMainDriver(CompilationContext context, StringWriter output, Sc
if ((decl is SafetyTest) && (context.GetNameForDecl(decl) == "DefaultImpl"))
return;
}
-
+
context.WriteLine(output, "@Generated");
context.WriteLine(output, "public static class DefaultImpl extends PTestDriver {");
WriteDriver(context, output, mainMachine.Name, decls);
@@ -1506,7 +1506,7 @@ private string GetInlineCastPrefix(PLanguageType valueType, PLanguageType locati
{
return "";
}
-
+
var valueIsMachineRef = valueType.IsSameTypeAs(PrimitiveType.Machine) || valueType is PermissionType;
var locationIsMachineRef = locationType.IsSameTypeAs(PrimitiveType.Machine) || locationType is PermissionType;
@@ -2557,11 +2557,11 @@ private string GetConcreteBoxedType(PLanguageType type)
return $"{typeDefType.CanonicalRepresentation}";
case ForeignType foreignType:
return $"{foreignType.CanonicalRepresentation}";
- case NamedTupleType _:
+ case NamedTupleType _:
return "String";
- case TupleType _:
+ case TupleType _:
return "String";
- case EnumType _:
+ case EnumType _:
return "Integer";
default:
return "Object";
diff --git a/Src/PCompiler/CompilerCore/Backend/Symbolic/TransformASTPass.cs b/Src/PCompiler/CompilerCore/Backend/Symbolic/TransformASTPass.cs
index a71431acb..aeebf23e2 100644
--- a/Src/PCompiler/CompilerCore/Backend/Symbolic/TransformASTPass.cs
+++ b/Src/PCompiler/CompilerCore/Backend/Symbolic/TransformASTPass.cs
@@ -12,7 +12,7 @@
namespace Plang.Compiler.Backend.Symbolic
{
- class TransformASTPass
+ class TransformASTPass
{
static private int continuationNumber = 0;
@@ -56,7 +56,7 @@ static private IPDecl TransformDecl(IPDecl decl)
case Machine machine:
if (machine.Receives.Events.GetEnumerator().MoveNext())
return TransformMachine(machine);
- else return machine;
+ else return machine;
default:
return decl;
}
@@ -112,7 +112,7 @@ static private Machine TransformMachine(Machine machine)
{
transformedMachine.AddState(TransformState(state, functionMap));
}
-
+
foreach (var method in machine.Methods)
{
if (!requiredMethods.Contains(method))
@@ -138,7 +138,7 @@ static private State TransformState(State state, IDictionary
if (state.Exit != null)
transformedState.Exit = functionMap[state.Exit];
transformedState.OwningMachine = state.OwningMachine;
-
+
foreach (var handler in state.AllEventHandlers)
{
if (handler.Key.IsNullEvent)
@@ -206,10 +206,10 @@ static private List ReplaceReturn(IReadOnlyList body, IPExpr loc
switch (stmt)
{
case ReturnStmt returnStmt:
- newBody.Add(new AssignStmt(returnStmt.SourceLocation, location, returnStmt.ReturnValue));
+ newBody.Add(new AssignStmt(returnStmt.SourceLocation, location, returnStmt.ReturnValue));
break;
case CompoundStmt compoundStmt:
- var replace = ReplaceReturn(compoundStmt.Statements, location);
+ var replace = ReplaceReturn(compoundStmt.Statements, location);
foreach (var statement in replace) newBody.Add(statement);
break;
case IfStmt ifStmt:
@@ -222,7 +222,7 @@ static private List ReplaceReturn(IReadOnlyList body, IPExpr loc
IPStmt elseStmt = null;
if (ifStmt.ElseBranch != null)
{
- var replaceElse = ReplaceReturn(ifStmt.ElseBranch.Statements, location);
+ var replaceElse = ReplaceReturn(ifStmt.ElseBranch.Statements, location);
elseStmt = new CompoundStmt(ifStmt.ElseBranch.SourceLocation, replaceElse);
}
newBody.Add(new IfStmt(ifStmt.SourceLocation, ifStmt.Condition, thenStmt, elseStmt));
@@ -238,17 +238,17 @@ static private List ReplaceReturn(IReadOnlyList body, IPExpr loc
case WhileStmt whileStmt:
var bodyList = new List();
bodyList.Add(whileStmt.Body);
- var replaceWhile = ReplaceReturn(bodyList, location);
+ var replaceWhile = ReplaceReturn(bodyList, location);
newBody.Add(new WhileStmt(whileStmt.SourceLocation, whileStmt.Condition, new CompoundStmt(whileStmt.Body.SourceLocation, replaceWhile)));
break;
- default:
+ default:
newBody.Add(stmt);
break;
}
}
return newBody;
}
-
+
static private void InlineStmt(Function function, IPStmt stmt, List body)
{
switch (stmt)
@@ -566,7 +566,7 @@ static private IPStmt HandleReceives(IPStmt statement, Function function, Machin
while (enumerator.MoveNext())
{
afterStmts.Add(enumerator.Current);
- }
+ }
CompoundStmt after = null;
if (afterStmts.Count > 0)
{
@@ -725,7 +725,7 @@ static private IPStmt HandleReceives(IPStmt statement, Function function, Machin
var loopBody = new List();
var bodyEnumerator = loop.Body.Statements.GetEnumerator();
while (bodyEnumerator.MoveNext())
- {
+ {
var stmt = bodyEnumerator.Current;
var replaceBreak = ReplaceBreaks(stmt, afterStmts);
if (replaceBreak != null) {
@@ -774,7 +774,7 @@ static private IPStmt HandleReceives(IPStmt statement, Function function, Machin
return statement;
}
}
-
+
static private Continuation GetContinuation(Function function, IDictionary cases, IPStmt after, ParserRuleContext location)
{
var continuationName = $"continuation_{continuationNumber}";
diff --git a/Src/PCompiler/CompilerCore/Compiler.cs b/Src/PCompiler/CompilerCore/Compiler.cs
index df98ce57e..99e94c02b 100644
--- a/Src/PCompiler/CompilerCore/Compiler.cs
+++ b/Src/PCompiler/CompilerCore/Compiler.cs
@@ -14,7 +14,7 @@ public class Compiler : ICompiler
public int Compile(ICompilerConfiguration job)
{
job.Output.WriteInfo($"Parsing ...");
-
+
// Run parser on every input file
PParser.ProgramContext[] trees = null;
try
@@ -59,7 +59,7 @@ public int Compile(ICompilerConfiguration job)
job.OutputDirectory = Directory.CreateDirectory(Path.Combine(parentDirectory.FullName, entry.ToString()));
job.Output = new DefaultCompilerOutput(job.OutputDirectory);
job.Backend = TargetLanguage.GetCodeGenerator(entry);
-
+
job.Output.WriteInfo($"----------------------------------------");
job.Output.WriteInfo($"Code generation for {entry}...");
@@ -96,7 +96,7 @@ public int Compile(ICompilerConfiguration job)
job.Output.WriteInfo($"----------------------------------------");
job.Output.WriteInfo($"Compilation succeeded.");
-
+
Environment.ExitCode = 0;
return Environment.ExitCode;
}
diff --git a/Src/PCompiler/CompilerCore/CompilerConfiguration.cs b/Src/PCompiler/CompilerCore/CompilerConfiguration.cs
index 09423c90b..7c6c4db1a 100644
--- a/Src/PCompiler/CompilerCore/CompilerConfiguration.cs
+++ b/Src/PCompiler/CompilerCore/CompilerConfiguration.cs
@@ -58,7 +58,7 @@ public CompilerConfiguration(ICompilerOutput output, DirectoryInfo outputDir, IL
ProjectDependencies = projectDependencies ?? new List();
Debug = debug;
}
-
+
public ICompilerOutput Output { get; set; }
public DirectoryInfo OutputDirectory { get; set; }
public IList OutputLanguages { get; set; }
diff --git a/Src/PCompiler/CompilerCore/DefaultTranslationErrorHandler.cs b/Src/PCompiler/CompilerCore/DefaultTranslationErrorHandler.cs
index b6e033a84..ccacf6fcf 100644
--- a/Src/PCompiler/CompilerCore/DefaultTranslationErrorHandler.cs
+++ b/Src/PCompiler/CompilerCore/DefaultTranslationErrorHandler.cs
@@ -78,12 +78,12 @@ public Exception IllegalTypeInCoerceExpr(ParserRuleContext location)
{
return IssueError(location, "expected an interface or int or float type");
}
-
+
public Exception NoMainOrTestCase(string message)
{
return new TranslationException(message);
}
-
+
public Exception IllegalInterfaceCoerce(ParserRuleContext context, PLanguageType oldType, PLanguageType newType)
{
var outlierEvent =
diff --git a/Src/PCompiler/CompilerCore/ITranslationErrorHandler.cs b/Src/PCompiler/CompilerCore/ITranslationErrorHandler.cs
index 962666ff0..00e12c244 100644
--- a/Src/PCompiler/CompilerCore/ITranslationErrorHandler.cs
+++ b/Src/PCompiler/CompilerCore/ITranslationErrorHandler.cs
@@ -95,14 +95,14 @@ Exception DuplicateStartState(
Exception RaiseEventInNonVoidFunction(ParserRuleContext context);
Exception ChangeStateInNonVoidFunction(ParserRuleContext context);
-
+
Exception DuplicateReceiveCase(ParserRuleContext location, PEvent pEvent);
Exception NoMain(ParserRuleContext sourceLocation, string v);
-
+
Exception NoMainOrTestCase(string v);
-
+
Exception IllegalTypeInCoerceExpr(ParserRuleContext context);
Exception IllegalInterfaceCoerce(ParserRuleContext context, PLanguageType oldType, PLanguageType newType);
diff --git a/Src/PCompiler/CompilerCore/Parser/PParser.g4 b/Src/PCompiler/CompilerCore/Parser/PParser.g4
index fd78b82ed..dc00fca47 100644
--- a/Src/PCompiler/CompilerCore/Parser/PParser.g4
+++ b/Src/PCompiler/CompilerCore/Parser/PParser.g4
@@ -3,7 +3,7 @@ options { tokenVocab=PLexer; }
// A small overview of ANTLRs parser rules:
//
-// Parser rules begin with a lower case letter, lexer rules begin
+// Parser rules begin with a lower case letter, lexer rules begin
// with an Uppercase letter. To create a parser rule, write the name
// followed by a colon (:) and then a list of alternatives, separated
// by pipe (|) characters. You can use parenthesis for sub-expressions,
@@ -142,14 +142,14 @@ statement : LBRACE statement* RBRACE # CompoundStmt
| lvalue INSERT LPAREN rvalue RPAREN SEMI # AddStmt
| lvalue REMOVE expr SEMI # RemoveStmt
| WHILE LPAREN expr RPAREN statement # WhileStmt
- | FOREACH LPAREN item=iden IN collection=expr
+ | FOREACH LPAREN item=iden IN collection=expr
RPAREN statement # ForeachStmt
- | IF LPAREN expr RPAREN thenBranch=statement
+ | IF LPAREN expr RPAREN thenBranch=statement
(ELSE elseBranch=statement)? # IfStmt
| NEW iden LPAREN rvalueList? RPAREN SEMI # CtorStmt
| fun=iden LPAREN rvalueList? RPAREN SEMI # FunCallStmt
| RAISE expr (COMMA rvalueList)? SEMI # RaiseStmt
- | SEND machine=expr COMMA event=expr
+ | SEND machine=expr COMMA event=expr
(COMMA rvalueList)? SEMI # SendStmt
| ANNOUNCE expr (COMMA rvalueList)? SEMI # AnnounceStmt
| GOTO stateName (COMMA rvalueList)? SEMI # GotoStmt
@@ -178,7 +178,7 @@ expr : primitive # PrimitiveExpr
| fun=VALUES LPAREN expr RPAREN # KeywordExpr
| fun=SIZEOF LPAREN expr RPAREN # KeywordExpr
| fun=DEFAULT LPAREN type RPAREN # KeywordExpr
- | NEW interfaceName=iden
+ | NEW interfaceName=iden
LPAREN rvalueList? RPAREN # CtorExpr
| fun=iden LPAREN rvalueList? RPAREN # FunCallExpr
| op=(SUB | LNOT) expr # UnaryExpr
@@ -194,8 +194,8 @@ expr : primitive # PrimitiveExpr
;
formatedString : StringLiteral
- | FORMAT LPAREN StringLiteral (COMMA rvalueList)? RPAREN
- ;
+ | FORMAT LPAREN StringLiteral (COMMA rvalueList)? RPAREN
+ ;
primitive : iden
| floatLiteral
diff --git a/Src/PCompiler/CompilerCore/TypeChecker/AST/Declarations/Function.cs b/Src/PCompiler/CompilerCore/TypeChecker/AST/Declarations/Function.cs
index 6126941ce..c30a91299 100644
--- a/Src/PCompiler/CompilerCore/TypeChecker/AST/Declarations/Function.cs
+++ b/Src/PCompiler/CompilerCore/TypeChecker/AST/Declarations/Function.cs
@@ -96,9 +96,9 @@ public void RemoveCallee(Function callee)
public bool? CanChangeState { get; set; }
public bool? CanRaiseEvent { get; set; }
public bool? CanReceive { get; set; }
-
+
public bool? CanSend { get; set; }
-
+
public bool? CanCreate { get; set; }
public bool? IsNondeterministic { get; set; }
diff --git a/Src/PCompiler/CompilerCore/TypeChecker/Analyzer.cs b/Src/PCompiler/CompilerCore/TypeChecker/Analyzer.cs
index 14230beed..050be18cc 100644
--- a/Src/PCompiler/CompilerCore/TypeChecker/Analyzer.cs
+++ b/Src/PCompiler/CompilerCore/TypeChecker/Analyzer.cs
@@ -13,7 +13,7 @@ public static Scope AnalyzeCompilationUnit(ICompilerConfiguration config,
params PParser.ProgramContext[] programUnits)
{
var handler = config.Handler;
-
+
// Step 1: Build the global scope of declarations
var globalScope = BuildGlobalScope(config, programUnits);
@@ -61,7 +61,7 @@ public static Scope AnalyzeCompilationUnit(ICompilerConfiguration config,
{
throw handler.IllegalFunctionUsedInSpecMachine(function, function.Owner);
}
-
+
// A static function if it has side effects or is non-deterministic then it cannot be called from a spec machine
if (function.Owner == null && (function.IsNondeterministic == true || function.CanCreate == true || function.CanSend == true|| function.CanReceive == true))
{
diff --git a/Src/PCompiler/CompilerCore/TypeChecker/ControlFlowChecker.cs b/Src/PCompiler/CompilerCore/TypeChecker/ControlFlowChecker.cs
index 25baac82a..ea0900293 100644
--- a/Src/PCompiler/CompilerCore/TypeChecker/ControlFlowChecker.cs
+++ b/Src/PCompiler/CompilerCore/TypeChecker/ControlFlowChecker.cs
@@ -66,7 +66,7 @@ private void CheckStmt(IPStmt stmt)
break;
case ForeachStmt _:
break;
-
+
// None of the following statement types can contain child statements, so we can safely skip them
case AddStmt _:
case AnnounceStmt _:
diff --git a/Src/PCompiler/CompilerCore/TypeChecker/DeclarationStubVisitor.cs b/Src/PCompiler/CompilerCore/TypeChecker/DeclarationStubVisitor.cs
index d1955be79..77782e730 100644
--- a/Src/PCompiler/CompilerCore/TypeChecker/DeclarationStubVisitor.cs
+++ b/Src/PCompiler/CompilerCore/TypeChecker/DeclarationStubVisitor.cs
@@ -369,7 +369,7 @@ public override object VisitNoStmt(PParser.NoStmtContext context)
{
return null;
}
-
+
public override object VisitGotoStmt(PParser.GotoStmtContext context)
{
diff --git a/Src/PCompiler/CompilerCore/TypeChecker/DeclarationVisitor.cs b/Src/PCompiler/CompilerCore/TypeChecker/DeclarationVisitor.cs
index 52752a04b..b726380da 100644
--- a/Src/PCompiler/CompilerCore/TypeChecker/DeclarationVisitor.cs
+++ b/Src/PCompiler/CompilerCore/TypeChecker/DeclarationVisitor.cs
@@ -58,7 +58,7 @@ public override object VisitEventDecl(PParser.EventDeclContext context)
// (COLON type)?
pEvent.PayloadType = ResolveType(context.type());
- // SEMI
+ // SEMI
return pEvent;
}
@@ -147,7 +147,7 @@ private State FindState(PParser.StateNameContext context)
public override object VisitForeignTypeDef(PParser.ForeignTypeDefContext context)
{
- // TYPE name=iden
+ // TYPE name=iden
var typedef = (TypeDef) nodesToDeclarations.Get(context);
// SEMI
typedef.Type = new ForeignType(typedef.Name);
@@ -156,9 +156,9 @@ public override object VisitForeignTypeDef(PParser.ForeignTypeDefContext context
public override object VisitPTypeDef(PParser.PTypeDefContext context)
{
- // TYPE name=iden
+ // TYPE name=iden
var typedef = (TypeDef) nodesToDeclarations.Get(context);
- // ASSIGN type
+ // ASSIGN type
typedef.Type = ResolveType(context.type());
// SEMI
return typedef;
@@ -230,9 +230,9 @@ public override object VisitNumberedEnumElem(PParser.NumberedEnumElemContext con
public override object VisitEventSetDecl(PParser.EventSetDeclContext context)
{
- // EVENTSET name=iden
+ // EVENTSET name=iden
var es = (NamedEventSet) nodesToDeclarations.Get(context);
- // ASSIGN LBRACE eventSetLiteral RBRACE
+ // ASSIGN LBRACE eventSetLiteral RBRACE
es.AddEvents((PEvent[]) Visit(context.eventSetLiteral()));
// SEMI
return es;
@@ -259,10 +259,10 @@ public override object VisitNonDefaultEvent(PParser.NonDefaultEventContext conte
public override object VisitImplMachineDecl(PParser.ImplMachineDeclContext context)
{
- // MACHINE name=iden
+ // MACHINE name=iden
var machine = (Machine) nodesToDeclarations.Get(context);
- // cardinality?
+ // cardinality?
var hasAssume = context.cardinality()?.ASSUME() != null;
var hasAssert = context.cardinality()?.ASSERT() != null;
var cardinality = long.Parse(context.cardinality()?.IntLiteral().GetText() ?? "-1");
@@ -328,7 +328,7 @@ public override object VisitMachineSend(PParser.MachineSendContext context)
public override object VisitSpecMachineDecl(PParser.SpecMachineDeclContext context)
{
- // SPEC name=Iden
+ // SPEC name=Iden
var specMachine = (Machine) nodesToDeclarations.Get(context);
// spec machines neither send nor receive events.
@@ -404,7 +404,7 @@ public override object VisitStateDecl(PParser.StateDeclContext context)
var state = (State) nodesToDeclarations.Get(context);
state.OwningMachine = CurrentMachine;
- // START?
+ // START?
state.IsStart = context.START() != null;
// temperature=(HOT | COLD)?
@@ -562,7 +562,7 @@ public override object VisitOnEventDoAction(PParser.OnEventDoActionContext conte
return actions.ToArray();
}
-
+
public override object VisitOnEventGotoState(PParser.OnEventGotoStateContext context)
{
@@ -587,7 +587,7 @@ public override object VisitOnEventGotoState(PParser.OnEventGotoStateContext con
transitionFunction = null;
}
- // GOTO stateName
+ // GOTO stateName
var target = FindState(context.stateName());
// ON eventList
@@ -644,7 +644,7 @@ public override object VisitForeignFunDecl(PParser.ForeignFunDeclContext context
// no function body
fun.Role |= FunctionRole.Foreign;
- // Creates
+ // Creates
foreach(var createdInterface in context._interfaces)
{
if (CurrentScope.Lookup(createdInterface.GetText(), out Interface @interface))
diff --git a/Src/PCompiler/CompilerCore/TypeChecker/ExprVisitor.cs b/Src/PCompiler/CompilerCore/TypeChecker/ExprVisitor.cs
index 0ca0b8a23..bd63b504d 100644
--- a/Src/PCompiler/CompilerCore/TypeChecker/ExprVisitor.cs
+++ b/Src/PCompiler/CompilerCore/TypeChecker/ExprVisitor.cs
@@ -96,15 +96,15 @@ public override IPExpr VisitSeqAccessExpr(PParser.SeqAccessExprContext context)
{
throw handler.TypeMismatch(context.index, indexExpr.Type, mapType.KeyType);
}
-
+
return new MapAccessExpr(context, seqOrMap, indexExpr, mapType.ValueType);
-
+
case SetType setType:
if (!PrimitiveType.Int.IsAssignableFrom(indexExpr.Type))
{
throw handler.TypeMismatch(context.index, indexExpr.Type, PrimitiveType.Int);
}
-
+
return new SetAccessExpr(context, seqOrMap, indexExpr, setType.ElementType);
}
@@ -172,9 +172,9 @@ public override IPExpr VisitCtorExpr(PParser.CtorExprContext context)
var arguments = TypeCheckingUtils.VisitRvalueList(context.rvalueList(), this).ToArray();
TypeCheckingUtils.ValidatePayloadTypes(handler, context, @interface.PayloadType, arguments);
-
+
method.CanCreate = true;
-
+
return new CtorExpr(context, @interface, arguments);
}
@@ -203,7 +203,7 @@ public override IPExpr VisitFunCallExpr(PParser.FunCallExprContext context)
{
throw handler.TypeMismatch(context.rvalueList().rvalue(i), argument.Type, paramType);
}
-
+
}
method.AddCallee(function);
@@ -310,7 +310,7 @@ public override IPExpr VisitBinExpr(PParser.BinExprContext context)
{
return arithCtors[op](lhs, rhs);
}
- throw handler.IncomparableTypes(context, lhs.Type, rhs.Type);
+ throw handler.IncomparableTypes(context, lhs.Type, rhs.Type);
case "in":
var rhsType = rhs.Type.Canonicalize();
if (rhsType is MapType rhsMap)
@@ -388,17 +388,17 @@ public override IPExpr VisitChooseExpr(PParser.ChooseExprContext context)
case SetType setType:
return new ChooseExpr(context, subExpr, setType.ElementType);
-
+
case MapType mapType:
return new ChooseExpr(context, subExpr, mapType.KeyType);
-
+
case PrimitiveType primType when primType.IsSameTypeAs(PrimitiveType.Int):
return new ChooseExpr(context, subExpr, PrimitiveType.Int);
-
+
default:
throw handler.IllegalChooseSubExprType(context, subExprType);
}
-
+
}
public override IPExpr VisitCastExpr(PParser.CastExprContext context)
diff --git a/Src/PCompiler/CompilerCore/TypeChecker/InferMachineCreates.cs b/Src/PCompiler/CompilerCore/TypeChecker/InferMachineCreates.cs
index eeb4998e6..bb8e43493 100644
--- a/Src/PCompiler/CompilerCore/TypeChecker/InferMachineCreates.cs
+++ b/Src/PCompiler/CompilerCore/TypeChecker/InferMachineCreates.cs
@@ -37,9 +37,9 @@ private static IEnumerable InferCreates(IPAST tree, ITranslationError
}
if(_visitedFunctions.Contains(function))
return Enumerable.Empty();
- else
+ else
_visitedFunctions.Add(function);
-
+
return InferCreates(function.Body, handler);
case AddStmt addStmt:
@@ -115,11 +115,11 @@ private static IEnumerable InferCreates(IPAST tree, ITranslationError
return InferCreatesForExpr(sendStmt.MachineExpr, handler)
.Union(InferCreatesForExpr(sendStmt.Evt, handler))
.Union(sendStmt.Arguments.SelectMany(expr => InferCreatesForExpr(expr, handler)));
-
+
case ForeachStmt foreachStmt:
return InferCreatesForExpr(foreachStmt.IterCollection, handler)
.Union(InferCreates(foreachStmt.Body, handler));
-
+
case WhileStmt whileStmt:
return InferCreatesForExpr(whileStmt.Condition, handler)
.Union(InferCreates(whileStmt.Body, handler));
@@ -175,11 +175,11 @@ private static IEnumerable InferCreatesForExpr(IPExpr expr, ITranslat
case SeqAccessExpr seqAccessExpr:
return InferCreatesForExpr(seqAccessExpr.SeqExpr, handler)
.Union(InferCreatesForExpr(seqAccessExpr.IndexExpr, handler));
-
+
case SetAccessExpr setAccessExpr:
return InferCreatesForExpr(setAccessExpr.SetExpr, handler)
.Union(InferCreatesForExpr(setAccessExpr.IndexExpr, handler));
-
+
case SizeofExpr sizeofExpr:
return InferCreatesForExpr(sizeofExpr.Expr, handler);
diff --git a/Src/PCompiler/CompilerCore/TypeChecker/ModuleExprVisitor.cs b/Src/PCompiler/CompilerCore/TypeChecker/ModuleExprVisitor.cs
index cfaf1dbe9..cba686404 100644
--- a/Src/PCompiler/CompilerCore/TypeChecker/ModuleExprVisitor.cs
+++ b/Src/PCompiler/CompilerCore/TypeChecker/ModuleExprVisitor.cs
@@ -50,7 +50,7 @@ public static void PopulateAllModuleExprs(
else if (!globalScope.SafetyTests.Any())
{
if (globalScope.Machines.All(m => m.Name != "Main")) return;
-
+
var defaultImplDecl = new Implementation(ParserRuleContext.EmptyContext, "DefaultImpl")
{
Main = "Main"
diff --git a/Src/PCompiler/CompilerCore/TypeChecker/Scope.cs b/Src/PCompiler/CompilerCore/TypeChecker/Scope.cs
index f41958ade..fed805c40 100644
--- a/Src/PCompiler/CompilerCore/TypeChecker/Scope.cs
+++ b/Src/PCompiler/CompilerCore/TypeChecker/Scope.cs
@@ -114,7 +114,7 @@ public void AddDefaultImpl(Implementation defaultImplDecl)
implementations.Add(defaultImplDecl.Name, defaultImplDecl);
}
#endregion Add Default Impl. Declaration
-
+
#region Add Tuple Declaration
public bool AddTuple(TupleType tuple)
{
@@ -173,7 +173,7 @@ public bool Get(string name, out State tree)
{
return states.TryGetValue(name, out tree);
}
-
+
public bool Get(string name, out TypeDef tree)
{
return typedefs.TryGetValue(name, out tree);
@@ -605,10 +605,10 @@ public SafetyTest Put(string name, PParser.SafetyTestDeclContext tree)
{
if (filePath.StartsWith(dependencyPath))
{
- return null;
+ return null;
}
}
-
+
var safetyTest = new SafetyTest(tree, name);
CheckConflicts(safetyTest,
Namespace(implementations),
diff --git a/Src/PCompiler/CompilerCore/TypeChecker/StatementVisitor.cs b/Src/PCompiler/CompilerCore/TypeChecker/StatementVisitor.cs
index 388c52d4e..ba3e83895 100644
--- a/Src/PCompiler/CompilerCore/TypeChecker/StatementVisitor.cs
+++ b/Src/PCompiler/CompilerCore/TypeChecker/StatementVisitor.cs
@@ -40,7 +40,7 @@ public override IPStmt VisitCompoundStmt(PParser.CompoundStmtContext context)
var statements = context.statement().Select(Visit).ToList();
return new CompoundStmt(context, statements);
}
-
+
public override IPStmt VisitAssertStmt(PParser.AssertStmtContext context)
{
var assertion = exprVisitor.Visit(context.assertion);
@@ -60,7 +60,7 @@ public override IPStmt VisitAssertStmt(PParser.AssertStmtContext context)
assertMessage = new StringExpr(message.SourceLocation, "{0} {1}",new List() {assertMessage,
message});
}
-
+
return new AssertStmt(context, assertion, assertMessage);
}
@@ -114,7 +114,7 @@ public override IPStmt VisitAddStmt(PParser.AddStmtContext context)
{
var variable = exprVisitor.Visit(context.lvalue());
var value = exprVisitor.Visit(context.rvalue());
-
+
// Check subtyping
var valueType = value.Type;
@@ -212,7 +212,7 @@ public override IPStmt VisitRemoveStmt(PParser.RemoveStmtContext context)
return new RemoveStmt(context, variable, value);
}
-
+
public override IPStmt VisitWhileStmt(PParser.WhileStmtContext context)
{
var condition = exprVisitor.Visit(context.expr());
@@ -233,14 +233,14 @@ public override IPStmt VisitForeachStmt(PParser.ForeachStmtContext context)
throw handler.MissingDeclaration(context.item, "foreach iterator variable", varName);
}
var collection = exprVisitor.Visit(context.collection);
-
+
// make sure that foreach is applied to either sequence or set type
-
+
// Check subtyping
var itemType = var.Type;
PLanguageType expectedItemType;
-
+
switch (collection.Type.Canonicalize())
{
case SetType setType:
@@ -374,7 +374,7 @@ public override IPStmt VisitSendStmt(PParser.SendStmtContext context)
}
method.CanSend = true;
-
+
return new SendStmt(context, machineExpr, evtExpr, args);
}
@@ -402,14 +402,14 @@ public override IPStmt VisitAnnounceStmt(PParser.AnnounceStmtContext context)
}
method.CanSend = true;
-
+
var args = TypeCheckingUtils.VisitRvalueList(context.rvalueList(), exprVisitor).ToList();
if (evtExpr is EventRefExpr eventRef)
{
TypeCheckingUtils.ValidatePayloadTypes(handler, context, eventRef.Value.PayloadType, args);
}
-
+
return new AnnounceStmt(context, evtExpr, args.Count == 0 ? null : args[0]);
}
@@ -474,7 +474,7 @@ public override IPStmt VisitReceiveStmt(PParser.ReceiveStmtContext context)
var cases = new Dictionary();
foreach (var caseContext in context.recvCase())
{
-
+
foreach (var eventIdContext in caseContext.eventList().eventId())
{
@@ -496,7 +496,7 @@ public override IPStmt VisitReceiveStmt(PParser.ReceiveStmtContext context)
}
FunctionBodyVisitor.PopulateMethod(config, recvHandler);
-
+
if (!table.Lookup(eventIdContext.GetText(), out PEvent pEvent))
{
throw handler.MissingDeclaration(eventIdContext, "event", eventIdContext.GetText());
diff --git a/Src/PCompiler/PCommandLine/CommandLine.cs b/Src/PCompiler/PCommandLine/CommandLine.cs
index b5b4fc7fc..5fc655fe0 100644
--- a/Src/PCompiler/PCommandLine/CommandLine.cs
+++ b/Src/PCompiler/PCommandLine/CommandLine.cs
@@ -125,7 +125,7 @@ private static void PrintException(Exception ex)
lock (ConsoleLock)
{
Error.Report($"[Internal Error]:\n {ex.Message}\n");
- Error.Report("[PTool] unhandled exception: {0}: {1}", ex.GetType().ToString(), ex.Message);
+ Error.Report("[PTool] unhandled exception: {0}: {1}\n Stack Trace: {2}", ex.GetType().ToString(), ex.Message, ex.StackTrace);
}
}
@@ -136,7 +136,7 @@ private static void Shutdown()
{
CommandLineOutput.WriteInfo("~~ [PTool]: Thanks for using P! ~~");
}
-
+
public static void RunCompiler(string[] args)
{
var configuration = new PCompilerOptions().Parse(args);
diff --git a/Src/PCompiler/PCommandLine/Options/PCheckerOptions.cs b/Src/PCompiler/PCommandLine/Options/PCheckerOptions.cs
index 266b41be9..aecd35de8 100644
--- a/Src/PCompiler/PCommandLine/Options/PCheckerOptions.cs
+++ b/Src/PCompiler/PCommandLine/Options/PCheckerOptions.cs
@@ -37,21 +37,21 @@ internal PCheckerOptions()
// basicOptions.AddArgument("smoke-testing", "tsmoke",
// "Smoke test the program by running the checker on all the test cases", typeof(bool));
basicOptions.AddArgument("list-tests", null, "List all test cases and exit.", typeof(bool));
-
+
var basicGroup = Parser.GetOrCreateGroup("Basic", "Basic options");
basicGroup.AddArgument("timeout", "t", "Timeout in seconds (disabled by default)", typeof(uint));
basicGroup.AddArgument("memout", null, "Memory limit in Giga bytes (disabled by default)", typeof(double)).IsHidden = true;
basicGroup.AddArgument("outdir", "o", "Dump output to directory (absolute or relative path)");
basicGroup.AddArgument("verbose", "v", "Enable verbose log output during exploration", typeof(bool));
basicGroup.AddArgument("debug", "d", "Enable debugging", typeof(bool)).IsHidden = true;
-
+
var exploreGroup = Parser.GetOrCreateGroup("explore", "Systematic exploration options");
exploreGroup.AddArgument("iterations", "i", "Number of schedules to explore", typeof(uint)).IsHidden = true;
exploreGroup.AddArgument("schedules", "s", "Number of schedules to explore", typeof(uint));
exploreGroup.AddArgument("max-steps", "ms", @"Max scheduling steps to be explored during systematic exploration (by default 10,000 unfair and 100,000 fair steps). You can provide one or two unsigned integer values", typeof(uint)).IsMultiValue = true;
exploreGroup.AddArgument("fail-on-maxsteps", null, "Consider it a bug if the test hits the specified max-steps", typeof(bool));
exploreGroup.AddArgument("liveness-temperature-threshold", null, "Specify the liveness temperature threshold is the liveness temperature value that triggers a liveness bug", typeof(uint)).IsHidden = true;
-
+
var schedulingGroup = Parser.GetOrCreateGroup("scheduling", "Search prioritization options");
schedulingGroup.AddArgument("sch-random", null, "Choose the random scheduling strategy (this is the default)", typeof(bool));
schedulingGroup.AddArgument("sch-probabilistic", "sp", "Choose the probabilistic scheduling strategy with given probability for each scheduling decision where the probability is " +
@@ -65,7 +65,7 @@ internal PCheckerOptions()
var replayOptions = Parser.GetOrCreateGroup("replay", "Replay and debug options");
replayOptions.AddArgument("replay", "r", "Schedule file to replay");
-
+
var advancedGroup = Parser.GetOrCreateGroup("advanced", "Advanced options");
advancedGroup.AddArgument("explore", null, "Keep testing until the bound (e.g. schedule or time) is reached", typeof(bool));
advancedGroup.AddArgument("seed", null, "Specify the random value generator seed", typeof(uint));
@@ -74,7 +74,7 @@ internal PCheckerOptions()
advancedGroup.AddArgument("xml-trace", null, "Specify a filename for XML runtime log output to be written to", typeof(bool));
advancedGroup.AddArgument("psym-args", null, "Specify a concatenated list of additional PSym-specific arguments to pass, each starting with a colon").IsHidden = true;
advancedGroup.AddArgument("jvm-args", null, "Specify a concatenated list of PSym-specific JVM arguments to pass, each starting with a colon").IsHidden = true;
-
+
}
///
@@ -92,7 +92,7 @@ internal CheckerConfiguration Parse(string[] args)
// load pproj file first
UpdateConfigurationWithPProjectFile(configuration, result);
-
+
foreach (var arg in result)
{
UpdateConfigurationWithParsedArgument(configuration, arg);
@@ -102,7 +102,7 @@ internal CheckerConfiguration Parse(string[] args)
FindLocalPCompiledFile(configuration);
SanitizeConfiguration(configuration);
-
+
}
catch (CommandLineException ex)
{
@@ -129,7 +129,7 @@ internal CheckerConfiguration Parse(string[] args)
private static void FindLocalPProject(List result)
{
// CommandLineOutput.WriteInfo(".. Searching for a P project file *.pproj locally in the current folder");
- var filtered =
+ var filtered =
from file in Directory.GetFiles(Directory.GetCurrentDirectory(), "*.pproj")
let info = new FileInfo(file)
where (((info.Attributes & FileAttributes.Hidden) ==0)& ((info.Attributes & FileAttributes.System)==0))
@@ -169,7 +169,7 @@ private static void UpdateConfigurationWithPProjectFile(CheckerConfiguration con
}
}
}
-
+
///
/// Updates the checkerConfiguration with the specified parsed argument.
///
@@ -356,11 +356,11 @@ private static void SanitizeConfiguration(CheckerConfiguration checkerConfigurat
{
Error.CheckerReportAndExit("For the option '--max-steps N[,M]', please make sure that M >= N.");
}
-
+
// the output directory correctly
checkerConfiguration.SetOutputDirectory();
}
-
+
private static void FindLocalPCompiledFile(CheckerConfiguration checkerConfiguration)
{
@@ -368,7 +368,7 @@ private static void FindLocalPCompiledFile(CheckerConfiguration checkerConfigura
{
CommandLineOutput.WriteInfo($".. Searching for a P compiled file locally in folder {checkerConfiguration.PCompiledPath}");
var pathSep = Path.DirectorySeparatorChar;
-
+
string filePattern = checkerConfiguration.Mode switch
{
CheckerMode.BugFinding => "*.dll",
@@ -377,13 +377,13 @@ private static void FindLocalPCompiledFile(CheckerConfiguration checkerConfigura
CheckerMode.Explicit => "*-jar-with-dependencies.jar",
_ => "*.dll"
};
-
+
var enumerationOptions = new EnumerationOptions();
enumerationOptions.RecurseSubdirectories = true;
enumerationOptions.MaxRecursionDepth = 3;
-
-
- var files =
+
+
+ var files =
from file in Directory.GetFiles(checkerConfiguration.PCompiledPath, filePattern, enumerationOptions)
let info = new FileInfo(file)
where (((info.Attributes & FileAttributes.Hidden) ==0)& ((info.Attributes & FileAttributes.System)==0))
@@ -395,7 +395,7 @@ from file in Directory.GetFiles(checkerConfiguration.PCompiledPath, filePattern,
{
if (!fileName.Contains($"CSharp{pathSep}"))
continue;
- if (fileName.EndsWith("PCheckerCore.dll")
+ if (fileName.EndsWith("PCheckerCore.dll")
|| fileName.EndsWith("PCSharpRuntime.dll")
|| fileName.EndsWith($"{pathSep}P.dll")
|| fileName.EndsWith($"{pathSep}p.dll"))
@@ -420,7 +420,7 @@ from file in Directory.GetFiles(checkerConfiguration.PCompiledPath, filePattern,
CommandLineOutput.WriteInfo($".. Found a P compiled file: {checkerConfiguration.AssemblyToBeAnalyzed}");
break;
}
-
+
if (checkerConfiguration.AssemblyToBeAnalyzed == string.Empty)
{
CommandLineOutput.WriteInfo(
@@ -429,6 +429,6 @@ from file in Directory.GetFiles(checkerConfiguration.PCompiledPath, filePattern,
}
}
}
-
+
}
}
\ No newline at end of file
diff --git a/Src/PCompiler/PCommandLine/Options/PCompilerOptions.cs b/Src/PCompiler/PCommandLine/Options/PCompilerOptions.cs
index ac9d32cf7..3b4fbfe37 100644
--- a/Src/PCompiler/PCommandLine/Options/PCompilerOptions.cs
+++ b/Src/PCompiler/PCommandLine/Options/PCompilerOptions.cs
@@ -24,9 +24,9 @@ internal PCompilerOptions()
"The P compiler compiles all the P files in the project together and generates the executable that can be checked for correctness by the P checker."
// + "\n\nCompiler modes :: (default: bugfinding)\n" +
// " --mode bugfinding : for bug finding through stratified random search\n" +
- // " --mode verification : for verification through exhaustive symbolic exploration\n" +
+ // " --mode verification : for verification through exhaustive symbolic exploration\n" +
// " --mode coverage : for achieving state-space coverage through exhaustive explicit-state search\n" +
- // " --mode pobserve : for runtime monitoring of P specs against implementation logs"
+ // " --mode pobserve : for runtime monitoring of P specs against implementation logs"
);
var projectGroup = Parser.GetOrCreateGroup("project", "Compiling using `.pproj` file");
@@ -62,13 +62,13 @@ internal CompilerConfiguration Parse(string[] args)
// load pproj file first
UpdateConfigurationWithPProjectFile(compilerConfiguration, result);
-
+
// load parsed arguments that can override pproj configuration
foreach (var arg in result)
{
UpdateConfigurationWithParsedArgument(compilerConfiguration, arg);
}
-
+
SanitizeConfiguration(compilerConfiguration);
}
catch (CommandLineException ex)
@@ -102,7 +102,7 @@ private static void FindLocalPProject(List result)
}
CommandLineOutput.WriteInfo(".. Searching for a P project file *.pproj locally in the current folder");
- var filtered =
+ var filtered =
from file in Directory.GetFiles(Directory.GetCurrentDirectory(), "*.pproj")
let info = new FileInfo(file)
where (((info.Attributes & FileAttributes.Hidden) ==0)& ((info.Attributes & FileAttributes.System)==0))
@@ -142,8 +142,8 @@ private static void UpdateConfigurationWithPProjectFile(CompilerConfiguration co
}
}
}
-
-
+
+
///
/// Updates the checkerConfiguration with the specified parsed argument.
///
@@ -243,7 +243,7 @@ private static void SanitizeConfiguration(CompilerConfiguration compilerConfigur
Error.CompilerReportAndExit($"Illegal P file name {fullPathName.FullName} (file name cannot have special characters) or file not found.");
}
}
-
+
if (!CheckFileValidity.IsLegalProjectName(compilerConfiguration.ProjectName))
{
Error.CompilerReportAndExit($"{compilerConfiguration.ProjectName} is not a legal project name");
@@ -255,7 +255,7 @@ private static void SanitizeConfiguration(CompilerConfiguration compilerConfigur
compilerConfiguration.Output = new DefaultCompilerOutput(compilerConfiguration.OutputDirectory);
}
}
-
+
private static void FindLocalPFiles(CompilerConfiguration compilerConfiguration)
{
@@ -266,8 +266,8 @@ private static void FindLocalPFiles(CompilerConfiguration compilerConfiguration)
var enumerationOptions = new EnumerationOptions();
enumerationOptions.RecurseSubdirectories = true;
enumerationOptions.MaxRecursionDepth = 1;
-
- var filtered =
+
+ var filtered =
from file in Directory.GetFiles(Directory.GetCurrentDirectory(), "*.p", enumerationOptions)
let info = new FileInfo(file)
where (((info.Attributes & FileAttributes.Hidden) ==0)& ((info.Attributes & FileAttributes.System)==0))
@@ -279,6 +279,6 @@ from file in Directory.GetFiles(Directory.GetCurrentDirectory(), "*.p", enumerat
}
}
}
-
+
}
}
\ No newline at end of file
diff --git a/Src/PCompiler/PCommandLine/Parser/ParsePProjectFile.cs b/Src/PCompiler/PCommandLine/Parser/ParsePProjectFile.cs
index 0a6736040..a13654ad2 100644
--- a/Src/PCompiler/PCommandLine/Parser/ParsePProjectFile.cs
+++ b/Src/PCompiler/PCommandLine/Parser/ParsePProjectFile.cs
@@ -49,7 +49,7 @@ public void ParseProjectFileForCompiler(string projectFile, out CompilerConfigur
// get output directory
var outputDirectory = GetOutputDirectory(projectFilePath);
-
+
// get targets
var outputLanguages = GetTargetLanguages(projectFilePath);
@@ -57,7 +57,7 @@ public void ParseProjectFileForCompiler(string projectFile, out CompilerConfigur
var pObservePackageName = GetPObservePackage(projectFilePath);
job = new CompilerConfiguration(output: new DefaultCompilerOutput(outputDirectory), outputDir: outputDirectory,
- outputLanguages: outputLanguages, inputFiles: inputFiles.ToList(), projectName: projectName,
+ outputLanguages: outputLanguages, inputFiles: inputFiles.ToList(), projectName: projectName,
projectRoot: projectFilePath.Directory, projectDependencies: projectDependencies.ToList(),
pObservePackageName: pObservePackageName);
@@ -100,7 +100,7 @@ public void ParseProjectFileForChecker(string projectFile, CheckerConfiguration
Error.ReportAndExit($":\n {other.Message}\n ");
}
}
-
+
///
/// Parse the P Project file and return all the input P files and project dependencies (includes transitive dependencies)
@@ -218,7 +218,7 @@ private IList GetTargetLanguages(FileInfo fullPathName)
}
else
{
- string[] values = projectXml.Element("Target")?.Value.Split(new[] { ',', ' ' },
+ string[] values = projectXml.Element("Target")?.Value.Split(new[] { ',', ' ' },
StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < values!.Length; i++)
{
@@ -257,7 +257,7 @@ private IList GetTargetLanguages(FileInfo fullPathName)
}
///
- /// Read all the input P files included in the pproj
+ /// Read all the input P files included in the pproj
///
/// Path to the pproj file
/// List of the all the P files included in the project
@@ -278,7 +278,7 @@ private HashSet ReadAllInputFiles(FileInfo fullPathName)
{
var enumerate = new EnumerationOptions();
enumerate.RecurseSubdirectories = true;
- var getFiles =
+ var getFiles =
from file in Directory.GetFiles(inputFileNameFull, "*.*", enumerate)
where ( CheckFileValidity.IsPFile(file) || CheckFileValidity.IsForeignFile(file))
let info = new FileInfo(file)
diff --git a/Src/PRuntimes/PCRuntime/API/PrtTypes.h b/Src/PRuntimes/PCRuntime/API/PrtTypes.h
index 32910e06a..b656560aa 100644
--- a/Src/PRuntimes/PCRuntime/API/PrtTypes.h
+++ b/Src/PRuntimes/PCRuntime/API/PrtTypes.h
@@ -123,9 +123,9 @@ extern "C" {
PRT_TYPE* innerType; /**< Inner type of the sequence */
} PRT_SETTYPE;
- /**
- * \struct
- * The layout for tuple types.
+ /**
+ * \struct
+ * The layout for tuple types.
*/
typedef struct PRT_TUPTYPE
{
diff --git a/Src/PRuntimes/PCRuntime/API/PrtValues.h b/Src/PRuntimes/PCRuntime/API/PrtValues.h
index d111cecd7..cc0e01e32 100644
--- a/Src/PRuntimes/PCRuntime/API/PrtValues.h
+++ b/Src/PRuntimes/PCRuntime/API/PrtValues.h
@@ -376,7 +376,7 @@ PRT_API PRT_UINT32 PRT_CALL_CONV PrtSetCapacity(_In_ PRT_VALUE* set);
*/
PRT_API PRT_MACHINEID PRT_CALL_CONV PrtPrimGetMachine(_In_ PRT_VALUE* prmVal);
- /** Concatenates two strings.
+ /** Concatenates two strings.
* @param[in] str1 first input string.
* @param[in] str2 second input string.
*/
diff --git a/Src/PRuntimes/PCRuntime/CMakeLists.txt b/Src/PRuntimes/PCRuntime/CMakeLists.txt
index 8add7ad4d..4969feacd 100644
--- a/Src/PRuntimes/PCRuntime/CMakeLists.txt
+++ b/Src/PRuntimes/PCRuntime/CMakeLists.txt
@@ -5,7 +5,7 @@ set ( LIBHANDLER_PATH ${P_Prt_Src_Path}/../../Ext/libhandler/)
set ( LIBHANDLERINC_PATH ${P_Prt_Src_Path}/../../Ext/libhandler/inc)
set ( LIBHANDLEROUT_PATH ${P_Prt_Src_Path}/../../Ext/libhandler/out)
-ADD_CUSTOM_TARGET(
+ADD_CUSTOM_TARGET(
libhandler
COMMAND ./configure
COMMAND make depend
diff --git a/Src/PRuntimes/PCRuntime/Core/PrtValues.c b/Src/PRuntimes/PCRuntime/Core/PrtValues.c
index 787f02197..97fe2d2f4 100644
--- a/Src/PRuntimes/PCRuntime/Core/PrtValues.c
+++ b/Src/PRuntimes/PCRuntime/Core/PrtValues.c
@@ -89,7 +89,7 @@ static PRT_UINT32 PRT_CALL_CONV PrtGetHashCodePrtString(_In_ PRT_STRING value)
}
PRT_UINT32 code = 5381;
int c;
- while (c = *value++)
+ while (c = *value++)
{
code = ((code << 5) + code) + c; /* code * 33 + c */
}
@@ -1608,7 +1608,7 @@ PRT_BOOLEAN PRT_CALL_CONV PrtIsEqualValue(_In_ PRT_VALUE* value1, _In_ PRT_VALUE
return
value1->valueUnion.ft == value2->valueUnion.ft ? PRT_TRUE : PRT_FALSE;
case PRT_VALUE_KIND_STRING:
- return
+ return
strcmp(value1->valueUnion.str, value2->valueUnion.str)==0 ? PRT_TRUE : PRT_FALSE;
case PRT_VALUE_KIND_FOREIGN:
{
@@ -1618,7 +1618,7 @@ PRT_BOOLEAN PRT_CALL_CONV PrtIsEqualValue(_In_ PRT_VALUE* value1, _In_ PRT_VALUE
? program->foreignTypes[fVal1->typeTag]->isEqualFun(fVal1->value, fVal2->value)
: PRT_FALSE;
}
- case PRT_VALUE_KIND_SET:
+ case PRT_VALUE_KIND_SET:
{
PRT_SETVALUE* uVal1 = value1->valueUnion.set;
PRT_SETVALUE* uVal2 = value2->valueUnion.set;
@@ -1731,7 +1731,7 @@ PRT_VALUE* PRT_CALL_CONV PrtCloneValue(_In_ PRT_VALUE* value)
return PrtMkIntValue(value->valueUnion.nt);
case PRT_VALUE_KIND_FLOAT:
return PrtMkFloatValue(value->valueUnion.ft);
- case PRT_VALUE_KIND_STRING:
+ case PRT_VALUE_KIND_STRING:
{
PRT_STRING copy = (PRT_STRING) PrtMalloc(strlen(value->valueUnion.str) + 1);
strcpy(copy, value->valueUnion.str);
diff --git a/Src/PRuntimes/PCRuntime/LinuxUser/PrtLinuxUserConfig.h b/Src/PRuntimes/PCRuntime/LinuxUser/PrtLinuxUserConfig.h
index 9ff67892f..576299cb4 100644
--- a/Src/PRuntimes/PCRuntime/LinuxUser/PrtLinuxUserConfig.h
+++ b/Src/PRuntimes/PCRuntime/LinuxUser/PrtLinuxUserConfig.h
@@ -9,7 +9,7 @@
#if defined(PRT_USE_CLANG)
#define FORCEINLINE __attribute__((always_inline))
#elif defined(PRT_USE_GCC)
-#define FORCEINLINE
+#define FORCEINLINE
#else
#define FORCEINLINE
#endif
diff --git a/Src/PRuntimes/PCRuntime/LinuxUser/ext_compat.h b/Src/PRuntimes/PCRuntime/LinuxUser/ext_compat.h
index 0ca322311..0ba81f27a 100644
--- a/Src/PRuntimes/PCRuntime/LinuxUser/ext_compat.h
+++ b/Src/PRuntimes/PCRuntime/LinuxUser/ext_compat.h
@@ -6,9 +6,9 @@
#include
/*
- This file is only a temporary solution to getting Linux Prt to Compile.
- The implementations are NOT COMPLETE !!!
- TODO: move to a safer cleaner solution
+ This file is only a temporary solution to getting Linux Prt to Compile.
+ The implementations are NOT COMPLETE !!!
+ TODO: move to a safer cleaner solution
*/
#define fprintf_s(stream, format, args...) fprintf(stream, format, ##args)
diff --git a/Src/PRuntimes/PCRuntime/NuttxUser/PrtNuttxUserConfig.h b/Src/PRuntimes/PCRuntime/NuttxUser/PrtNuttxUserConfig.h
index e8bf99456..5200936a9 100644
--- a/Src/PRuntimes/PCRuntime/NuttxUser/PrtNuttxUserConfig.h
+++ b/Src/PRuntimes/PCRuntime/NuttxUser/PrtNuttxUserConfig.h
@@ -16,7 +16,7 @@ extern "C"{
#endif
/** Calling convention __cdecl is not supported by gcc. */
-#define PRT_CALL_CONV
+#define PRT_CALL_CONV
/* These argument annotations are not supported by gcc */
#define _In_
diff --git a/Src/PRuntimes/PCRuntime/SGXUser/Trusted/PrtSGXUserConfig.h b/Src/PRuntimes/PCRuntime/SGXUser/Trusted/PrtSGXUserConfig.h
index 59b3929d3..76f757c5c 100644
--- a/Src/PRuntimes/PCRuntime/SGXUser/Trusted/PrtSGXUserConfig.h
+++ b/Src/PRuntimes/PCRuntime/SGXUser/Trusted/PrtSGXUserConfig.h
@@ -9,7 +9,7 @@
#if defined(PRT_USE_CLANG)
#define FORCEINLINE __attribute__((always_inline))
#elif defined(PRT_USE_GCC)
-#define FORCEINLINE
+#define FORCEINLINE
#else
#define FORCEINLINE
#endif
diff --git a/Src/PRuntimes/PCSharpRuntime/PJsonFormatter.cs b/Src/PRuntimes/PCSharpRuntime/PJsonFormatter.cs
index 8d6a560cc..e42ac4d2c 100644
--- a/Src/PRuntimes/PCSharpRuntime/PJsonFormatter.cs
+++ b/Src/PRuntimes/PCSharpRuntime/PJsonFormatter.cs
@@ -36,7 +36,7 @@ private static string RemoveLogTag(string log)
return log;
}
-
+
///
/// Method taken from PLogFormatter.cs file. Takes in a string and only get the
/// last element of the string separated by a period.
@@ -47,7 +47,7 @@ private static string RemoveLogTag(string log)
/// String representing the name to be parsed.
/// The split string.
private static string GetShortName(string name) => name?.Split('.').Last();
-
+
///
/// Method taken from PLogFormatter.cs file. Takes in Event e and returns string
/// with details about the event such as event name and its payload. Slightly modified
@@ -62,7 +62,7 @@ private static string GetEventNameWithPayload(Event e)
{
return e.GetType().Name;
}
-
+
var pe = (PEvent)(e);
var payload = pe.Payload == null ? "null" : pe.Payload.ToEscapedString();
var msg = pe.Payload == null ? "" : $" with payload ({payload})";
@@ -135,7 +135,7 @@ public override void OnCreateStateMachine(ActorId id, string creatorName, string
Writer.AddLog(log);
Writer.AddToLogs(updateVcMap: true);
}
-
+
public override void OnDefaultEventHandler(ActorId id, string stateName)
{
stateName = GetShortName(stateName);
diff --git a/Src/PRuntimes/PCSharpRuntime/PMachine.cs b/Src/PRuntimes/PCSharpRuntime/PMachine.cs
index 9e1688aa2..3777ea597 100644
--- a/Src/PRuntimes/PCSharpRuntime/PMachine.cs
+++ b/Src/PRuntimes/PCSharpRuntime/PMachine.cs
@@ -161,9 +161,9 @@ public IPrtValue TryRandom(IPrtValue param)
public void LogLine(string message)
{
Logger.WriteLine($" {message}");
-
+
// Log message to JSON output
- JsonLogger.AddLogType(JsonWriter.LogType.Print);
+ JsonLogger.AddLogType(JsonWriter.LogType.Print);
JsonLogger.AddLog(message);
JsonLogger.AddToLogs(updateVcMap: false);
}
@@ -184,20 +184,20 @@ public void Announce(Event ev, object payload = null)
var oneArgConstructor = ev.GetType().GetConstructors().First(x => x.GetParameters().Length > 0);
var @event = (Event)oneArgConstructor.Invoke(new[] { payload });
var pText = payload == null ? "" : $" with payload {((IPrtValue)payload).ToEscapedString()}";
-
+
Logger.WriteLine($" '{Id}' announced event '{ev.GetType().Name}'{pText}.");
-
+
// Log message to JSON output
JsonLogger.AddLogType(JsonWriter.LogType.Announce);
JsonLogger.LogDetails.Id = $"{Id}";
JsonLogger.LogDetails.Event = ev.GetType().Name;
if (payload != null)
{
- JsonLogger.LogDetails.Payload = ((IPrtValue)payload).ToDict();
+ JsonLogger.LogDetails.Payload = ((IPrtValue)payload).ToDict();
}
JsonLogger.AddLog($"{Id} announced event {ev.GetType().Name}{pText}.");
JsonLogger.AddToLogs(updateVcMap: true);
-
+
AnnounceInternal(@event);
}
@@ -208,7 +208,7 @@ private void AnnounceInternal(Event ev)
{
return;
}
-
+
foreach (var monitor in PModule.monitorMap[interfaceName])
{
if (PModule.monitorObserves[monitor.Name].Contains(ev.GetType().Name))
diff --git a/Src/PRuntimes/PCSharpRuntime/PMonitor.cs b/Src/PRuntimes/PCSharpRuntime/PMonitor.cs
index aafba761f..1f175fb1c 100644
--- a/Src/PRuntimes/PCSharpRuntime/PMonitor.cs
+++ b/Src/PRuntimes/PCSharpRuntime/PMonitor.cs
@@ -35,13 +35,13 @@ public void TryAssert(bool predicate, string s, params object[] args)
{
Assert(predicate, s, args);
}
-
+
public void LogLine(string message)
{
Logger.WriteLine($" {message}");
-
+
// Log message to JSON output
- JsonLogger.AddLogType(JsonWriter.LogType.Print);
+ JsonLogger.AddLogType(JsonWriter.LogType.Print);
JsonLogger.AddLog(message);
JsonLogger.AddToLogs(updateVcMap: false);
}
diff --git a/Src/PRuntimes/PCSharpRuntime/Values/IPrtValue.cs b/Src/PRuntimes/PCSharpRuntime/Values/IPrtValue.cs
index a99e98ba8..7f6d185f4 100644
--- a/Src/PRuntimes/PCSharpRuntime/Values/IPrtValue.cs
+++ b/Src/PRuntimes/PCSharpRuntime/Values/IPrtValue.cs
@@ -14,7 +14,7 @@ string ToEscapedString()
{
return ToString();
}
-
+
object ToDict()
{
return ToEscapedString();
diff --git a/Src/PRuntimes/PCSharpRuntime/Values/PMachineValue.cs b/Src/PRuntimes/PCSharpRuntime/Values/PMachineValue.cs
index e0a8d1cbd..d537362de 100644
--- a/Src/PRuntimes/PCSharpRuntime/Values/PMachineValue.cs
+++ b/Src/PRuntimes/PCSharpRuntime/Values/PMachineValue.cs
@@ -47,7 +47,7 @@ public override string ToString()
{
return Id.Name.Split('.').Last();
}
-
+
public object ToDict()
{
return ToString();
diff --git a/Src/PRuntimes/PCSharpRuntime/Values/PrtBool.cs b/Src/PRuntimes/PCSharpRuntime/Values/PrtBool.cs
index 447f48bde..c2f25f1de 100644
--- a/Src/PRuntimes/PCSharpRuntime/Values/PrtBool.cs
+++ b/Src/PRuntimes/PCSharpRuntime/Values/PrtBool.cs
@@ -25,7 +25,7 @@ public override string ToString()
{
return value.ToString();
}
-
+
public object ToDict()
{
return value;
diff --git a/Src/PRuntimes/PCSharpRuntime/Values/PrtEnum.cs b/Src/PRuntimes/PCSharpRuntime/Values/PrtEnum.cs
index 9be7b681a..cf7adabf5 100644
--- a/Src/PRuntimes/PCSharpRuntime/Values/PrtEnum.cs
+++ b/Src/PRuntimes/PCSharpRuntime/Values/PrtEnum.cs
@@ -24,7 +24,7 @@ public static void Clear()
{
enumElements.Clear();
}
-
+
public object ToDict()
{
return enumElements.ToDictionary(kvp => kvp.Key, kvp => kvp.Value.ToDict());
diff --git a/Src/PRuntimes/PCSharpRuntime/Values/PrtFloat.cs b/Src/PRuntimes/PCSharpRuntime/Values/PrtFloat.cs
index 9145aec0c..7d66f6ead 100644
--- a/Src/PRuntimes/PCSharpRuntime/Values/PrtFloat.cs
+++ b/Src/PRuntimes/PCSharpRuntime/Values/PrtFloat.cs
@@ -24,7 +24,7 @@ public override string ToString()
{
return value.ToString();
}
-
+
public object ToDict()
{
return value;
diff --git a/Src/PRuntimes/PCSharpRuntime/Values/PrtInt.cs b/Src/PRuntimes/PCSharpRuntime/Values/PrtInt.cs
index 9e28c77f1..451bff831 100644
--- a/Src/PRuntimes/PCSharpRuntime/Values/PrtInt.cs
+++ b/Src/PRuntimes/PCSharpRuntime/Values/PrtInt.cs
@@ -38,7 +38,7 @@ public override string ToString()
{
return value.ToString();
}
-
+
public object ToDict()
{
return value;
diff --git a/Src/PRuntimes/PCSharpRuntime/Values/PrtMap.cs b/Src/PRuntimes/PCSharpRuntime/Values/PrtMap.cs
index ee5189d1b..a79525c60 100644
--- a/Src/PRuntimes/PCSharpRuntime/Values/PrtMap.cs
+++ b/Src/PRuntimes/PCSharpRuntime/Values/PrtMap.cs
@@ -215,19 +215,19 @@ public string ToEscapedString()
sb.Append(")");
return sb.ToString();
}
-
+
public object ToDict()
{
var mapDict = new Dictionary();
-
+
foreach (var value in map)
{
var mapKey = value.Key.ToEscapedString();
var mapValue = value.Value.ToDict();
-
+
mapDict.Add(mapKey, mapValue);
}
-
+
return mapDict;
}
}
diff --git a/Src/PRuntimes/PJavaRuntime/pom.xml b/Src/PRuntimes/PJavaRuntime/pom.xml
index 26beef159..04e003071 100644
--- a/Src/PRuntimes/PJavaRuntime/pom.xml
+++ b/Src/PRuntimes/PJavaRuntime/pom.xml
@@ -77,5 +77,5 @@
UTF-8
1.0-SNAPSHOT
-
+
diff --git a/Src/PRuntimes/PSymRuntime/CLI_OPTIONS.md b/Src/PRuntimes/PSymRuntime/CLI_OPTIONS.md
index 8fa121baf..9d8697119 100644
--- a/Src/PRuntimes/PSymRuntime/CLI_OPTIONS.md
+++ b/Src/PRuntimes/PSymRuntime/CLI_OPTIONS.md
@@ -39,7 +39,7 @@ For example, running:
./scripts/run_psym.sh Examples/tests/pingPong/ psymExample \
--strategy learn --timeout 60 --memout 2 --schedules 4 --max-steps 5
````
-runs PSym with
+runs PSym with
- learning-based explicit-state search strategy
- with a time limit of 60 seconds and memory limit of 2 GB
- with at most 4 schedules
diff --git a/Src/PRuntimes/PSymRuntime/Examples/OLD_CAV/BoundedAsync/boundedasync.p b/Src/PRuntimes/PSymRuntime/Examples/OLD_CAV/BoundedAsync/boundedasync.p
index c75473162..69a614c7c 100644
--- a/Src/PRuntimes/PSymRuntime/Examples/OLD_CAV/BoundedAsync/boundedasync.p
+++ b/Src/PRuntimes/PSymRuntime/Examples/OLD_CAV/BoundedAsync/boundedasync.p
@@ -10,7 +10,7 @@ machine Main {
var p3:machine;
var count:int;
start state inits {
-
+
entry {
p1 = new Process(this);
p2 = new Process(this);
@@ -51,8 +51,8 @@ machine Process {
var other2:machine;
start state _init {
- entry (payload: machine) {
- parent = payload;
+ entry (payload: machine) {
+ parent = payload;
raise unit;
}
on unit goto inits;
diff --git a/Src/PRuntimes/PSymRuntime/Examples/OLD_CAV/German/German.p b/Src/PRuntimes/PSymRuntime/Examples/OLD_CAV/German/German.p
index 7e47b487c..7ab9f7e31 100644
--- a/Src/PRuntimes/PSymRuntime/Examples/OLD_CAV/German/German.p
+++ b/Src/PRuntimes/PSymRuntime/Examples/OLD_CAV/German/German.p
@@ -15,7 +15,7 @@ event wait;
event invalidate_sharers: int;
event sharer_id: machine;
-//Host machine
+//Host machine
machine Main {
var curr_client : machine;
var clients : (machine, machine, machine);
@@ -131,7 +131,7 @@ machine Client {
var pending : bool;
start state init {
entry (payload: (machine,bool)) {
- host = payload.0;
+ host = payload.0;
pending = payload.1;
raise unit;
}
@@ -139,7 +139,7 @@ machine Client {
}
state invalid {
- entry {
+ entry {
}
on ask_share goto asked_share;
@@ -255,7 +255,7 @@ machine CPU {
{
if ($)
send cache.1, ask_share;
- else
+ else
send cache.1, ask_excl;
}
else
diff --git a/Src/PRuntimes/PSymRuntime/Examples/OLD_CAV/German/german.java b/Src/PRuntimes/PSymRuntime/Examples/OLD_CAV/German/german.java
index f22025c8b..7859cf1fd 100644
--- a/Src/PRuntimes/PSymRuntime/Examples/OLD_CAV/German/german.java
+++ b/Src/PRuntimes/PSymRuntime/Examples/OLD_CAV/German/german.java
@@ -13,14 +13,14 @@
import psymbolic.valuesummary.*;
public class german implements Program {
-
+
public static Scheduler scheduler;
-
+
@Override
public void setScheduler (Scheduler s) { this.scheduler = s; }
-
-
-
+
+
+
public static Event _null = new Event("_null");
public static Event _halt = new Event("_halt");
public static Event unit = new Event("unit");
@@ -45,7 +45,7 @@ public class german implements Program {
// Skipping Interface 'CPU'
public static class Main extends Machine {
-
+
static State init = new State("init") {
@Override public void entry(Guard pc_0, Machine machine, EventHandlerReturnReason outcome, UnionVS payload) {
((Main)machine).anonfun_0(pc_0, machine.sendBuffer, outcome);
@@ -90,7 +90,7 @@ public static class Main extends Machine {
private PrimitiveVS var_i = new PrimitiveVS(0);
private PrimitiveVS var_s = new PrimitiveVS(0);
private PrimitiveVS var_temp = new PrimitiveVS();
-
+
@Override
public void reset() {
super.reset();
@@ -104,7 +104,7 @@ public void reset() {
var_s = new PrimitiveVS(0);
var_temp = new PrimitiveVS();
}
-
+
public Main(int id) {
super("Main", id, EventBufferSemantics.queue, init, init
, receiveState
@@ -113,7 +113,7 @@ public Main(int id) {
, ProcessReq
, inv
, grantAccess
-
+
);
init.addHandlers(new GotoEventHandler(unit, receiveState));
receiveState.addHandlers(new DeferEventHandler(invalidate_ack)
@@ -136,8 +136,8 @@ public Main(int id) {
new GotoEventHandler(grant, grantAccess));
grantAccess.addHandlers(new GotoEventHandler(unit, receiveState));
}
-
- Guard
+
+ Guard
anonfun_0(
Guard pc_7,
EventBuffer effects,
@@ -145,156 +145,156 @@ public Main(int id) {
) {
PrimitiveVS var_$tmp0 =
new PrimitiveVS().restrict(pc_7);
-
+
PrimitiveVS var_$tmp1 =
new PrimitiveVS(false).restrict(pc_7);
-
+
PrimitiveVS var_$tmp2 =
new PrimitiveVS().restrict(pc_7);
-
+
PrimitiveVS var_$tmp3 =
new PrimitiveVS().restrict(pc_7);
-
+
PrimitiveVS var_$tmp4 =
new PrimitiveVS(false).restrict(pc_7);
-
+
PrimitiveVS var_$tmp5 =
new PrimitiveVS().restrict(pc_7);
-
+
PrimitiveVS var_$tmp6 =
new PrimitiveVS().restrict(pc_7);
-
+
PrimitiveVS var_$tmp7 =
new PrimitiveVS(false).restrict(pc_7);
-
+
PrimitiveVS var_$tmp8 =
new PrimitiveVS().restrict(pc_7);
-
+
TupleVS var_$tmp9 =
new TupleVS(new PrimitiveVS(), new PrimitiveVS(), new PrimitiveVS()).restrict(pc_7);
-
+
PrimitiveVS var_$tmp10 =
new PrimitiveVS().restrict(pc_7);
-
+
PrimitiveVS var_$tmp11 =
new PrimitiveVS(0).restrict(pc_7);
-
+
PrimitiveVS var_$tmp12 =
new PrimitiveVS(false).restrict(pc_7);
-
+
PrimitiveVS var_$tmp13 =
new PrimitiveVS("").restrict(pc_7);
-
+
PrimitiveVS var_$tmp14 =
new PrimitiveVS(_null).restrict(pc_7);
-
+
PrimitiveVS temp_var_0;
temp_var_0 = new PrimitiveVS(this).restrict(pc_7);
var_$tmp0 = var_$tmp0.updateUnderGuard(pc_7, temp_var_0);
-
+
PrimitiveVS temp_var_1;
temp_var_1 = new PrimitiveVS(false).restrict(pc_7);
var_$tmp1 = var_$tmp1.updateUnderGuard(pc_7, temp_var_1);
-
+
PrimitiveVS temp_var_2;
temp_var_2 = effects.create(pc_7, scheduler, Client.class, new UnionVS (new TupleVS (var_$tmp0.restrict(pc_7), var_$tmp1.restrict(pc_7))), (i) -> new Client(i));
var_$tmp2 = var_$tmp2.updateUnderGuard(pc_7, temp_var_2);
-
+
PrimitiveVS temp_var_3;
temp_var_3 = var_$tmp2.restrict(pc_7);
var_temp = var_temp.updateUnderGuard(pc_7, temp_var_3);
-
- TupleVS temp_var_4 = var_clients.restrict(pc_7);
+
+ TupleVS temp_var_4 = var_clients.restrict(pc_7);
PrimitiveVS temp_var_5;temp_var_5 = var_temp.restrict(pc_7);
temp_var_4 = temp_var_4.setField(0,temp_var_5);
var_clients = var_clients.updateUnderGuard(pc_7, temp_var_4);
-
+
PrimitiveVS temp_var_6;
temp_var_6 = new PrimitiveVS(this).restrict(pc_7);
var_$tmp3 = var_$tmp3.updateUnderGuard(pc_7, temp_var_6);
-
+
PrimitiveVS temp_var_7;
temp_var_7 = new PrimitiveVS(false).restrict(pc_7);
var_$tmp4 = var_$tmp4.updateUnderGuard(pc_7, temp_var_7);
-
+
PrimitiveVS temp_var_8;
temp_var_8 = effects.create(pc_7, scheduler, Client.class, new UnionVS (new TupleVS (var_$tmp3.restrict(pc_7), var_$tmp4.restrict(pc_7))), (i) -> new Client(i));
var_$tmp5 = var_$tmp5.updateUnderGuard(pc_7, temp_var_8);
-
+
PrimitiveVS temp_var_9;
temp_var_9 = var_$tmp5.restrict(pc_7);
var_temp = var_temp.updateUnderGuard(pc_7, temp_var_9);
-
- TupleVS temp_var_10 = var_clients.restrict(pc_7);
+
+ TupleVS temp_var_10 = var_clients.restrict(pc_7);
PrimitiveVS temp_var_11;temp_var_11 = var_temp.restrict(pc_7);
temp_var_10 = temp_var_10.setField(1,temp_var_11);
var_clients = var_clients.updateUnderGuard(pc_7, temp_var_10);
-
+
PrimitiveVS temp_var_12;
temp_var_12 = new PrimitiveVS(this).restrict(pc_7);
var_$tmp6 = var_$tmp6.updateUnderGuard(pc_7, temp_var_12);
-
+
PrimitiveVS temp_var_13;
temp_var_13 = new PrimitiveVS(false).restrict(pc_7);
var_$tmp7 = var_$tmp7.updateUnderGuard(pc_7, temp_var_13);
-
+
PrimitiveVS temp_var_14;
temp_var_14 = effects.create(pc_7, scheduler, Client.class, new UnionVS (new TupleVS (var_$tmp6.restrict(pc_7), var_$tmp7.restrict(pc_7))), (i) -> new Client(i));
var_$tmp8 = var_$tmp8.updateUnderGuard(pc_7, temp_var_14);
-
+
PrimitiveVS temp_var_15;
temp_var_15 = var_$tmp8.restrict(pc_7);
var_temp = var_temp.updateUnderGuard(pc_7, temp_var_15);
-
- TupleVS temp_var_16 = var_clients.restrict(pc_7);
+
+ TupleVS temp_var_16 = var_clients.restrict(pc_7);
PrimitiveVS temp_var_17;temp_var_17 = var_temp.restrict(pc_7);
temp_var_16 = temp_var_16.setField(2,temp_var_17);
var_clients = var_clients.updateUnderGuard(pc_7, temp_var_16);
-
+
TupleVS temp_var_18;
temp_var_18 = var_clients.restrict(pc_7);
var_$tmp9 = var_$tmp9.updateUnderGuard(pc_7, temp_var_18);
-
+
PrimitiveVS temp_var_19;
temp_var_19 = effects.create(pc_7, scheduler, CPU.class, new UnionVS (var_$tmp9.restrict(pc_7)), (i) -> new CPU(i));
var_$tmp10 = var_$tmp10.updateUnderGuard(pc_7, temp_var_19);
-
+
PrimitiveVS temp_var_20;
temp_var_20 = var_$tmp10.restrict(pc_7);
var_curr_cpu = var_curr_cpu.updateUnderGuard(pc_7, temp_var_20);
-
+
PrimitiveVS temp_var_21;
temp_var_21 = var_sharer_list.restrict(pc_7).size();
var_$tmp11 = var_$tmp11.updateUnderGuard(pc_7, temp_var_21);
-
+
PrimitiveVS temp_var_22;
temp_var_22 = var_$tmp11.restrict(pc_7).symbolicEquals(new PrimitiveVS(0).restrict(pc_7), pc_7);
var_$tmp12 = var_$tmp12.updateUnderGuard(pc_7, temp_var_22);
-
+
PrimitiveVS temp_var_23;
temp_var_23 = new PrimitiveVS(String.format("")).restrict(pc_7);
var_$tmp13 = var_$tmp13.updateUnderGuard(pc_7, temp_var_23);
-
+
Assert.progProp(!(var_$tmp12.restrict(pc_7)).getValues().contains(Boolean.FALSE), var_$tmp13.restrict(pc_7), scheduler, var_$tmp12.restrict(pc_7).getGuardFor(Boolean.FALSE));
PrimitiveVS temp_var_24;
temp_var_24 = new PrimitiveVS(unit).restrict(pc_7);
var_$tmp14 = var_$tmp14.updateUnderGuard(pc_7, temp_var_24);
-
+
// NOTE (TODO): We currently perform no typechecking on the payload!
outcome.raiseGuardedEvent(pc_7, var_$tmp14.restrict(pc_7));
pc_7 = Guard.constFalse();
-
+
return pc_7;
}
-
- void
+
+ void
anonfun_1(
Guard pc_8,
EventBuffer effects
) {
}
-
- Guard
+
+ Guard
anonfun_2(
Guard pc_9,
EventBuffer effects,
@@ -303,27 +303,27 @@ public Main(int id) {
) {
PrimitiveVS var_$tmp0 =
new PrimitiveVS(_null).restrict(pc_9);
-
+
PrimitiveVS temp_var_25;
temp_var_25 = var_payload.restrict(pc_9);
var_curr_client = var_curr_client.updateUnderGuard(pc_9, temp_var_25);
-
+
PrimitiveVS temp_var_26;
temp_var_26 = new PrimitiveVS(false).restrict(pc_9);
var_is_curr_req_excl = var_is_curr_req_excl.updateUnderGuard(pc_9, temp_var_26);
-
+
PrimitiveVS temp_var_27;
temp_var_27 = new PrimitiveVS(unit).restrict(pc_9);
var_$tmp0 = var_$tmp0.updateUnderGuard(pc_9, temp_var_27);
-
+
// NOTE (TODO): We currently perform no typechecking on the payload!
outcome.raiseGuardedEvent(pc_9, var_$tmp0.restrict(pc_9));
pc_9 = Guard.constFalse();
-
+
return pc_9;
}
-
- Guard
+
+ Guard
anonfun_3(
Guard pc_10,
EventBuffer effects,
@@ -332,27 +332,27 @@ public Main(int id) {
) {
PrimitiveVS var_$tmp0 =
new PrimitiveVS(_null).restrict(pc_10);
-
+
PrimitiveVS temp_var_28;
temp_var_28 = var_payload.restrict(pc_10);
var_curr_client = var_curr_client.updateUnderGuard(pc_10, temp_var_28);
-
+
PrimitiveVS temp_var_29;
temp_var_29 = new PrimitiveVS(true).restrict(pc_10);
var_is_curr_req_excl = var_is_curr_req_excl.updateUnderGuard(pc_10, temp_var_29);
-
+
PrimitiveVS temp_var_30;
temp_var_30 = new PrimitiveVS(unit).restrict(pc_10);
var_$tmp0 = var_$tmp0.updateUnderGuard(pc_10, temp_var_30);
-
+
// NOTE (TODO): We currently perform no typechecking on the payload!
outcome.raiseGuardedEvent(pc_10, var_$tmp0.restrict(pc_10));
pc_10 = Guard.constFalse();
-
+
return pc_10;
}
-
- Guard
+
+ Guard
anonfun_4(
Guard pc_11,
EventBuffer effects,
@@ -360,17 +360,17 @@ public Main(int id) {
) {
PrimitiveVS var_$tmp0 =
new PrimitiveVS(false).restrict(pc_11);
-
+
PrimitiveVS var_$tmp1 =
new PrimitiveVS(_null).restrict(pc_11);
-
+
PrimitiveVS var_$tmp2 =
new PrimitiveVS(_null).restrict(pc_11);
-
+
PrimitiveVS temp_var_31;
temp_var_31 = var_is_curr_req_excl.restrict(pc_11);
var_$tmp0 = var_$tmp0.updateUnderGuard(pc_11, temp_var_31);
-
+
PrimitiveVS temp_var_32 = var_$tmp0.restrict(pc_11);
Guard pc_12 = BooleanVS.getTrueGuard(temp_var_32);
Guard pc_13 = BooleanVS.getFalseGuard(temp_var_32);
@@ -384,12 +384,12 @@ public Main(int id) {
PrimitiveVS temp_var_33;
temp_var_33 = var_is_excl_granted.restrict(pc_13);
var_$tmp0 = var_$tmp0.updateUnderGuard(pc_13, temp_var_33);
-
+
}
if (jumpedOut_0 || jumpedOut_1) {
pc_11 = pc_12.or(pc_13);
}
-
+
PrimitiveVS temp_var_34 = var_$tmp0.restrict(pc_11);
Guard pc_14 = BooleanVS.getTrueGuard(temp_var_34);
Guard pc_15 = BooleanVS.getFalseGuard(temp_var_34);
@@ -400,33 +400,33 @@ public Main(int id) {
PrimitiveVS temp_var_35;
temp_var_35 = new PrimitiveVS(need_invalidate).restrict(pc_14);
var_$tmp1 = var_$tmp1.updateUnderGuard(pc_14, temp_var_35);
-
+
// NOTE (TODO): We currently perform no typechecking on the payload!
outcome.raiseGuardedEvent(pc_14, var_$tmp1.restrict(pc_14));
pc_14 = Guard.constFalse();
jumpedOut_2 = true;
-
+
}
if (!pc_15.isFalse()) {
// 'else' branch
PrimitiveVS temp_var_36;
temp_var_36 = new PrimitiveVS(grant).restrict(pc_15);
var_$tmp2 = var_$tmp2.updateUnderGuard(pc_15, temp_var_36);
-
+
// NOTE (TODO): We currently perform no typechecking on the payload!
outcome.raiseGuardedEvent(pc_15, var_$tmp2.restrict(pc_15));
pc_15 = Guard.constFalse();
jumpedOut_3 = true;
-
+
}
if (jumpedOut_2 || jumpedOut_3) {
pc_11 = pc_14.or(pc_15);
}
-
+
return pc_11;
}
-
- Guard
+
+ Guard
anonfun_5(
Guard pc_16,
EventBuffer effects,
@@ -434,47 +434,47 @@ public Main(int id) {
) {
PrimitiveVS var_$tmp0 =
new PrimitiveVS(0).restrict(pc_16);
-
+
PrimitiveVS var_$tmp1 =
new PrimitiveVS(false).restrict(pc_16);
-
+
PrimitiveVS var_$tmp2 =
new PrimitiveVS(_null).restrict(pc_16);
-
+
PrimitiveVS var_$tmp3 =
new PrimitiveVS(false).restrict(pc_16);
-
+
PrimitiveVS var_$tmp4 =
new PrimitiveVS(false).restrict(pc_16);
-
+
PrimitiveVS var_$tmp5 =
new PrimitiveVS().restrict(pc_16);
-
+
PrimitiveVS var_$tmp6 =
new PrimitiveVS().restrict(pc_16);
-
+
PrimitiveVS var_$tmp7 =
new PrimitiveVS(_null).restrict(pc_16);
-
+
PrimitiveVS var_$tmp8 =
new PrimitiveVS(0).restrict(pc_16);
-
+
PrimitiveVS temp_var_37;
temp_var_37 = new PrimitiveVS(0).restrict(pc_16);
var_i = var_i.updateUnderGuard(pc_16, temp_var_37);
-
+
PrimitiveVS temp_var_38;
temp_var_38 = var_sharer_list.restrict(pc_16).size();
var_$tmp0 = var_$tmp0.updateUnderGuard(pc_16, temp_var_38);
-
+
PrimitiveVS temp_var_39;
temp_var_39 = var_$tmp0.restrict(pc_16);
var_s = var_s.updateUnderGuard(pc_16, temp_var_39);
-
+
PrimitiveVS temp_var_40;
temp_var_40 = var_s.restrict(pc_16).symbolicEquals(new PrimitiveVS(0).restrict(pc_16), pc_16);
var_$tmp1 = var_$tmp1.updateUnderGuard(pc_16, temp_var_40);
-
+
PrimitiveVS temp_var_41 = var_$tmp1.restrict(pc_16);
Guard pc_17 = BooleanVS.getTrueGuard(temp_var_41);
Guard pc_18 = BooleanVS.getFalseGuard(temp_var_41);
@@ -485,12 +485,12 @@ public Main(int id) {
PrimitiveVS temp_var_42;
temp_var_42 = new PrimitiveVS(grant).restrict(pc_17);
var_$tmp2 = var_$tmp2.updateUnderGuard(pc_17, temp_var_42);
-
+
// NOTE (TODO): We currently perform no typechecking on the payload!
outcome.raiseGuardedEvent(pc_17, var_$tmp2.restrict(pc_17));
pc_17 = Guard.constFalse();
jumpedOut_4 = true;
-
+
}
if (!pc_18.isFalse()) {
// 'else' branch
@@ -498,7 +498,7 @@ public Main(int id) {
if (jumpedOut_4 || jumpedOut_5) {
pc_16 = pc_17.or(pc_18);
}
-
+
if (!pc_16.isFalse()) {
java.util.List loop_exits_0 = new java.util.ArrayList<>();
boolean loop_early_ret_0 = false;
@@ -507,11 +507,11 @@ public Main(int id) {
PrimitiveVS temp_var_43;
temp_var_43 = (var_i.restrict(pc_19)).apply(var_s.restrict(pc_19), (temp_var_44, temp_var_45) -> temp_var_44 < temp_var_45);
var_$tmp3 = var_$tmp3.updateUnderGuard(pc_19, temp_var_43);
-
+
PrimitiveVS temp_var_46;
temp_var_46 = var_$tmp3.restrict(pc_19);
var_$tmp4 = var_$tmp4.updateUnderGuard(pc_19, temp_var_46);
-
+
PrimitiveVS temp_var_47 = var_$tmp4.restrict(pc_19);
Guard pc_20 = BooleanVS.getTrueGuard(temp_var_47);
Guard pc_21 = BooleanVS.getFalseGuard(temp_var_47);
@@ -525,46 +525,46 @@ public Main(int id) {
loop_exits_0.add(pc_21);
jumpedOut_7 = true;
pc_21 = Guard.constFalse();
-
+
}
if (jumpedOut_6 || jumpedOut_7) {
pc_19 = pc_20.or(pc_21);
}
-
+
if (!pc_19.isFalse()) {
PrimitiveVS temp_var_48;
temp_var_48 = var_sharer_list.restrict(pc_19).get(var_i.restrict(pc_19));
var_$tmp5 = var_$tmp5.updateUnderGuard(pc_19, temp_var_48);
-
+
PrimitiveVS temp_var_49;
temp_var_49 = var_$tmp5.restrict(pc_19);
var_$tmp6 = var_$tmp6.updateUnderGuard(pc_19, temp_var_49);
-
+
PrimitiveVS temp_var_50;
temp_var_50 = new PrimitiveVS(invalidate).restrict(pc_19);
var_$tmp7 = var_$tmp7.updateUnderGuard(pc_19, temp_var_50);
-
+
effects.send(pc_19, var_$tmp6.restrict(pc_19), var_$tmp7.restrict(pc_19), null);
-
+
PrimitiveVS temp_var_51;
temp_var_51 = (var_i.restrict(pc_19)).apply(new PrimitiveVS(1).restrict(pc_19), (temp_var_52, temp_var_53) -> temp_var_52 + temp_var_53);
var_$tmp8 = var_$tmp8.updateUnderGuard(pc_19, temp_var_51);
-
+
PrimitiveVS temp_var_54;
temp_var_54 = var_$tmp8.restrict(pc_19);
var_i = var_i.updateUnderGuard(pc_19, temp_var_54);
-
+
}
}
if (loop_early_ret_0) {
pc_16 = Guard.orMany(loop_exits_0);
}
-
+
}
return pc_16;
}
-
- Guard
+
+ Guard
rec_ack(
Guard pc_22,
EventBuffer effects,
@@ -572,29 +572,29 @@ public Main(int id) {
) {
PrimitiveVS var_$tmp0 =
new PrimitiveVS(0).restrict(pc_22);
-
+
PrimitiveVS var_$tmp1 =
new PrimitiveVS(false).restrict(pc_22);
-
+
PrimitiveVS var_$tmp2 =
new PrimitiveVS(_null).restrict(pc_22);
-
- ListVS> temp_var_55 = var_sharer_list.restrict(pc_22);
+
+ ListVS> temp_var_55 = var_sharer_list.restrict(pc_22);
temp_var_55 = var_sharer_list.restrict(pc_22).removeAt(new PrimitiveVS(0).restrict(pc_22));
var_sharer_list = var_sharer_list.updateUnderGuard(pc_22, temp_var_55);
-
+
PrimitiveVS temp_var_56;
temp_var_56 = var_sharer_list.restrict(pc_22).size();
var_$tmp0 = var_$tmp0.updateUnderGuard(pc_22, temp_var_56);
-
+
PrimitiveVS temp_var_57;
temp_var_57 = var_$tmp0.restrict(pc_22);
var_s = var_s.updateUnderGuard(pc_22, temp_var_57);
-
+
PrimitiveVS temp_var_58;
temp_var_58 = var_s.restrict(pc_22).symbolicEquals(new PrimitiveVS(0).restrict(pc_22), pc_22);
var_$tmp1 = var_$tmp1.updateUnderGuard(pc_22, temp_var_58);
-
+
PrimitiveVS temp_var_59 = var_$tmp1.restrict(pc_22);
Guard pc_23 = BooleanVS.getTrueGuard(temp_var_59);
Guard pc_24 = BooleanVS.getFalseGuard(temp_var_59);
@@ -605,12 +605,12 @@ public Main(int id) {
PrimitiveVS temp_var_60;
temp_var_60 = new PrimitiveVS(grant).restrict(pc_23);
var_$tmp2 = var_$tmp2.updateUnderGuard(pc_23, temp_var_60);
-
+
// NOTE (TODO): We currently perform no typechecking on the payload!
outcome.raiseGuardedEvent(pc_23, var_$tmp2.restrict(pc_23));
pc_23 = Guard.constFalse();
jumpedOut_8 = true;
-
+
}
if (!pc_24.isFalse()) {
// 'else' branch
@@ -618,13 +618,13 @@ public Main(int id) {
if (jumpedOut_8 || jumpedOut_9) {
pc_22 = pc_23.or(pc_24);
}
-
+
if (!pc_22.isFalse()) {
}
return pc_22;
}
-
- Guard
+
+ Guard
anonfun_6(
Guard pc_25,
EventBuffer effects,
@@ -632,22 +632,22 @@ public Main(int id) {
) {
PrimitiveVS var_$tmp0 =
new PrimitiveVS().restrict(pc_25);
-
+
PrimitiveVS var_$tmp1 =
new PrimitiveVS(_null).restrict(pc_25);
-
+
PrimitiveVS var_$tmp2 =
new PrimitiveVS().restrict(pc_25);
-
+
PrimitiveVS var_$tmp3 =
new PrimitiveVS(_null).restrict(pc_25);
-
+
PrimitiveVS var_$tmp4 =
new PrimitiveVS().restrict(pc_25);
-
+
PrimitiveVS var_$tmp5 =
new PrimitiveVS(_null).restrict(pc_25);
-
+
PrimitiveVS temp_var_61 = var_is_curr_req_excl.restrict(pc_25);
Guard pc_26 = BooleanVS.getTrueGuard(temp_var_61);
Guard pc_27 = BooleanVS.getFalseGuard(temp_var_61);
@@ -658,58 +658,58 @@ public Main(int id) {
PrimitiveVS temp_var_62;
temp_var_62 = new PrimitiveVS(true).restrict(pc_26);
var_is_excl_granted = var_is_excl_granted.updateUnderGuard(pc_26, temp_var_62);
-
+
PrimitiveVS temp_var_63;
temp_var_63 = var_curr_client.restrict(pc_26);
var_$tmp0 = var_$tmp0.updateUnderGuard(pc_26, temp_var_63);
-
+
PrimitiveVS temp_var_64;
temp_var_64 = new PrimitiveVS(grant_excl).restrict(pc_26);
var_$tmp1 = var_$tmp1.updateUnderGuard(pc_26, temp_var_64);
-
+
effects.send(pc_26, var_$tmp0.restrict(pc_26), var_$tmp1.restrict(pc_26), null);
-
+
}
if (!pc_27.isFalse()) {
// 'else' branch
PrimitiveVS temp_var_65;
temp_var_65 = var_curr_client.restrict(pc_27);
var_$tmp2 = var_$tmp2.updateUnderGuard(pc_27, temp_var_65);
-
+
PrimitiveVS temp_var_66;
temp_var_66 = new PrimitiveVS(grant_share).restrict(pc_27);
var_$tmp3 = var_$tmp3.updateUnderGuard(pc_27, temp_var_66);
-
+
effects.send(pc_27, var_$tmp2.restrict(pc_27), var_$tmp3.restrict(pc_27), null);
-
+
}
if (jumpedOut_10 || jumpedOut_11) {
pc_25 = pc_26.or(pc_27);
}
-
+
PrimitiveVS temp_var_67;
temp_var_67 = var_curr_client.restrict(pc_25);
var_$tmp4 = var_$tmp4.updateUnderGuard(pc_25, temp_var_67);
-
- ListVS> temp_var_68 = var_sharer_list.restrict(pc_25);
+
+ ListVS> temp_var_68 = var_sharer_list.restrict(pc_25);
temp_var_68 = var_sharer_list.restrict(pc_25).insert(new PrimitiveVS(0).restrict(pc_25), var_$tmp4.restrict(pc_25));
var_sharer_list = var_sharer_list.updateUnderGuard(pc_25, temp_var_68);
-
+
PrimitiveVS temp_var_69;
temp_var_69 = new PrimitiveVS(unit).restrict(pc_25);
var_$tmp5 = var_$tmp5.updateUnderGuard(pc_25, temp_var_69);
-
+
// NOTE (TODO): We currently perform no typechecking on the payload!
outcome.raiseGuardedEvent(pc_25, var_$tmp5.restrict(pc_25));
pc_25 = Guard.constFalse();
-
+
return pc_25;
}
-
+
}
-
+
public static class Client extends Machine {
-
+
static State init = new State("init") {
@Override public void entry(Guard pc_28, Machine machine, EventHandlerReturnReason outcome, UnionVS payload) {
((Client)machine).anonfun_7(pc_28, machine.sendBuffer, outcome, payload != null ? (TupleVS) ValueSummary.castFromAny(pc_28, new TupleVS(new PrimitiveVS(), new PrimitiveVS