This project is a COBOL to Java Compiler, capable of parsing COBOL source code, generating an Abstract Syntax Tree (AST), and converting it into Java source code. It supports embedded SQL (JDBC) and includes a Graphical User Interface (GUI).
- Lexical Analysis (Tokenization): Converts COBOL source into tokens.
- Abstract Syntax Tree (AST) Parsing: Analyzes COBOL syntax.
- Java Code Generation: Converts COBOL AST to Java source code.
- Support for SQL Queries (
EXEC SQL): Uses Java JDBC. - COBOL Statements Support:
DISPLAY(Prints output)MOVE(Assigns values to variables)STOP RUN(Graceful exit)WORKING-STORAGE(Variable declarations)PERFORM(Loops execution)GOTO(Jumping between labels)SEARCH(Sequential and Binary Search)SORT(Array Sorting)MERGE(Combining Arrays)CALL(Calling Subroutines)
- Debugging Mode: Enables tracing execution.
- Graphical User Interface (GUI): Allows users to input COBOL code, compile, and view Java output.
- Unit Testing for Validation.
- Java 11+
- Maven (For dependency management)
- MySQL Database (For SQL feature testing)
- Clone the repository:
git clone https://github.com/sekacorn/cobol-to-java-compiler.git
- Navigate to the project directory:
cd cobol-to-java-compiler - Compile and Run:
mvn compile exec:java
- Open the GUI and enter COBOL code to compile!
DISPLAY "Hello, COBOL".
MOVE 100 TO VAR1.
STOP RUN.public class Program {
public static void main(String[] args) {
System.out.println("Hello, COBOL");
int VAR1 = 100;
System.exit(0);
}
}- No Full COBOL Standard Support:
- Some COBOL data types are not fully mapped to Java.
- No support for COBOL Report Writer.
- No Dynamic Memory Management:
- COBOL’s
ALLOCATEis not supported.
- COBOL’s
- Limited File Handling:
OPEN,READ, andWRITEstatements have basic support but lack full COBOL file handling features.
- Limited Error Handling:
- Exception handling is simplistic.
- SQL Support Requires MySQL:
- Only supports MySQL JDBC; no support for other database engines.
- No Multi-threading Support:
- Java code is single-threaded.
- Support for COBOL File Handling (
OPEN,READ,WRITE) - Improved Error Handling with Exception Management
- Extend SQL Compatibility (Support PostgreSQL, Oracle, etc.)
- Performance Optimizations using Multi-threading
- Deploy as a Web-Based Compiler
📌 Developed with ❤️ by COBOL & Java Enthusiasts 📌