@@ -25,7 +25,7 @@ doi = {10.1007/978-3-030-34968-4_25}
...
@@ -25,7 +25,7 @@ doi = {10.1007/978-3-030-34968-4_25}
The main features of B2Program are:
The main features of B2Program are:
- Code generation from a formal model
- Code generation from a formal model
- Code generation for model checking including parallelization, and caching (only supported in Java and C++)
- Code generation for model checking including parallelization, and caching (only supported in Java, C++ and Rust)
- Code generation of interactive domain-specific visualizations (from VisB) in HTML and JavaScript/TypeScript
- Code generation of interactive domain-specific visualizations (from VisB) in HTML and JavaScript/TypeScript
...
@@ -367,6 +367,9 @@ Remarks:
...
@@ -367,6 +367,9 @@ Remarks:
# C
# C
./gradlew run -Planguage="c"[-Pbig_integer="true/false"-Pminint="minint"-Pmaxint="maxint"-Pdeferred_set_size="size"-PuseConstraintSolving="true/false"-PforModelchecking="true/false"]-Pfile="<path_relative_to_project_directory>"
./gradlew run -Planguage="c"[-Pbig_integer="true/false"-Pminint="minint"-Pmaxint="maxint"-Pdeferred_set_size="size"-PuseConstraintSolving="true/false"-PforModelchecking="true/false"]-Pfile="<path_relative_to_project_directory>"
# Rust
./gradlew run -Planguage="rs"[-Pbig_integer="true/false"-Pminint="minint"-Pmaxint="maxint"-Pdeferred_set_size="size"-PuseConstraintSolving="true/false"-PforModelchecking="true/false"]-Pfile="<path_relative_to_project_directory>"
(Code generated from TrafficLightExec.mch which includes TrafficLight.mch)
(Code generated from TrafficLightExec.mch which includes TrafficLight.mch)
#### Rust
1. Copy the generated code into a cargo-project with proper dependencies set up (example: [btypes_primitives/src/main/rust/bmachine](btypes_primitives/src/main/rust/bmachine/src))
2. rename the file of the main-machine to `main.rs`
2. run `cargo build --release`
### Execute generated code (manual simulation)
### Execute generated code (manual simulation)
...
@@ -434,6 +442,10 @@ Remark: Visualisation is the path to a VisB file. It is only available for TypeS
...
@@ -434,6 +442,10 @@ Remark: Visualisation is the path to a VisB file. It is only available for TypeS
* Execute the transpiled file with `node --experimental-specifier-resolution=node Lift.js`
* Execute the transpiled file with `node --experimental-specifier-resolution=node Lift.js`
* Output: `3`
* Output: `3`
##### Rust
* Run `./gradlew fatJar` to build the JAR-file
* Move the built JAR-file `B2Program-all-0.1.0-SNAPSHOT` to the same directory as `Lift.mch`
* Generate code for `Lift.mch` with ```java -jar B2Program-all-0.1.0-SNAPSHOT.jar -l rs -f Lift.mch ```
* Rename `Lift.rs` to `main.rs` and move it to [btypes_primitives/src/main/rust/bmachine/src](btypes_primitives/src/main/rust/bmachine/src)
* Write additional code executing generated functions of the Lift-machine
```rust
pubfn(){
letmutlift=Lift::new();
lift.inc();
lift.inc();
lift.inc();
println!("{}",lift.getFloor());
}
```
* from the bmachine-directory, run `cargo run --release`
* Output: `3`
#### Model Checking
#### Model Checking
##### Java
##### Java
...
@@ -608,6 +647,15 @@ make install
...
@@ -608,6 +647,15 @@ make install
* Execute `Lift.exec` with `./Lift 1 false`
* Execute `Lift.exec` with `./Lift 1 false`
##### Rust
* Run `./gradlew fatJar` to build the JAR-file
* Move the built JAR-file `B2Program-all-0.1.0-SNAPSHOT` to the same folder as `Lift.mch`
* Generate code for `Lift.mch` with ```java -jar B2Program-all-0.1.0-SNAPSHOT.jar -l rs -f Lift.mch -mc true```
* Rename `Lift.rs` to `main.rs` and move it to [btypes_primitives/src/main/rust/bmachine/src](btypes_primitives/src/main/rust/bmachine/src)
* from the bmachine-directory, run `cargo run --release -- mixed 1 false`
### Example 2: Cruise_finite1_deterministic_exec
### Example 2: Cruise_finite1_deterministic_exec
The file for `Cruise_finite1_deterministic_exec.mch` and `Cruise_finite1_deterministic` are in https://github.com/favu100/b2program/tree/master/src/test/resources/de/hhu/stups/codegenerator.
The file for `Cruise_finite1_deterministic_exec.mch` and `Cruise_finite1_deterministic` are in https://github.com/favu100/b2program/tree/master/src/test/resources/de/hhu/stups/codegenerator.
The machine Cruise_finite1_deterministic_exec includes the machine Cruise_finite1_deterministic.
The machine Cruise_finite1_deterministic_exec includes the machine Cruise_finite1_deterministic.
...
@@ -767,6 +815,52 @@ false
...
@@ -767,6 +815,52 @@ false
false
false
```
```
##### Rust
* Run `./gradlew fatJar` to build the JAR-file
* Move the built JAR-file `B2Program-all-0.1.0-SNAPSHOT` to the same folder as `Cruise_finite1_deterministic_exec.mch` and `Cruise_finite1_deterministic.mch`
* Rename `Cruise_finite1_deterministic_exec.rs` to `main.rs` and move it and `Cruise_finite1_deterministic.rs` to [btypes_primitives/src/main/rust/bmachine/src](btypes_primitives/src/main/rust/bmachine/src)
* Execute `Cruise_finite1_deterministic.exec` with `./Cruise_finite1_deterministic.exec mixed 6 true`
* Execute `Cruise_finite1_deterministic.exec` with `./Cruise_finite1_deterministic.exec mixed 6 true`
##### Rust
* Run `./gradlew fatJar` to build the JAR-file
* Move the built JAR-file `B2Program-all-0.1.0-SNAPSHOT` to the same folder as `Cruise_finite1_deterministic.mch` and `Cruise_finite1_deterministic.mch`
* Rename `Cruise_finite1_deterministic_exec.rs` to `main.rs` and move it and `Cruise_finite1_deterministic.rs` to [btypes_primitives/src/main/rust/bmachine/src](btypes_primitives/src/main/rust/bmachine/src)
* from the bmachine-directory, run `cargo run --release -- mixed 6 true`