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.
- ✨ Lexical Analyzer
- 🔢 Count Digits, Vowels, and Symbols
- 🔒 Username and Password Validation
- 📘 Predictive Parsing LL(1)
- 📚 Recursive Descent Parsing
- ➗ Operator Precedence Parsing
- 📈 LALR Parsing
- 🔍 Study of LEX and FLEX
- 📊 LEX Programs - Count Features
- ⚙️ LEX Programs - Various Tasks
- 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.
- 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.
- 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.
- 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.
- 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.
- Description: Implements operator precedence parsing for arithmetic expressions.
- Features:
- Supports arithmetic operations and operator precedence.
- Usage:
- Input: Arithmetic expression.
- Output: Evaluation result.
- 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.
- 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.
- 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.
- 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.
- Clone the repository:
git clone https://github.com/<your-username>/compiler-design.git
- Navigate to the desired section to explore the code and examples.
- Follow the usage instructions provided in each folder.
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.
This repository is licensed under the MIT License.