Getting Started
This section will help you get started with Compiler Design.
WARNING
This Repository contains C, LEX and YACC files made during our couse of Compiler Design (CS601).
🚩 Pre Requisites
Following package are needed for running the c, lex and yacc files. Please run the following commands:
Run the update command (just in case)
sudo apt-get update
1
then:
sudo apt-get install gcc
sudo apt-get install lex
sudo apt-get install bison
1
2
3
2
3
or instead of lex you can install flex using
sudo apt-get install flex
1
💻 Usage
For compiling the C files:
gcc <filename.c>
./a.out
1
2
2
For compiling the lex files:
lex <lexfile.l> or flex <lexfile.l>
gcc lex.yy.c
./a.out
1
2
3
2
3
For compiling the yacc files (Along with the lex files):
yacc -d <yaccfile.y>
lex <lexfile.l>
gcc lex.yy.c y.tab.c
./a.out
1
2
3
4
2
3
4