Morley-IR is an Intermediate Representation (IR) library designed to standardize and structure industrial automation languages (e.g., Ladder Logic, Structured Text) for use in blockchain-based automation. It serves as a universal translation layer, ensuring that industrial logic can be accurately represented before being used in blockchain applications.
As industries integrate blockchain-based automation, there is a need for a standardized IR to translate traditional automation logic into structured data formats. Morley-IR provides:
- Formal IR definitions for Ladder Logic (LL) and Structured Text (ST).
- Validated mappings between industrial programming elements and IR components.
- Unit tests to ensure correctness of IR structures and mappings.
🔹 Ladder Logic → Morley-IR Conversion – Fully implemented and validated translation of rungs, coils, timers, and counters.
🔹 Structured Text → Morley-IR Mapping – Standardized representation of logical conditions, loops, and arithmetic.
🔹 IR Schema Validation – Ensures all IR structures conform to defined specifications, with tests verifying correctness.
🔹 Compatible with Morley Compiler – IR output is designed to be used in separate compilation processes.
Clone the repository:
git clone https://github.com/Morley-Labs/Morley-IR.git
cd Morley-IREnsure Python 3.8+ is installed, then install dependencies:
pip install -r requirements.txtMorley-IR/
│── src/ # Core IR processing scripts (in progress)
│── mappings/ # Fully implemented Ladder Logic & Structured Text mappings
│── examples/ # Sample IR representations (to be added)
│── tests/ # Unit tests ensuring correctness of mappings and transformations
│── README.md # Documentation
python src/ll_parser.py input.ll
python src/plutusladder_compiler.py input.ir
python src/reverse_compiler/reverse_compiler.py input.plutus
python src/validator_ir_transform.py input.irpython src/ll_parser.py examples/basic_example.ll > output.ir
python src/plutusladder_compiler.py output.ir > output.plutus
python src/reverse_compiler/reverse_compiler.py output.plutus > output_reversed.ll
🔹 Finalizing IR Processing Scripts – Implement transformation logic inside src/.
🔹 Creating Example Files – Populate examples/ with IR outputs for reference.
We welcome contributions! To get started:
- Fork the repo.
- Create a new branch:
git checkout -b feature-xyz
- Commit changes:
git commit -m "Added XYZ feature" - Push and open a Pull Request.
This project is licensed under the Apache 2.0 License.
For questions, discussions, or collaborations:
- Website: MorleyLang.org
- Twitter/X: @MorleyCardano
- Email: admin@MorleyLang.org