This repository contains the source code of the programs done in our lab using Lex and Yacc.
Lexical analysers (.l) files are used to recognise the tokens encountered in a program.
Yacc (.y) files are used to design custom grammars for one's own compiler.
Lexical analysis using Lex
Syntactic analysis and parsing using Yacc
c files & txt files for code input
There are a lot of garbage files which are a result of .y & .l file evaluation
It's better to work on a UNIX based OS (Ubuntu / Redhat / CentOS)
Make sure you have Flex (Lex) & Bison (YACC) installed on your system
lex <file_name.l>
gcc lex.yy.c -ll -o <custom_file_name>
./<custom_file_name> < input_file > output_file
yacc -dv <file_name.y>
gcc y.tab.c -ll -o <custom_file_name>
./<custom_file_name> < input_file > output_file