Expand description
Zero-allocation N-Triples pattern compiler.
Accepts a single N-Triples pattern line such as
<http://example.org/Alice> <schema:knows> ?who .
and compiles it into a flat bytecode program that webizen::bytecode::execute_program
can run directly against a &[NQuin] slice without any heap allocation.
§Bytecode encoding
Each instruction occupies either 1 or 9 bytes:
| Opcode byte | Operand (bytes 1-8) | Meaning |
|---|---|---|
| 0x01 | u64 LE hash | MatchSubject(hash) |
| 0x02 | u64 LE hash | MatchPredicate(hash) |
| 0x03 | u64 LE hash | MatchObject(hash) |
| 0x04 | — | HaltIfFalse (skip this Quin) |
| 0x00 | — | End / accept this Quin |
Variable tokens (?name) produce no instruction — the corresponding
Quin vector is treated as a wildcard.
Enums§
Constants§
- OP_END
- OP_
EVAL_ FORBID - OP_
EVAL_ OBLIGATE - OP_
EVAL_ PERMIT - OP_
HALT_ IF_ FALSE - OP_
HALT_ VIOLATION - OP_
MATCH_ OBJECT - OP_
MATCH_ PREDICATE - OP_
MATCH_ SUBJECT
Functions§
- compile_
ntriples_ to_ bytecode - Compile a single N-Triples pattern line into
program. - hash_
token - Resolve a single N-Triples token to its 64-bit Quin vector value.