https://github.com/akarshjha03/compiler-design
This repository is dedicated to understanding and implementing the core concepts of compiler design. It covers various stages of a compiler, including lexical analysis, syntax analysis, semantic analysis, intermediate code generation, optimization, and code generation.
https://github.com/akarshjha03/compiler-design
clanguage compiler compiler-design flex lalr-parser lex lexical-analyzer parser
Last synced: 5 months ago
JSON representation
This repository is dedicated to understanding and implementing the core concepts of compiler design. It covers various stages of a compiler, including lexical analysis, syntax analysis, semantic analysis, intermediate code generation, optimization, and code generation.
- Host: GitHub
- URL: https://github.com/akarshjha03/compiler-design
- Owner: Akarshjha03
- Created: 2024-12-25T09:26:11.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-01-17T17:47:56.000Z (9 months ago)
- Last Synced: 2025-05-15T19:13:33.802Z (5 months ago)
- Topics: clanguage, compiler, compiler-design, flex, lalr-parser, lex, lexical-analyzer, parser
- Language: C
- Homepage: https://www.geeksforgeeks.org/introduction-of-compiler-design/
- Size: 105 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ⚙️ Compiler Design Repository
Welcome to the Compiler Design Repository! This repository is a collection of programs and resources aimed at helping you understand and implement various aspects of compiler design. Each section focuses on a specific concept or parsing technique, complete with examples and code.
---
## Table of Contents
1. ✨ Lexical Analyzer
2. 🔢 Count Digits, Vowels, and Symbols
3. 🔒 Username and Password Validation
4. 📘 Predictive Parsing LL(1)
5. 📚 Recursive Descent Parsing
6. ➗ Operator Precedence Parsing
7. 📈 LALR Parsing
8. 🔍 Study of LEX and FLEX
9. 📊 LEX Programs - Count Features
10. ⚙️ LEX Programs - Various Tasks---
## 1. ✨ Lexical Analyzer
- **Description:**
A program to implement lexical analysis, which identifies tokens in source code such as keywords, identifiers, operators, and symbols.
- **Features:**
- Token classification.
- Error detection for invalid tokens.
- **Usage:**
- Input: Source code.
- Output: List of tokens.---
## 2. 🔢 Count Digits, Vowels, and Symbols
- **Description:**
A simple program to count the number of digits, vowels, and special symbols in a given input string.
- **Features:**
- Accurate counts for different character types.
- **Usage:**
- Input: String.
- Output: Count of digits, vowels, and symbols.---
## 3. 🔒 Username and Password Validation
- **Description:**
A program to validate usernames and passwords based on predefined rules such as length, allowed characters, and format.
- **Features:**
- Checks for valid usernames.
- Ensures strong password compliance.
- **Usage:**
- Input: Username and password.
- Output: Validation result.---
## 4. 📘 Predictive Parsing LL(1)
- **Description:**
Implementation of LL(1) predictive parsing using a parsing table and grammar rules.
- **Features:**
- Handles grammars satisfying the LL(1) condition.
- Efficient error handling.
- **Usage:**
- Input: Grammar and string.
- Output: Parsing result.---
## 5. 📚 Recursive Descent Parsing
- **Description:**
Demonstrates top-down parsing using recursive functions for each non-terminal.
- **Features:**
- Handles recursive grammar rules.
- Detailed parsing steps.
- **Usage:**
- Input: Grammar and string.
- Output: Parsing steps and result.---
## 6. ➗ Operator Precedence Parsing
- **Description:**
Implements operator precedence parsing for arithmetic expressions.
- **Features:**
- Supports arithmetic operations and operator precedence.
- **Usage:**
- Input: Arithmetic expression.
- Output: Evaluation result.---
## 7. 📈 LALR Parsing
- **Description:**
Study and implementation of Look-Ahead LR (LALR) parsing for grammar analysis.
- **Features:**
- Combines the power of LR and SLR parsers.
- Efficient parsing for complex grammars.
- **Usage:**
- Input: Grammar and string.
- Output: Parsing result.---
## 8. 🔍 Study of LEX and FLEX
- **Description:**
An overview of the LEX and FLEX tools used for generating lexical analyzers.
- **Features:**
- Introduction to LEX and FLEX.
- Examples of token generation.
- **Usage:**
- Input: LEX/FLEX rules.
- Output: Generated lexical analyzer.---
## 9. 📊 LEX Programs - Count Features
- **Description:**
Programs using LEX to count various features such as lines, words, and characters in text input.
- **Features:**
- Line, word, and character counting.
- Simple LEX scripts.
- **Usage:**
- Input: Text file or string.
- Output: Count results.---
## 10. ⚙️ LEX Programs - Various Tasks
- **Description:**
A collection of LEX programs to perform various tasks, including pattern matching and string manipulation.
- **Features:**
- Demonstrates versatility of LEX.
- Includes multiple examples.
- **Usage:**
- Input: Custom patterns.
- Output: Results based on tasks.---
## How to Use This Repository
1. Clone the repository:
```bash
git clone https://github.com//compiler-design.git
```
2. Navigate to the desired section to explore the code and examples.
3. Follow the usage instructions provided in each folder.---
## Contribution Guidelines
We welcome contributions to improve this repository! If you'd like to contribute:- Fork the repository.
- Create a new branch for your changes.
- Submit a pull request with a clear description of your changes.## License
This repository is licensed under the MIT License.---
### Feel free to explore, learn, and contribute! Happy coding!