@@ -23,6 +23,18 @@ systems using Abstract State Machines (ASMs).
23
23
The [ Asmeta] ( https://github.com/asmeta/asmeta/tree/master ) framework provides a comprehensive suite
24
24
of tools for creating, simulating, verifying, and analyzing ASM models.
25
25
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.
26
38
27
39
## How to Start:
28
40
@@ -46,45 +58,133 @@ of tools for creating, simulating, verifying, and analyzing ASM models.
46
58
47
59
4. Start the application by running the generated JAR file:
48
60
` ` ` 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
50
62
` ` `
51
63
52
64
5. Customize execution with additional options:
53
65
` ` ` 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>
55
67
` ` `
56
68
- ` -input` : The ASM input file (required)
57
69
58
70
- ` -output` : The output folder (optional, defaults to ` ./output/` )
59
71
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)
61
106
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)
62
108
63
109
6. Example of a use case:
64
110
` ` ` 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
66
166
` ` `
67
167
68
168
# ## Using Docker
69
169
70
170
3. Open Docker Desktop and build the Docker image:
71
171
` ` ` shell
72
- docker build -t asmetal2java .
172
+ docker build -t asmetal2java_asmgen .
73
173
` ` `
74
174
75
175
4. Run the application within a Docker container:
76
176
` ` ` shell
77
- docker run --rm asmetal2java
177
+ docker run --rm asmetal2java_asmgen
78
178
` ` `
79
179
80
180
5. Customize execution by passing options:
81
181
` ` ` 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>
83
183
` ` `
84
184
85
185
- ` -v " $( pwd) /<input>:/app/<input>" ` : Maps the input file from the host to the container (required)
86
186
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)
88
188
89
189
- ` -input` : The ASM input file (required)
90
190
@@ -94,5 +194,5 @@ of tools for creating, simulating, verifying, and analyzing ASM models.
94
194
95
195
6. Example of a use case:
96
196
` ` ` 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"
98
198
` ` `
0 commit comments