Implement the FrameLab compiler from the frozen v0.2 spec.
Treat these files as the source of truth:
docs/framelab-v02-frozen.mddocs/framelab-v02-impl-plan.mddocs/framelab-lex-parse-contract.md
If code and docs disagree, follow the docs and leave a note in your summary.
Do not redesign the language. Do not change grammar, semantics, or validation rules unless implementation is impossible. If you find a contradiction or blocker, stop at the smallest safe patch and explain it clearly instead of inventing behavior.
Prefer small, reviewable diffs. Preserve existing file organization unless a change is necessary. Add or update tests with every meaningful code change. Prefer clarity over cleverness. Do not add new dependencies unless they materially simplify the implementation.
Follow this phase order unless the task explicitly says otherwise:
- tokenizer
- parser to raw AST
- semantic validation passes
- normalized IR
- emitter
Do not skip ahead to emitter work before tokenizer, parser, and validation are in place.
The parser must preserve raw component body statements. Do not normalize during parsing. Do not discard duplicate top-level statements in the parser. Structural parsing errors belong in the parser. Language-rule enforcement belongs in semantic validation unless the frozen spec explicitly makes it a parse-time error.
Implement references exactly per docs/framelab-lex-parse-contract.md.
Key rule:
- standalone
@referenceis parsed structurally - invalid standalone dot-path references such as
@product.titlemust fail per the frozen lex/parse contract - do not invent alternate reference syntax
Use the frozen validation model and rule codes from the docs. Keep rule staging consistent with the implementation plan. Do not silently downgrade errors to warnings or upgrade warnings to errors without documenting why.
Add focused fixtures for:
- valid grammar cases
- expected parse failures
- expected semantic validation failures
- regression coverage for any bug you fix
When possible, keep test names aligned with grammar productions or rule codes.
When you finish a task, summarize:
- what changed
- what tests were added or updated
- any unresolved blockers
- any doc/code mismatch discovered
If you cannot proceed without changing the frozen spec:
- implement the smallest safe subset
- leave the surrounding code clean
- explain the blocker precisely
- do not expand scope on your own