Contributor Workflow
This chapter records a practical workflow for changing parc safely.
Smallest-reproducer rule
When fixing or extending the parser, start with the smallest input that demonstrates the issue.
That input should usually be one of:
- a direct
parse::*snippet - a reftest file
- a preprocessed snapshot
This keeps parser work focused.
Recommended change sequence
- reproduce the issue with the smallest possible input
- decide whether the right test layer is
parse_api, reftest, or full-app style - inspect the AST or failure position with
Printeror structured errors - patch the relevant parser module
- rerun the focused tests
- only then widen out to broader test coverage
Choosing the right test layer
Use parse_api tests when:
- the bug is a simple grammar acceptance issue
- you only need a success/failure assertion
Use reftests when:
- tree shape matters
- printer output is the clearest regression oracle
Use preprocessed or full-app style fixtures when:
- includes or macro expansion are part of the problem
- driver behavior matters
Grammar-oriented debugging
A good parser debugging loop is:
- isolate the failing syntax
- parse with the right flavor
- inspect the closest AST shape that already works
- patch the grammar in the most local parser file possible
This is usually better than broad speculative rewrites.
AST changes
If you add or change an AST node, review the corresponding surfaces too:
- visitor hooks in
visit - printer behavior in
print - any book examples that describe the shape
- reftest expectations if printer output changed
Documentation changes
If a syntax family becomes better supported, update the book at the same time. The important places are usually:
- flavor/extension guidance
- unsupported cases
- workflows
- AST or visitor examples
That keeps the book aligned with the real parser contract.
Boundary rule
When changing parc, keep the ownership split explicit:
parcowns preprocessing, parsing, extraction, and source artifactsparcdoes not own link evidence or Rust lowering- do not document parser internals as if they were a shared ABI for the rest of the pipeline
If a change makes the source artifact richer, document the richer source
meaning directly instead of hinting that downstream crates depend on parc
library internals.
Maintenance rule
The maintenance bar is simple:
- add or tighten the smallest useful test first
- keep public contract docs and examples in the same patch
- prefer deleting stale workflow language over preserving it for history
- do not keep dead compatibility stories in the book