https://github.com/objectionary/dejump
Replaces all GOTO objects in EO program with semantically equivalent ones but without GOTO
https://github.com/objectionary/dejump
eolang java
Last synced: 8 months ago
JSON representation
Replaces all GOTO objects in EO program with semantically equivalent ones but without GOTO
- Host: GitHub
- URL: https://github.com/objectionary/dejump
- Owner: objectionary
- License: mit
- Created: 2022-04-19T15:28:08.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-11-05T21:20:34.000Z (about 1 year ago)
- Last Synced: 2024-11-05T22:26:49.561Z (about 1 year ago)
- Topics: eolang, java
- Language: XSLT
- Homepage:
- Size: 421 KB
- Stars: 10
- Watchers: 2
- Forks: 2
- Open Issues: 20
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README

[](https://www.elegantobjects.org)
[](https://www.rultor.com/p/objectionary/eo)
[](https://www.jetbrains.com/idea/)
[](https://github.com/objectionary/dejump/actions/workflows/build.yml)
[](https://www.0pdd.com/p?name=objectionary/dejump)
[](https://maven-badges.herokuapp.com/maven-central/org.eolang/dejump)
[](https://hitsofcode.com/github/objectionary/dejump/view?branch=master)
[[](https://github.com/objectionary/dejump/blob/master/LICENSE.txt)
Takes as an input a program in [EO](https://www.eolang.org/) and converts it to a semantically equivalent program, excluding the use of `goto` object.
The input data is a program in `.eo`/`.xmir` format, as the output the program returns `.eo`/`.xmir` respectively.
## Usage
To use this program, the first step is to download the JAR. Then:
```shell
$ java -jar target/dejump-1.0-SNAPSHOT-jar-with-dependencies.jar --help
```
An application has a CLI (Command line interface), which appears as:
```
Usage: dejump [-hV] [--eo]
Replaces objects GOTO with semantically equivalent
Absolute path of file to transform
--eo treat input file as EO program (not XMIR)
-h, --help Show this help message and exit.
-V, --version Print version information and exit.
```
Depending on the input file format, the output file format will be similar.
By default, the input file format is `.xmir`.
In the directory that contains the file passed as a parameter, a new directory `generated` is created, in which, after the program is executed, the transformed file will be located.
## Example
For the following `.eo`-code, which appears at `temp/example.eo`:
```
[] > example
memory 0 > x
goto > @
[g]
seq > @
x.write (x.plus 1)
if.
x.eq 5
g.forward x
QQ.io.stdout "Again\n"
g.backward
```
After the application is executed, the file `temp/generated/example_transformed.eo` will be created:
```
[] > example
memory 0 > x
seq > @
flag_fwd.write -1
flag_bwd.write 0
while. > g_rem!
or.
flag_fwd.eq -1
flag_bwd.eq 0
[i]
seq > @
flag_fwd.write 0
flag_bwd.write 1
seq
x.write (x.plus 1)
if.
x.eq 5
flag_fwd.write 2
QQ.io.stdout "Again\n"
if.
flag_fwd.eq 0
flag_bwd.write 0
TRUE
if.
flag_fwd.eq 2
x
g_rem
memory -1 > flag_fwd
memory 0 > flag_bwd
```
## How to Contribute
You will need JDK 11+ and Maven 3.8+. Clone the repo and run the build like this:
```shell
$ mvn clean install -Pqulice
```
There are `.eo` files in [`src/test/eo/org/eolang/dejump`](https://github.com/objectionary/dejump/tree/master/src/test/eo/org/eolang/dejump), which you can edit or add your own source there. There are the following build steps that process these files:
1. At `generate-test-sources` Maven phase, `gmavenplus-plugin` takes all `.eo` sources and generates new ones. The files that it generates are not just `.eo` programs, but EO tests, which combine the code originally taken from original EO programs with the EO code generated. Thus, for `src/test/eo/org/eolang/dejump/alpha.eo` a modified EO source will be saved into `target/eo-after/process_alpha-test.eo`.
2. At `process-test-sources` phase, `eo-maven-plugin` process generated `.eo` files from `target/eo-after` directory and runs them as junit-tests.
All generated `.eo` junit-tests are deployed to [gh-pages](https://github.com/objectionary/dejump/tree/gh-pages).