This repository contains C++ implementations and lab assignments from my university Compiler Course Lab. It focuses on fundamental concepts of Lexical Analysis and pattern matching, which are essential parts of compiler design.
This repository includes practical implementations of:
- Regular Expression (RE) based validation
- Tokenization (Lexical Analysis) assignments
Each program is designed to simulate how a compiler analyzes and processes input code.
- Given a specific regular expression, the program checks whether an input string is valid or not
- Helps understand how patterns are used to define valid tokens in programming languages
📌 Example:
- Input:
abccc - Check: Does it match a given pattern? → Valid / Invalid
-
Reads input from a text file
-
Processes each line and classifies tokens into categories such as:
- Keywords
- Identifiers
- Operators
- Punctuations
- Literals (if applicable)
📌 This simulates the first phase of a compiler (Lexical Analyzer)
- Regular Expressions (RE)
- Lexical Analysis
- Token Classification
- File Handling in C++
- Basic Compiler Design Principles
- Language: C++
- IDE: Visual Studio Code
- Input Method: Text files for tokenization
- Understand how compilers recognize valid patterns using Regular Expressions
- Learn how source code is broken into tokens
- Gain practical experience with lexical analysis
- Build a foundation for advanced compiler topics
- Beginner to Intermediate
- Academic and lab-focused
- Code is written for learning and clarity
- Focus is on understanding compiler basics rather than full-scale implementation
- Programs simulate simplified versions of real compiler components
- Add support for more complex Regular Expressions
- Improve token classification accuracy
- Extend to syntax analysis (Parsing)
- Organize code into modular components
⭐ This repository represents my learning journey in compiler design through hands-on lab practice