← Back to Projects

C-analyzer

Desktop lexer + parser visualizer for a subset of C, built with Python + PLY (lex/yacc) and a Tkinter GUI. Shows tokens and syntax-tree-like output side by side.

Python (>=3.10) PLY (lex/yacc) Tkinter Regex Packaging (pyproject.toml)
Repo

Problem

When learning compiler fundamentals, it’s hard to see how C source code becomes tokens and how grammar rules validate structure. I wanted a practical desktop tool that makes lexing/parsing more tangible with immediate feedback.

What I built

A Tkinter desktop app that:

Highlights

Architecture

How to run

# from the repo root
pip install -e .
# or, if you have dev extras configured:
# pip install -e ".[dev]"

Run the UI:

python -m ui.app
# or
python ui/app.py

Option B: Minimal dependencies

pip install ply
python ui/app.py

Usage

  1. Paste C code into the INPUT panel or select a file
  2. Click
    • Analyze Lexicon to see tokens,
    • Analyze Syntax to parse supported grammar,
    • Analyze Both to run both steps.

πŸ“· Screenshots

C Analyzer Result Gif