Skip to content

Commit 6e813c9

Browse files
authored
Update README.md
1 parent 698a3bc commit 6e813c9

File tree

1 file changed

+109
-9
lines changed

1 file changed

+109
-9
lines changed

README.md

+109-9
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,18 @@ systems using Abstract State Machines (ASMs).
2323
The [Asmeta](https://github.com/asmeta/asmeta/tree/master) framework provides a comprehensive suite
2424
of tools for creating, simulating, verifying, and analyzing ASM models.
2525

26+
## Project Overview
27+
28+
This repository contains two executable projects:
29+
30+
- [asmetal2java_codegen](#Asmetal2java_codegen) (Main Project)
31+
- [asmetal2java_asmgen](#Asmetal2java_asmgen) (Extension Project)
32+
33+
# Asmetal2java_codegen
34+
35+
The main project, **asmetal2java_codegen**, is responsible for translating an Abstract State Machine (ASM) into Java code.
36+
It generates an executable class named <asmFileName>_Exe that allows users to interact with the ASM step by step.
37+
This feature provides a hands-on approach to work with ASMs, enabling users to manually follow the execution of the state machine at each step.
2638

2739
## How to Start:
2840

@@ -46,45 +58,133 @@ of tools for creating, simulating, verifying, and analyzing ASM models.
4658

4759
4. Start the application by running the generated JAR file:
4860
```shell
49-
java -jar ./asmetal2java_asmgen/target/asmetal2java_asmgen-0.0.1-SNAPSHOT-jar-with-dependencies.jar
61+
java -jar ./asmetal2java_codegen/target/asmetal2java_codegen-0.0.1-SNAPSHOT-jar-with-dependencies.jar
5062
```
5163

5264
5. Customize execution with additional options:
5365
```shell
54-
java -jar ./asmetal2java_asmgen/target/asmetal2java_asmgen-0.0.1-SNAPSHOT-jar-with-dependencies.jar -input <input> -output <output> -D<property=value>
66+
java -jar ./asmetal2java_codegen/target/asmetal2java_codegen-0.0.1-SNAPSHOT-jar-with-dependencies.jar -input <input> -output <output> -D<property=value>
5567
```
5668
- `-input` : The ASM input file (required)
5769

5870
- `-output` : The output folder (optional, defaults to `./output/`)
5971

60-
- `-D <property=value>` : Additional properties (optional, see `-help` for more info)
72+
- `-D <property=value>` : Additional translator options
73+
74+
| Option | Argument Type | Description |
75+
|--------------------|-------------------|-------------|
76+
| `-input` | String (required) | Path to the ASM input file. |
77+
| `-output` | String (optional) | Specifies the output folder. Defaults to `./output/`. |
78+
| `-Dformatter` | boolean (optional) | whether the generated code should be formatted. |
79+
| `-DshuffleRandom` | boolean (optional) | whether a random shuffle should be applied. |
80+
| `-DoptimizeSeqMacroRule` | boolean (optional) | whether to optimize the sequence macro rule. |
81+
82+
83+
7. Example of a use case:
84+
```shell
85+
java -jar ./asmetal2java_asmgen/target/asmetal2java_codegen-0.0.1-SNAPSHOT-jar-with-dependencies.jar -input "examples/RegistroDiCassa.asm" -output "../asmetal2java_examples/src/" -Dformatter=true
86+
```
87+
88+
### Using Docker
89+
90+
3. Open Docker Desktop and build the Docker image:
91+
```shell
92+
docker build -t asmetal2java_codegen .
93+
```
94+
95+
4. Run the application within a Docker container:
96+
```shell
97+
docker run --rm asmetal2java_codegen
98+
```
99+
100+
5. Customize execution by passing options:
101+
```shell
102+
docker run --rm -v "$(pwd)/<input>:/app/<input>" -v "$(pwd)/asmetal2java_codegen/<output>:/app/asmetal2java_codegen/<output>" asmetal2java_codegen -input <input> -output <output> -D<property=value>
103+
```
104+
105+
- `-v "$(pwd)/<input>:/app/<input>"` : Maps the input file from the host to the container (required)
61106

107+
- `-v "$(pwd)/<output>:/app/<output>"` : Maps the output folder from the host to the container (required, use `<output>` as `output` for the default path)
62108

63109
6. Example of a use case:
64110
```shell
65-
java -jar ./asmetal2java_asmgen/target/asmetal2java_asmgen-0.0.1-SNAPSHOT-jar-with-dependencies.jar -input "examples/RegistroDiCassa.asm" -output "../asmetal2java_examples/src/" -Dformatter=true
111+
docker run --rm -v "$(pwd)/asmetal2java_codegen/examples:/app/asmetal2java_codegen/examples" -v "$(pwd)/asmetal2java_codegen/output:/app/output" asmetal2java_codegen -input "examples/RegistroDiCassa.asm" -output "output"
112+
```
113+
# Asmetal2java_asmgen
114+
115+
The extension project, **asmetal2java_asmgen**, extends asmetal2java_codegen by generating a class named <asmFileName>_ASM.
116+
Unlike the executable class generated by asmetal2java_codegen, which requires user interaction to step through the Abstract State Machine (ASM) execution,
117+
the _ASM class produced by asmetal2java_asmgen is designed for automated processes without the need for manual interactions.
118+
119+
## How to Start:
120+
121+
### Cloning the Repository
122+
1. Open PowerShell or your preferred terminal and clone the repository:
123+
```shell
124+
git clone https://github.com/isaacmaffeis/asmetal2java.git
125+
```
126+
127+
2. Navigate into the project directory:
128+
```shell
129+
cd ./asmetal2java
130+
```
131+
132+
### Using Maven
133+
134+
3. Install the project and generate the executable JAR:
135+
```shell
136+
mvn clean install
137+
```
138+
139+
4. Start the application by running the generated JAR file:
140+
```shell
141+
java -jar ./asmetal2java_asmgen/target/asmetal2java_asmgen-0.0.1-SNAPSHOT-jar-with-dependencies.jar
142+
```
143+
144+
5. Customize execution with additional options:
145+
```shell
146+
java -jar ./asmetal2java_asmgen/target/asmetal2java_asmgen-0.0.1-SNAPSHOT-jar-with-dependencies.jar -input <input> -output <output> -D<property=value>
147+
```
148+
- `-input` : The ASM input file (required)
149+
150+
- `-output` : The output folder (optional, defaults to `./output/`)
151+
152+
- `-D <property=value>` : Additional translator options
153+
154+
| Option | Argument Type | Description |
155+
|--------------------|-------------------|-------------|
156+
| `-input` | String (required) | Path to the ASM input file. |
157+
| `-output` | String (optional) | Specifies the output folder. Defaults to `./output/`. |
158+
| `-Dformatter` | boolean (optional) | whether the generated code should be formatted. |
159+
| `-DshuffleRandom` | boolean (optional) | whether a random shuffle should be applied. |
160+
| `-DoptimizeSeqMacroRule` | boolean (optional) | whether to optimize the sequence macro rule. |
161+
| `-finalState` | String (optional) | Final state condition of the ASM |
162+
163+
7. Example of a use case:
164+
```shell
165+
java -jar ./asmetal2java_asmgen/target/asmetal2java_asmgen-0.0.1-SNAPSHOT-jar-with-dependencies.jar -input "examples/RegistroDiCassav4.asm" -output "../asmetal2java_examples/src/" -Dformatter=true -finalState state>=5:statoCassa==Stati.CHIUSO
66166
```
67167

68168
### Using Docker
69169

70170
3. Open Docker Desktop and build the Docker image:
71171
```shell
72-
docker build -t asmetal2java .
172+
docker build -t asmetal2java_asmgen .
73173
```
74174

75175
4. Run the application within a Docker container:
76176
```shell
77-
docker run --rm asmetal2java
177+
docker run --rm asmetal2java_asmgen
78178
```
79179

80180
5. Customize execution by passing options:
81181
```shell
82-
docker run --rm -v "$(pwd)/<input>:/app/<input>" -v "$(pwd)/asmetal2java_codegen/<output>:/app/asmetal2java_codegen/<output>" asmetal2java -input <input> -output <output> -D<property=value>
182+
docker run --rm -v "$(pwd)/<input>:/app/<input>" -v "$(pwd)/asmetal2java_asmgen/<output>:/app/asmetal2java_asmgen/<output>" asmetal2java_asmgen -input <input> -output <output> -D<property=value>
83183
```
84184

85185
- `-v "$(pwd)/<input>:/app/<input>"` : Maps the input file from the host to the container (required)
86186

87-
- `-v "$(pwd)/<output>:/app/asmetal2java_codegen/<output>"` : Maps the output folder from the host to the container (required, use `<output>` as `output` for the default path)
187+
- `-v "$(pwd)/<output>:/app/<output>"` : Maps the output folder from the host to the container (required, use `<output>` as `output` for the default path)
88188

89189
- `-input` : The ASM input file (required)
90190

@@ -94,5 +194,5 @@ of tools for creating, simulating, verifying, and analyzing ASM models.
94194

95195
6. Example of a use case:
96196
```shell
97-
docker run --rm -v "$(pwd)/asmetal2java_codegen/examples:/app/asmetal2java_codegen/examples" -v "$(pwd)/asmetal2java_codegen/output:/app/asmetal2java_codegen/output" asmetal2java -input "examples/RegistroDiCassa.asm" -output "output"
197+
docker run --rm -v "$(pwd)/asmetal2java_asmgen/examples:/app/asmetal2java_asmgen/examples" -v "$(pwd)/asmetal2java_asmgen/output:/app/output" asmetal2java_asmgen -input "examples/RegistroDiCassav4.asm" -output "output"
98198
```

0 commit comments

Comments
 (0)