Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/objectionary/flatty
Object De-nesting for EO programs
https://github.com/objectionary/flatty
java oop
Last synced: 2 months ago
JSON representation
Object De-nesting for EO programs
- Host: GitHub
- URL: https://github.com/objectionary/flatty
- Owner: objectionary
- License: mit
- Created: 2023-04-06T12:34:18.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2024-10-23T16:52:41.000Z (3 months ago)
- Last Synced: 2024-10-23T23:49:01.908Z (3 months ago)
- Topics: java, oop
- Language: Java
- Homepage:
- Size: 83 KB
- Stars: 4
- Watchers: 2
- Forks: 2
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Flatty
This project describes an optimization method for removing nesting from programs written in phi-calculus. The nested structures in the language are composed of objects that form hierarchical structures, which can make it difficult to perform static analysis of such structures. The proposed method reframes expressions in such a way that they no longer contain nested objects, making it easier to perform static analysis.
### Quick start
```
import org.objectionary.Flatter;
import org.objectionary.Parser;String[] lines = {
"Ξ½1(π) β¦ β¦ x β¦ Ξ½3, π β¦ Ξ½2( a β¦ ΞΎ.x, b β¦ ΞΎ.x ) β§",
"Ξ½2(π) β¦ β¦ Ξ» β¦ int-times, a β¦ ΓΈ, b β¦ ΓΈ β§",
"Ξ½3(π) β¦ β¦ Ξ β¦ 0x0007 β§",
};
Parser parser = new Parser(String.join("\n", lines));
Flatter flatter = new Flatter(parser.parse());
String result = flatter.flat().toString();
```### Installation
To use Flatty in your project, you can follow the steps below:1. Download the Flatty repository.
2. Add the Flatty JAR file to your project's classpath.
3. Import the necessary classes in your Java code:
```
import flatty.Parser;
import flatty.Flatter;
```### Usage
The basic usage of Flatty involves the following steps:
1. Use the Parser class to parse the input program written in EO.
2. Create a Flatter object by passing the parsed program to it.
3. Execute the flat method to optimize the program.
Retrieve the optimized code as a string.
### Examples
You can find examples of some nested objects in the `src/test/java/org/objectionary/integration/resourses` directory.
### Run unit-tests
$ mvn clean install -Pqulice
### Run integration tests
$ git clone https://github.com/objectionary/phie
$ python3 src/test/java/org/objectionary/integration/tester.py