Implement the P0/P1 frontend from spec/mapping.md, spec/evaluation.md:
- units: heading scope index (level-1 namespace, level-2 function, level>=3
section), range computation, duplicate/empty-name diagnostics, GitHub anchor
table kept separate from canonical ids, and warnings for would-be execution
nodes outside function bodies.
- map: AST-to-IR mapping where role comes from node kind + position. Strong is
an execution statement, Emph a return, ordered list a branch, bullet list a
loop sequence, block quote a call; invalid shapes are hard
markdown.invalid_construct errors, never prose fallback. Payload parsing
errors are mapped from payload-relative to file-relative spans.
- payload: strict text/code payload concatenation with exact span mapping
(including code-span delimiter handling) used to rewrite expression spans
onto the source file.
- signature: optional `(name: Type = const)` paragraph declaration; defaults
must be compile-time constants; duplicates and malformed declarations are
errors.
- infer: definite-assignment data-flow parameter inference (must/may/ambiguous
states, loop first-iteration handling, branch joins) per blueprint S-04.
- calls: static call validation of arity/named arguments/builtin signatures
after all signatures are known; inferred signatures accept named args only.
- resources: inert Formula/Code resources with owning units and SHA-256
content hashes.
- analyze: pipeline (parse -> units -> frontmatter imports -> map -> signature/
inference -> module -> call checks) that never executes anything.
Tests include factorial recursion, loop counter, prose-invariance (IR equal
modulo spans), and hard-error cases.