code-yeongyu / code-yeongyu/c11-compiler-zig-omo
[Sisyphus] phase-2 / zcc / Wave 2 — Parser (declarations + types)
- Dominant language
- C
- Stars
- 3
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
## Scope
Parse C11 declarations and type constructs, producing AST nodes per C11 §6.7.
## Deliverables
- `phase2/zcc/src/parse.zig` — parser implementation (declarations + types section).
- `phase2/zcc/src/ast.zig` — AST node definitions for declarations, specifiers, declarators, abstract declarators.
## Grammar Coverage
- Declaration specifiers: storage class (`auto`, `register`, `static`, `extern`, `_Thread_local`), type specifiers (`void`, `char`, `short`, `int`, `long`, `float`, `double`, `signed`, `unsigned`, `_Bool`, `_Complex`), type qualifiers (`const`, `restrict`, `volatile`, `_Atomic`), function specifiers (`inline`, `_Noreturn`), alignment specifier (`_Alignas`).
- `_Atomic` type specifier and qualifier.
- `struct` / `union` / `enum` declarations (including anonymous structs/unions).
- Function declarators (parameter type lists, variadic `...`).
- Declaration lists.
- Type names (abstract declarators) for casts / `sizeof`.
## Success Criteria
1. Successfully parse reference files `001.c` through `010.c` and `015.c` through `016.c` from `phase1/c11-ref/`.
2. AST round-trips to a stable serialized form (e.g., S-expression or JSON) for regression testing.
3. Parser recovers gracefully from errors and reports first error with location.
## Dependencies on Prior Waves
- **Wave 0** — build system.
- **Wave 1** — lexer token stream.
## Suggested Role Assignment
`parser-engineer`
## Test Corpus Expectations
- Parse each of `001..010`, `015..016` from `phase1/c11-ref/` and produce AST; compare against golden AST snapshots.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with phase2/zcc/src/parse.zig and phase2/zcc/src/ast.zig, then inspect the Wave 1 lexer token stream and C11 references in phase1/c11-ref/. Run the parser against 001.c–010.c and 015.c–016.c; done means declarations and types produce stable AST snapshots, with graceful recovery and the first error reported with its location.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, zig
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100