This repository contains the lab programs for the Compiler Design and System Software (CDSS) subject. The programs include implementations using Lex, Yacc, and C language. These are the practical exercises covered during the Compiler Design Lab sessions.
- Lex Programs: Programs written in Lex for lexical analysis.
- Yacc Programs: Programs that use Yacc for parsing, along with Lex for lexical analysis.
- C Programs: Various C programs related to Compiler Design concepts.
The repository is organized as follows:
/lex/ lex_program1.l lex_program2.l … /yacc/ yacc_program1.y yacc_program2.y … /c/ program1.c program2.c …
Each directory contains the respective source files:
- /lex/: Contains Lex source files (.l).
- /yacc/: Contains Yacc source files (.y) and associated Lex files.
- /c/: Contains C programs.
-
Navigate to the
lex/
directory:cd lex
-
Compile the Lex program:
lex lex_program1.l gcc lex.yy.c -o lex_program1
-
Run the Lex program:
./lex_program1
-
Navigate to the
yacc/
directory:cd yacc
-
Compile the Yacc program along with its Lex file:
yacc -d yacc_program1.y lex lex_file.l gcc y.tab.c lex.yy.c -o yacc_program1
-
Run the Yacc program:
./yacc_program1
-
Navigate to the
c/
directory:cd c
-
Compile the C program:
gcc program1.c -o program1
-
Run the C program:
./program1
- Lex: A tool for generating lexical analyzers.
- Yacc: A tool for generating parsers.
- GCC: A compiler for C language.
Make sure these tools are installed on your system to compile and run the programs.
Contributions to this repository are welcome. Feel free to fork this repository, make changes, and submit a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.