This project includes a scanner.l
and parser.y
file, which act as an interpreter for parts of the C-- language. The program has been built with Lex, Yacc, and C. The outputs of the interpreter are text strings printed in the command line, which gives an overview of the symbol table and if the interpretation was successful. If the interpretation is unsuccessful, the user is informed with an error message.
The repository includes an executable file that can be run directly:
- Open a terminal at the folder with the file
a.out
- Run the command
./a.out < input_file_name.txt
(input_file_name should be replaced with the name of the file containing the program that should be parsed)
- Open a terminal at the folder with the file
scanner.l
andparser.y
files - Run the command
lex scanner.l
- Run the command
yacc -d parser.y
- Run the command
gcc y.tab.c
- Continue from step 2. in the “running directly” section.