This program is a simple Lexical Analyzer for a subset of the Pascal programming language, known as Mini Pascal. It provides a graphical user interface for managing source code, illustrating the tokens with their respective classes and displaying the elapsed time of the analysis.
- Code source management: You can enter and edit the Mini Pascal source code using a text editor.
- Token illustration: The program displays the tokens found in the source code along with their respective classes in a table.
- Export/Import: You can export the source code to a file or import source code from a file.
- Java
- Java Swing (for the GUI)
- Make sure you have Java installed on your system.
- Download the Mini Pascal Lexical Analyzer program.
- Compile the Java source files.
- Run the program using the main class
Main.
- Launch the program.
- Enter the Mini Pascal source code in the text editor.
- Click the "Analyze" button to perform the lexical analysis.
- The table will display the tokens found in the source code, along with their classes.
- You can export the source code using the "Export" button or import source code using the "Import" button.
Here are a few examples to help you understand the program:
program HelloWorld;
begin
writeln('Hello, World!');
end.After analyzing the code, the program will display the following tokens:
| Lexeme | Token Class | Line |
|---|---|---|
| program | Reserved Keyword | 1 |
| HelloWorld | Identifier | 1 |
| ; | Punctuation | 1 |
| begin | Reserved Keyword | 2 |
| writeln | Reserved Keyword | 3 |
| ( | Punctuation | 3 |
| 'Hello, World!' | String | 3 |
| ) | Punctuation | 3 |
| ; | Punctuation | 3 |
| end | Reserved Keyword | 4 |
| . | Punctuation | 4 |
Contributions are welcome! If you find any issues or have suggestions for improvements, please feel free to open an issue or submit a pull request.
This project is licensed under the MIT License. You can find the details in the LICENSE file.
- The Mini Pascal programming language is based on the Pascal language.
- This program was developed as a learning exercise and is not intended for production use.
