# objectionary/dejump architecture

> Architecture diagram of the GitHub repository objectionary/dejump, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/objectionary/dejump
- Repository: https://github.com/objectionary/dejump

## Overview

##### Project Type and Purpose
- This is a standalone CLI application written in Java.
- Its purpose is to read an EO program (in .eo or .xmir format), apply a series of transformations that eliminate `goto` objects, and write a semantically equivalent EO/XMIR output.
- It is built and packaged with Maven, uses XSLT stylesheets for the core transformations, and includes a test pipeline that leverages gmavenplus-plugin and eo-maven-plugin to turn sample .eo files into JUnit tests.

##### Core File-Structure Analysis
- src/main/java/org/eolang/dejump
- Main.java – the CLI entry‐point that parses arguments, locates input, and invokes the transformation engine.
- RemoveGoto.java – orchestrates the pipeline of XSLT transforms.
- src/main/resources/org/eolang/dejump/*.xsl
- The set of XSLT stylesheets, each performing one rewrite step (e.g., “goto-to-while.xsl”, “flags-to-memory.xsl”).
- src/test/eo/org/eolang/dejump
- Sample .eo programs exercising various `goto` patterns.
- src/test/java/org/eolang/dejump
- JUnit harness that runs the generated EO tests.
- Maven config
- pom.xml defines dependencies, plugin configuration (gmavenplus, eo-maven-plugin).
- CI workflows
- GitHub Actions under .github/workflows for build, lint, pages, etc.

##### Key Components
a. CLI Frontend
- Java process invoking Main.java.
- Argument parser producing an InputDescriptor (path, mode: EO vs XMIR).
b. Transformation Engine
- RemoveGoto orchestrator that:
1. Loads the input file into an in-memory DOM or XSLT Source.
2. Sequentially applies each XSLT stylesheet.
3. Accumulates the output for the next step.
c. XSLT Resource Loader
- Classpath loader that finds all .xsl files under resources/org/eolang/dejump.
d. Output Writer
- Writes the final transformed document into a `generated/` directory next to the input.
e. Build & Test Pipeline (secondary view)
- gmavenplus-plugin: transforms src/test/eo into EO-based JUnit tests under target/eo-after.
- eo-maven-plugin: compiles and runs those EO tests.
- GitHub Actions: triggers `mvn clean install -Pqulice`, runs tests, publishes gh-pages.

##### Relationships and Data Flows
- Separate flow: Maven build phases → gmavenplus → eo-maven-plugin → JUnit test results → GitHub Actions.

##### Architectural Patterns and Design Principles
- Pipe ‑and- filter pattern for XSLT steps (each stylesheet is a filter).
- Single responsibility: Main handles CLI; RemoveGoto handles sequencing; each XSL only one rewrite rule.
- Resource‐driven plugin model: new .xsl files can be dropped in resources to extend functionality.

##### Technologies and Frameworks
- Java 11+, Maven 3.8+
- gmavenplus-plugin (generate EO tests)
- eo-maven-plugin (run EO tests)
- XSLT 2.0 via built-in javax.xml.transform APIs
- Log4j for logging
- GitHub Actions for CI/CD

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Runtime Flow
    subgraph "Runtime Flow"
        direction TB
        CLI["User CLI<br/>(java -jar dejump.jar)"]:::external
        Main["Main.java"]:::runtime
        RemoveGoto["RemoveGoto.java"]:::runtime
        subgraph "XSLT Pipeline" 
            direction TB
            SG["simple-goto.xsl"]:::resource
            FM["flags-to-memory.xsl"]:::resource
            GW["goto-to-while.xsl"]:::resource
            CC["change-condition-of-jump.xsl"]:::resource
            RF["recalculate-flags.xsl"]:::resource
            AF["add-fl.xsl"]:::resource
            AT["add-temp-flags.xsl"]:::resource
            AO["add-order-for-while.xsl"]:::resource
            TW["terminating-while.xsl"]:::resource
            RV["return-value.xsl"]:::resource
            RM["rmv-meaningless.xsl"]:::resource
            WO["wrap-other-objects.xsl"]:::resource
        end
        Output["File System<br/>generated/*.eo/.xmir"]:::storage
        CLI -->|"invokes"| Main
        Main -->|"orchestrates"| RemoveGoto
        RemoveGoto -->|"loads XSLT filters"| SG
        SG --> FM --> GW --> CC --> RF --> AF --> AT --> AO --> TW --> RV --> RM --> WO
        WO -->|"writes final output"| Output
    end

    %% Build/Test Flow
    subgraph "Build/Test Flow"
        direction TB
        Maven["Maven Lifecycle<br/>(pom.xml)"]:::tool
        GMaven["gmavenplus-plugin"]:::tool
        EOPlugin["eo-maven-plugin"]:::tool
        TestEo["Test EO Programs<br/>(src/test/eo/org/eolang/dejump)"]:::resource
        JUnit["JUnit Tests<br/>(target/eo-after)"]:::storage
        GitHub["GitHub Actions"]:::tool

        Maven -->|"generate EO tests"| GMaven
        GMaven -->|"runs EO tests"| EOPlugin
        EOPlugin -->|"produces"| JUnit
        JUnit -->|"reports to"| GitHub
    end

    %% Click Events
    click Main "https://github.com/objectionary/dejump/blob/master/src/main/java/org/eolang/dejump/Main.java"
    click RemoveGoto "https://github.com/objectionary/dejump/blob/master/src/main/java/org/eolang/dejump/RemoveGoto.java"
    click SG "https://github.com/objectionary/dejump/blob/master/src/main/resources/org/eolang/dejump/simple-goto.xsl"
    click FM "https://github.com/objectionary/dejump/blob/master/src/main/resources/org/eolang/dejump/flags-to-memory.xsl"
    click GW "https://github.com/objectionary/dejump/blob/master/src/main/resources/org/eolang/dejump/goto-to-while.xsl"
    click CC "https://github.com/objectionary/dejump/blob/master/src/main/resources/org/eolang/dejump/change-condition-of-jump.xsl"
    click RF "https://github.com/objectionary/dejump/blob/master/src/main/resources/org/eolang/dejump/recalculate-flags.xsl"
    click AF "https://github.com/objectionary/dejump/blob/master/src/main/resources/org/eolang/dejump/add-fl.xsl"
    click AT "https://github.com/objectionary/dejump/blob/master/src/main/resources/org/eolang/dejump/add-temp-flags.xsl"
    click AO "https://github.com/objectionary/dejump/blob/master/src/main/resources/org/eolang/dejump/add-order-for-while.xsl"
    click TW "https://github.com/objectionary/dejump/blob/master/src/main/resources/org/eolang/dejump/terminating-while.xsl"
    click RV "https://github.com/objectionary/dejump/blob/master/src/main/resources/org/eolang/dejump/return-value.xsl"
    click RM "https://github.com/objectionary/dejump/blob/master/src/main/resources/org/eolang/dejump/rmv-meaningless.xsl"
    click WO "https://github.com/objectionary/dejump/blob/master/src/main/resources/org/eolang/dejump/wrap-other-objects.xsl"
    click TestEo "https://github.com/objectionary/dejump/tree/master/src/test/eo/org/eolang/dejump"
    click JUnit "https://github.com/objectionary/dejump/blob/master/src/test/java/org/eolang/dejump/MainTest.java"
    click JUnit "https://github.com/objectionary/dejump/blob/master/src/test/java/org/eolang/dejump/PacksTest.java"
    click JUnit "https://github.com/objectionary/dejump/blob/master/src/test/java/org/eolang/dejump/CheckPack.java"
    click Maven "https://github.com/objectionary/dejump/blob/master/pom.xml"
    click GitHub "https://github.com/objectionary/dejump/blob/master/.github/workflows/build.yml"
    click GitHub "https://github.com/objectionary/dejump/blob/master/.github/workflows/gh-pages.yml"
    click GitHub "https://github.com/objectionary/dejump/tree/master/.github/workflows/"
    click LJ1 "https://github.com/objectionary/dejump/blob/master/src/main/resources/log4j.properties"
    click LJ2 "https://github.com/objectionary/dejump/blob/master/src/test/resources/log4j.properties"
    click SX "https://github.com/objectionary/dejump/blob/master/src/test/resources/org/eolang/dejump/strip-xmir.xsl"

    %% Styles
    classDef runtime fill:#cce5ff,stroke:#004085,color:#004085
    classDef resource fill:#d4edda,stroke:#155724,color:#155724
    classDef tool fill:#fff3cd,stroke:#856404,color:#856404
    classDef storage fill:#e2e3e5,stroke:#6c757d,color:#6c757d
    classDef external fill:#f8d7da,stroke:#721c24,color:#721c24
```
