feat(frontend): heading scopes, semantic mapping, inference and call validation
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.
This commit is contained in:
1 parent
62a9af05fd
commit
8003907f4e
10 files changed
+2763
-3
No files matched your search
@@ -11,11 +11,13 @@ authors.workspace = true
|
||||
[dependencies]
|
||||
unicode-normalization = { workspace = true }
|
||||
marqdo-span = { workspace = true }
|
||||
unicode-ident = { workspace = true }
|
||||
sha2 = { workspace = true }
|
||||
marqdo-markdown = { workspace = true }
|
||||
marqdo-expression = { workspace = true }
|
||||
marqdo-ir = { workspace = true }
|
||||
marqdo-value = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
|
||||
|
||||
[dev-dependencies]
|
||||
serde_json = { workspace = true }
|
||||
Reference in new issue
Block a user