← All projects

Private project case study

C Block Tracer

A CLI static-analysis tool for nested C-like scopes, declarations, initializations, and shadowing conflicts.

C · Parsing · Static analysis

  • Chained symbol tables
  • O(1) average lookup
  • 50+ tests in project notes
C Block Tracer project overview
Project overview. Implementation notes and evidence are detailed below.

01 / Problem

The constraint

Resolve identifiers to the correct enclosing scope and explain shadowing without confusing a parser subset with a complete C compiler.

02 / Structure

Architecture at a glance

  1. Source → lexer / parser
  2. Scope stack + chained hash maps
  3. Declaration / shadowing diagnostics

03 / Implementation

Engineering decisions

  1. A lexer and parser recognize the supported subset of C.
  2. A stack models nested block scopes, with hash maps for declarations and enclosing-scope lookup.
  3. CLI diagnostics report declarations, initializations, re-declarations, and shadowing conflicts.

04 / Evidence

Measurement context

Based on author-supplied project notes. The 50+ unit-test count has not been independently counted from a public repository. O(1) refers to average hash-map lookup, not a worst-case guarantee.

05 / Trade-offs

Limits worth stating

  • The supported grammar is a subset, not a standards-complete C implementation.
  • Hash collisions and scope depth affect actual lookup costs.
  • Project notes describe tests for nested blocks, re-declarations, and forward references.