Skip to content

Latest commit

 

History

History
35 lines (22 loc) · 1.61 KB

README.md

File metadata and controls

35 lines (22 loc) · 1.61 KB

P-- Lexical Analyzer

This program implements a lexical analyzer for the P-- language, based on the grammar available at pmm-gramar. The analyzer is able to recognize tokens in a given input file and output them to another file along with their respective classes.

Compilation

To compile the lexical analyzer, symply run the following command in the terminal:

make

Usage

To use the lexical analyzer, simply run the following command in the terminal:

make run IN=input_file OUT=output_file

Where input_file is the name of the file containing the P-- code to be analyzed and output_file is the name of the file where the analysis results will be saved. If output_file already exists, its contents will be overwritten.

Output Format

The output file generated by the analyzer consists of one token-class pair per line. Each pair is separated by a space, and the pairs are sorted in the order in which the tokens appear in the input file. If any lexical errors are encountered during the analysis, they will also be included in the output file.

Implementation Details

The lexical analyzer was implemented using a series of finite automata, which were designed based on the grammar of the P-- language.

Authors