Welcome to the S7 Compiler Lab repository! This collection of experiments is designed to provide hands-on experience with various aspects of compiler design and implementation.
-
Custom Lexical Analyzer (C)
- Implement a lexical analyzer to recognize valid tokens in an input program
- Handle spaces, tabs, newlines, and comments
-
Lex Tool Experiments 2.1. Implement a Lexical Analyzer using Lex 2.2. Count lines, words, and characters in an input text 2.3. Convert substring 'abc' to 'ABC' in an input string 2.4. Count vowels and consonants in an input string
-
YACC Specifications 3.1. Recognize valid arithmetic expressions (+, -, *, /, parentheses) 3.2. Recognize valid identifiers (letter followed by letters/digits) 3.3. Implement a calculator using LEX and YACC
-
NFA ε-Closure
- Find ε-closure of all states in an NFA with ε-transitions
-
First and Follow Sets
- Calculate First and Follow sets for a given grammar
-
Shift-Reduce Parser
- Construct a Shift-Reduce Parser for a given language
- Code Optimization Techniques
- Simulate various code optimization techniques
-
Intermediate Code Generation
- Generate intermediate code for simple expressions
-
Backend Compiler Implementation
- Implement a compiler backend that converts three-address code to 8086 assembly language
To run these experiments, you'll need:
- A C compiler (e.g., GCC)
- Lex/Flex
- YACC/Bison
This repository is part of the CSL411 Compiler Lab course. Each experiment is designed to reinforce specific Course Outcomes (COs) related to compiler design and implementation.
Feel free to fork this repository and submit pull requests for any improvements or additional experiments you'd like to share!
Happy coding and enjoy your journey into the world of compiler design! 🖥️✨