Skip to main content

Module n3_compiler

Module n3_compiler 

Source
Expand description

N3Logic → SHACL → Sentinel Bytecode compiler (CogAI symbolic layer).

The LLM emits N3 assertions on the cold path; this module validates them against compiled SHACL shapes from crate::modalities::logic::shacl and lowers surviving rules to SlgOpcode sequences for the Core-1 Webizen VM. Hot-path execution uses only fixed caller-supplied buffers.

Structs§

AgentIntentFrame
CompiledFormula
CompiledRule
CompiledTriple
N3CompiledProgram

Enums§

CompiledTerm
N3CompileError
N3OutputMode
SentinelError

Constants§

MAX_COMPILED_OPCODES
MAX_COMPILED_QUINS
MAX_CONTEXT_NAMESPACE_SLOTS
MAX_INTENT_SCOPE_SLOTS

Functions§

compile_formula
compile_rule_to_opcodes
Lower one N3 rule into Sentinel opcodes (reuses SHACL terminal semantics).
compile_rule_to_quin
compile_rule_to_zero_heap
compile_rules_with_shacl_gate
SHACL-gated batch compile: validate each rule, then emit opcodes into a fixed buffer.
compile_term
compile_triple
default_observation_shape
Build a default health-observation SHACL gate for LLM-emitted N3 (cold path helper).
execute_compiled_program
Execute compiled opcodes inside the 42 MB SlgArena without heap growth in the eval loop.
triple_to_quin
validate_rule_against_shapes
Returns true when every conclusion triple property path matches a compiled SHACL shape.