feat(lang): implement RFC-LANG-0002 unified semantics (breaking)
One Markdown-to-program mapping, no version selector or legacy mapper. Frontend/runtime: - resolve @exec/@knowledge heading declarations with nearest-ancestor inheritance; only an Exec H2 is callable; add UnitKind::Knowledge and sem.* diagnostics (mode marker, unit name, exec-without-function, payload nesting/empty, syntax, control stack, params position, version directive, inferred-signature lint) - extract Strong/Emph/inline Code as one-statement carriers, refuse nested carriers, and honour heading segment boundaries so an if/while cannot be closed across a heading - lower if/else/while/end to the existing Branch/Loop/Return IR with a compile-time control stack; keep payload-relative source spans through expression parsing and rewrite them onto the file - accept params(...) only as the first direct Exec H2 payload; keep the existing free-variable inference and named-only rule for inferred signatures; fix duplicate-mode/else/end and Knowledge-body inertness - reject marqdo_semantics/syntax front matter directives Data and tests: - migrate stdlib/**/*.mq.md, regenerate stdlib.json digest - migrate examples and the full semantics/negative/runtime corpus to the only current syntax; expected values/runtime codes preserved - migrate Rust-embedded .mq.md fixtures, init template, CLI help and security-lane fixtures Verified: cargo fmt --check, cargo clippy -D warnings and cargo test --workspace --locked (green).
This commit is contained in:
1 parent
49835424ee
commit
e029853e32
375 files changed
+6591
-4790
No files matched your search
@@ -13,6 +13,36 @@ pub mod codes {
|
||||
pub const MARKDOWN_INERT_EXECUTABLE: &str = "markdown.inert_executable";
|
||||
/// Front matter is malformed or appears somewhere other than the document start.
|
||||
pub const FRONTMATTER_INVALID: &str = "frontmatter.invalid";
|
||||
/// A heading uses an invalid `@exec`/`@knowledge` mode marker.
|
||||
pub const SEM_INVALID_MODE_MARKER: &str = "sem.invalid_mode_marker";
|
||||
/// A mode declaration has no semantic heading name.
|
||||
pub const SEM_EMPTY_UNIT_NAME: &str = "sem.empty_unit_name";
|
||||
/// Duplicate canonical heading/unit name in one scope.
|
||||
pub const SEM_DUPLICATE_UNIT_NAME: &str = "sem.duplicate_unit_name";
|
||||
/// Executable payload appears under no Exec H2 function.
|
||||
pub const SEM_EXEC_WITHOUT_FUNCTION: &str = "sem.exec_without_function";
|
||||
/// A payload carrier contains a nested inline structure.
|
||||
pub const SEM_PAYLOAD_NESTED: &str = "sem.payload_nested";
|
||||
/// A payload carrier is empty in an Exec scope.
|
||||
pub const SEM_EMPTY_PAYLOAD: &str = "sem.empty_payload";
|
||||
/// A payload failed semantic statement validation.
|
||||
pub const SEM_SYNTAX: &str = "sem.syntax";
|
||||
/// `else` does not bind an open `if`.
|
||||
pub const SEM_UNMATCHED_ELSE: &str = "sem.unmatched_else";
|
||||
/// A second `else` appears for one `if`.
|
||||
pub const SEM_DUPLICATE_ELSE: &str = "sem.duplicate_else";
|
||||
/// `end` closes no open frame.
|
||||
pub const SEM_UNMATCHED_END: &str = "sem.unmatched_end";
|
||||
/// A control frame is not closed before the heading ends.
|
||||
pub const SEM_UNCLOSED_CONTROL: &str = "sem.unclosed_control";
|
||||
/// `params(...)` is not the first direct Exec H2 payload.
|
||||
pub const SEM_SIGNATURE_POSITION: &str = "sem.signature_position";
|
||||
/// A version directive such as `marqdo_semantics` is forbidden.
|
||||
pub const SEM_UNSUPPORTED_VERSION_DIRECTIVE: &str = "sem.unsupported_version_directive";
|
||||
/// `run` found no callable entry function.
|
||||
pub const SEM_NO_ENTRY_FUNCTION: &str = "sem.no_entry_function";
|
||||
/// A signature was inferred rather than declared.
|
||||
pub const SEM_INFERRED_SIGNATURE: &str = "sem.inferred_signature";
|
||||
/// An executable payload failed to parse as an expression or statement.
|
||||
pub const EXPR_PARSE: &str = "expr.parse";
|
||||
/// A function name is referenced but no such function exists.
|
||||
|
||||
Reference in new issue
Block a user