Skip to content

BonyAminAIUB/Compiler_course_lab

Repository files navigation

🧪 Compiler Course Lab

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.


📂 Repository Overview

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.


📌 Topics Covered

🔍 Regular Expression (RE) Validation

  • 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

🧾 Tokenization (Lexical Analysis)

  • 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)


⚙️ Key Concepts

  • Regular Expressions (RE)
  • Lexical Analysis
  • Token Classification
  • File Handling in C++
  • Basic Compiler Design Principles

🛠 Tech Stack

  • Language: C++
  • IDE: Visual Studio Code
  • Input Method: Text files for tokenization

🎯 Objectives

  • 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

📈 Learning Level

  • Beginner to Intermediate
  • Academic and lab-focused

⚠️ Notes

  • 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

🚀 Future Improvements

  • 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

About

Compiler lab projects in C++ focusing on regular expression validation and tokenization (lexical analysis).

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages