Project Details

Project information

  • Name: Lexical Analyser
  • Category: Command line Application program
  • Language: C
  • Project URL: Lexical Analyser

Lexical Analyser - A command line application program

A command-line lexical analyser developed in C that scans C source files and tokenizes them into keywords, identifiers, constants, operators, and special characters. The project includes robust file handling, character-level parsing, and error detection for invalid tokens and malformed literals, demonstrating low-level compiler design fundamentals and modular system programming.

Development Highlights

Features implemented:

  • 🔎 Lexical Analyser – Performs lexical analysis on C source files to identify and classify tokens
  • 🧩 Token Classification – Extracts keywords, identifiers, operators, constants, and special characters
  • 📄 Source File Processing – Reads and scans C source files provided via command-line arguments
  • 🧠 Character-Level Parsing – Analyzes input character by character using state-based scanning logic
  • 🔤 Identifier & Keyword Detection – Differentiates user-defined identifiers from reserved C keywords
  • 🔢 Constant Handling – Recognizes numeric, character, and string literals accurately
  • ⚙️ Operator & Symbol Recognition – Identifies arithmetic, relational, logical operators, and delimiters
  • 🚨 Lexical Error Detection – Detects unterminated strings, invalid characters, malformed literals, and unmatched delimiters
  • 🧱 Modular Design – Organized into multiple source and header files for scanning, token handling, and utilities
  • 📊 Structured Token Storage – Stores token information using structures for systematic processing
  • 💾 Efficient File I/O – Uses buffered file operations for reliable and efficient scanning
  • 💻 Command-Line Interface – Simple CLI for analyzing source files and displaying tokenized output