This project aims to provide a strategy for converting a CFG (Control Flow Graph) "If-Else" condition selection that is compatible with both Go and Java programming languages. By following the outlined steps and considering the syntax and semantics of both languages, you can ensure that your CFG will work seamlessly in both GO
- Understand the syntax differences: Familiarize yourself with the syntax variations between Go and Java for writing if-else conditions.
- Write your CFG in a language-agnostic manner: Focus on expressing the logical flow of your program using high-level concepts, avoiding language-specific constructs or syntax.
- Identify language-specific variations: Identify any differences in operators, data types, or control flow constructs between Go and Java. Make necessary adjustments in your CFG to account for these variations.
- Create separate translation functions: Develop separate translation functions for Go and Java, which take your language-agnostic CFG as input and generate the corresponding code in the respective language. These functions handle the language-specific syntax and conversions.
- Test and validate: Thoroughly test the translation functions using various scenarios and inputs to ensure the generated code works correctly in both GO
To use this project, follow these steps:
- Clone the repository to your local machine.
- Modify the language-agnostic CFG to suit your specific if-else condition selection.
- Implement the separate translation functions for GO, ensuring the correct conversion from the CFG to each language's syntax.
- Test the translation functions using different inputs and scenarios to validate the correctness of the generated code.
To run this code, follow these steps:
- Clone this repository or download the only main.py
- Open the main.py then modify the "token_input" in GO format or do it as you wish. Follow the grammar that printed and see the "token_input" as an example
- Type "py main.py" or "python main.py" on the terminal then hit enter (Assuming it already inside the same folder as main.py)
- Done
The project structure is as follows:
- README.md # Project overview and instructions
- py-turing
Contributions to this project are currently resricted! If you find any issues or have ideas for improvements, please feel free to open an issue or submit a pull request. Current contributors:
By following the outlined strategy, you can ensure that your CFG "If-Else" condition selection is compatible with both Go and Java. Remember to allocate sufficient time for testing and debugging to ensure the accuracy of the translations.