https://github.com/athulsabu2002/s7-compiler-lab
https://github.com/athulsabu2002/s7-compiler-lab
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/athulsabu2002/s7-compiler-lab
- Owner: AthulSabu2002
- Created: 2024-10-13T10:37:09.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-11-11T16:50:48.000Z (11 months ago)
- Last Synced: 2025-06-22T06:07:00.324Z (4 months ago)
- Language: C
- Size: 39.1 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# S7 Compiler Lab
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.
## ๐ Table of Contents
1. [Lexical Analysis](#lexical-analysis)
2. [Syntax Analysis](#syntax-analysis)
3. [Code Optimization](#code-optimization)
4. [Code Generation](#code-generation)## ๐งช Experiments
### Lexical Analysis
1. **Custom Lexical Analyzer (C)**
- Implement a lexical analyzer to recognize valid tokens in an input program
- Handle spaces, tabs, newlines, and comments2. **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### Syntax Analysis
3. **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 YACC4. **NFA ฮต-Closure**
- Find ฮต-closure of all states in an NFA with ฮต-transitions5. **First and Follow Sets**
- Calculate First and Follow sets for a given grammar6. **Shift-Reduce Parser**
- Construct a Shift-Reduce Parser for a given language### Code Optimization
7. **Code Optimization Techniques**
- Simulate various code optimization techniques### Code Generation
8. **Intermediate Code Generation**
- Generate intermediate code for simple expressions9. **Backend Compiler Implementation**
- Implement a compiler backend that converts three-address code to 8086 assembly language## ๐ Getting Started
To run these experiments, you'll need:
- A C compiler (e.g., GCC)
- Lex/Flex
- YACC/Bison## ๐ Note
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.
## ๐ค Contributing
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! ๐ฅ๏ธโจ