Mini Compiler in C (Lexical Analysis & Syntax Checker Example)
This project demonstrates a Mini Compiler in C that performs basic lexical analysis and syntax checking for a simplified subset of C programs. It identifies keywords, identifiers, constants, operators, and delimiters. This helps beginners understand compiler fundamentals.
1. Features
- Identify keywords
- Detect identifiers
- Detect constants (numbers)
- Detect operators (+, -, *, /, =)
- Detect delimiters (;, {}, ())
- Basic syntax checking for simple statements
2. Structure
3. Helper Functions
4. Lexical Analysis Example
5. Main Function with Sample Code
6. Sample Input/Output
Input:
Output:
7. Key Points to Remember
- This mini compiler performs lexical analysis only
- It identifies keywords, identifiers, constants, operators, and delimiters
- Can be extended to include syntax checking, expression evaluation, and simple code interpretation
- Great beginner project to understand compiler design concepts
This completes your Phase-9 projects roadmap including:
- Student Management System
- Library Management System
- Banking System
- Address Book using File Handling
- Mini Compiler Project