Develop a Lexical and Syntax Analyzer for the "Mini" Pascal Language (variant/simplified).
The project was created using the Eclipse IDE with the JavaCC Eclipse Plug-in that aims to help the development of projects using the JavaCC.
The source code is located on the javacc folder, while the samples of the mini pascal language are located on the samples folder.
JJTree is a preprocessor for JavaCC, it was used to help the creation of syntax trees.
JUNG Framework is a library that can represent data as a graph, it was used to draw the abstract syntax tree.
The LMP.jjt file is the main project file that contains the grammar and syntax definitions using JavaCC rules.
It is processed by JJTree that generates the necessary classes to build the tree and creates LMP.jj file which contains the code needed to insert nodes in the tree.
Finally, the LMP.jj file is processed by JavaCC that generates the classes of the lexicon and syntactic analysis.
This whole process is automated by the plugin.
SimpleNode2.java - Responsible for storing the abstract syntax tree and provide some extra functionality for handling the tree. This class extends SimpleNode.java generated by JJTree.
The classes responsible for extracting information from the input source code are in the tools package.
AST.java - Responsible for creating the graph (visual) of the abstract syntax tree.
Report.java - Responsible for extract and sort the symbols (tokens).
Symbols.java - Responsible for generating the list of identifiers (variables).