Parser
The C11 parser is defined in c11.y (Bison-style).
Responsibilities
Section titled “Responsibilities”- Enforce C grammar rules (or your supported subset)
- Construct AST nodes as reductions happen
- Encode precedence/associativity to reduce ambiguity
- Provide readable syntax errors
Extending the grammar
Section titled “Extending the grammar”When you add a new syntax feature:
- Extend grammar rules in
c11.y - Construct a corresponding AST node (in
ast.zig) - Ensure semantic analysis validates it
- Add IR lowering rules in
3ac.zig - Add RV32 lowering or emission in
assembler.zig
Error handling strategy
Section titled “Error handling strategy”Prefer emitting:
- a short message
- the location
- what was expected / what was seen