Skip to content

test(c): grammar evaluation and fixture scaffold (M9 1/3)#401

Merged
Mathews-Tom merged 2 commits into
mainfrom
feat/m9-c-fixtures
Jul 4, 2026
Merged

test(c): grammar evaluation and fixture scaffold (M9 1/3)#401
Mathews-Tom merged 2 commits into
mainfrom
feat/m9-c-fixtures

Conversation

@Mathews-Tom

Copy link
Copy Markdown
Owner

Stack

Stack-Id: m9-c-full-tier-20260704
Base: main
Position: 1/3

  1. feat/m9-c-fixtures -> this PR
  2. feat/m9-c-adapter -> next
  3. feat/m9-c-full-tier -> next

Depends on: (none — root)

Summary

M9 (DEVELOPMENT_PLAN.md Section D) PR 1/3: grammar-quality evaluation for C
plus a fixture corpus, zero adapter code.

  • tests/fixtures/c_simple/: point.h/point.c (typedef'd and bare
    structs, static helper, prototypes vs. definitions), list.h/list.c
    (self-referential struct, pointer-returning function, cross-file include),
    platform.h/platform.c (the extern "C" + #ifdef __cplusplus
    interop idiom), main.c (entry point).
  • tests/fixtures/c_simple/GRAMMAR_EVALUATION.md: documents the probe
    results against the bundled tree-sitter/tree-sitter-c grammar — zero
    ERROR nodes, one contained (non-cascading) parser diagnostic on the
    extern "C"/#ifdef idiom (undecidable without preprocessing, verified
    not to corrupt sibling boundaries), and the design decisions the probe
    drove (prototype declarations count as FUNCTION, typedef alias preferred
    for struct naming, extraction recurses through preprocessor-conditional
    and extern "C" wrapper nodes).

Validation

  • Fixtures parsed directly against tree_sitter_language_pack.get_language("c")
    during evaluation; all constructs required by this milestone produce zero
    ERROR nodes with independently correct boundaries (see
    GRAMMAR_EVALUATION.md for the full probe log).
  • No production code touched; uv run pytest, ruff, pyright unaffected
    by this PR (new fixture-only files under tests/fixtures/).

Adds tests/fixtures/c_simple/: point.h/point.c (named-and-typedef'd
struct, anonymous-typedef struct, static helper, function prototypes vs
definitions), list.h/list.c (self-referential struct, pointer-returning
function, cross-file quoted include), platform.h/platform.c (the
extern "C" + #ifdef C++-interop idiom), and main.c (entry point tying
every header together). No adapter code in this commit.

Stack-Id: m9-c-full-tier-20260704
Stack-Position: 1/3
Confirms tree-sitter/tree-sitter-c (official org grammar, bundled via
tree-sitter-language-pack) handles every construct M9 needs -- function
definitions, function prototypes, typedef'd and bare structs, and both
#include forms -- with zero ERROR nodes and correct independent sibling
boundaries. Documents one contained, non-cascading parser diagnostic
(the extern "C" + #ifdef __cplusplus idiom, undecidable without
running the preprocessor) and the design decisions it drove: prototype
declarations count as FUNCTION symbols (a .h file is almost entirely
prototypes), struct naming prefers a typedef alias over the bare tag,
and symbol extraction/#include parsing both recurse through
preprocessor-conditional and extern "C" wrapper nodes since those nest
their contents rather than flattening to top-level siblings.

Stack-Id: m9-c-full-tier-20260704
Stack-Position: 1/3
@Mathews-Tom Mathews-Tom force-pushed the feat/m9-c-fixtures branch from 80a12bc to d238176 Compare July 4, 2026 18:01
@Mathews-Tom Mathews-Tom merged commit c3bca14 into main Jul 4, 2026
12 checks passed
@Mathews-Tom Mathews-Tom deleted the feat/m9-c-fixtures branch July 4, 2026 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant