This project implements a mini compiler with a graphical user interface (GUI) in Java. The compiler is designed to demonstrate the key stages of compilation, such as lexical analysis, syntax analysis, and intermediate code generation. It is a simplified version aimed at educational purposes, providing an interactive way to understand how compilers work.
- Lexical Analysis: Identifies the tokens in the source code.
- Syntax Analysis: Parses the tokens according to the grammar rules.
- Intermediate Code Generation: Produces intermediate code as a step before generating machine code.
- Graphical User Interface: The compiler features a GUI for easy interaction, making it user-friendly for educational demonstrations.
IntermediateCodeGenerator.form
andIntermediateCodeGenerator.java
: Handles the generation of intermediate code in the compilation process.LexemeGenerator.java
: Manages the generation of lexemes during lexical analysis.MainPanel.form
andMainPanel.java
: The main interface panel for the compiler’s GUI.PBar.java
andScanProgressBar.form
: Handles the progress bar functionality in the GUI.SymbolTable.form
andSymbolTable.java
: Manages the symbol table, which is used to store identifiers and their attributes.ThreeAddressCode.java
: Manages the generation of three-address code, a type of intermediate code.TokenTable.form
andTokenTable.java
: Handles the display and management of tokens identified during lexical analysis.
- Java Development Kit (JDK) 8 or higher.
- A Java IDE (e.g., IntelliJ IDEA, Eclipse) or any text editor with Java support.
-
Clone the repository to your local machine using:
git clone https://github.com/ammarlodhi255/mini-compiler-with-gui.git
-
Navigate to the project directory:
cd mini-compiler-with-gui
-
Open the project in your preferred Java IDE.
- Compile the project: Ensure all
.java
files are compiled. Most IDEs handle this automatically. - Run the GUI:
- Execute
MainPanel.java
to launch the user interface. - Use the provided interface to input code and observe the stages of compilation.
- Execute
If you'd like to contribute to this project, please fork the repository and use a feature branch. Pull requests are warmly welcome.
- Fork the repository.
- Create a new feature branch.
- Commit your changes.
- Push to the branch.
- Submit a pull request.
This project is open-source and available under the MIT License.