An open API service indexing awesome lists of open source software.

https://github.com/athulsabu2002/s7-compiler-lab


https://github.com/athulsabu2002/s7-compiler-lab

Last synced: 4 months ago
JSON representation

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 comments

2. **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 YACC

4. **NFA ฮต-Closure**
- Find ฮต-closure of all states in an NFA with ฮต-transitions

5. **First and Follow Sets**
- Calculate First and Follow sets for a given grammar

6. **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 expressions

9. **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! ๐Ÿ–ฅ๏ธโœจ