moonrockz/rego/compile does not have a README file

    CompileError

    pub(all) suberror CompileError {
    DuplicateImportAlias(alias_name~ : String, span~ :
    SourceSpan
    )
    InvalidImport(path~ : String, span~ :
    SourceSpan
    )
    ConflictingRuleKind(path~ : String, span~ :
    SourceSpan
    )
    UnsafeVar(name~ : String, span~ :
    SourceSpan
    )
    CyclicRule(cycle~ : ReadOnlyArray[String], span~ :
    SourceSpan
    )
    UnstratifiedNegation(cycle~ : ReadOnlyArray[String], span~ :
    SourceSpan
    )
    DuplicateDefault(path~ : String, span~ :
    SourceSpan
    )
    InvalidDefault(message~ : String, span~ :
    SourceSpan
    )
    InvalidRuleHead(message~ : String, span~ :
    SourceSpan
    )
    UndefinedFunction(name~ : String, span~ :
    SourceSpan
    )
    WrongArity(name~ : String, expected~ : Int, actual~ : Int, span~ :
    SourceSpan
    )
    InvalidNumber(text~ : String, span~ :
    SourceSpan
    )
    DuplicateLocalVar(name~ : String, span~ :
    SourceSpan
    )
    InvalidWithTarget(target~ : String, span~ :
    SourceSpan
    )
    } derive(Eq,
    Debug
    )

    Typed diagnostics raised when compiling Rego v1 modules or queries into HIR and structured Plan IR.

    CompiledBranch

    pub struct CompiledBranch {
    num_slots : Int
    body : ReadOnlyArray[Stmt]
    result : Operand
    } derive(Eq,
    Debug
    )

    A compiled branch inside an else chain.

    CompiledClause

    pub struct CompiledClause {
    num_slots : Int
    param_patterns : ReadOnlyArray[Pattern]
    key_operands : ReadOnlyArray[Operand]
    leaf_kind : DynamicLeafKind
    value_operand : Operand
    body : ReadOnlyArray[Stmt]
    else_branches : ReadOnlyArray[CompiledBranch]
    rule_metadata :
    Value
    ?
    chain_metadata :
    Value
    ?
    } derive(Eq,
    Debug
    )

    A compiled clause for a complete rule, partial set, partial object, dynamic ref-head rule, or user-defined function.

    CompiledPolicy

    type CompiledPolicy

    An immutable compiled Rego v1 policy ready for VM execution.

    CompiledPolicy::builtins

    Returns the immutable built-in registry bound to this compiled policy.

    CompiledPolicy::lookup_node

    fn CompiledPolicy::lookup_node(self : CompiledPolicy, path : ArrayView[String]) -> CompiledRuleNode?

    Looks up a compiled rule or package node by path segments under data.

    CompiledPolicy::root

    Returns the compiled virtual document tree rooted at data.

    CompiledPolicy::rule_paths

    fn CompiledPolicy::rule_paths(self : CompiledPolicy) -> ReadOnlyArray[ReadOnlyArray[String]]

    Returns all compiled rule and function paths under data.

    CompiledQuery

    type CompiledQuery derive(Eq,
    Debug
    )

    An immutable compiled Rego v1 query ready for VM execution.

    CompiledQuery::body

    fn CompiledQuery::body(self : CompiledQuery) -> ReadOnlyArray[Stmt]

    Top-level scheduled Plan VM statements for this query.

    CompiledQuery::expr_slots

    fn CompiledQuery::expr_slots(self : CompiledQuery) -> ReadOnlyArray[Int]

    Result value slots for each top-level expression in the query.

    CompiledQuery::num_slots

    fn CompiledQuery::num_slots(self : CompiledQuery) -> Int

    Number of local variable slots required by this query frame.

    CompiledQuery::output_bindings

    fn CompiledQuery::output_bindings(self : CompiledQuery) -> ReadOnlyArray[(String, Int)]

    User-visible variable bindings (name, slot) recorded per solution.

    CompiledRuleNode

    pub enum CompiledRuleNode {
    Package(children~ : ReadOnlyArray[(String, CompiledRuleNode)])
    Complete(clauses~ : ReadOnlyArray[CompiledClause], default_value~ :
    Value
    ?, default_branch~ : CompiledBranch?)
    PartialSet(clauses~ : ReadOnlyArray[CompiledClause])
    VirtualObject(static_children~ : ReadOnlyArray[(String, CompiledRuleNode)], dynamic_clauses~ : ReadOnlyArray[CompiledClause])
    Function(arity~ : Int, clauses~ : ReadOnlyArray[CompiledClause], default_value~ :
    Value
    ?)
    } derive(Eq,
    Debug
    )

    A node in the compiled data.* virtual document tree.

    CompiledTemplatePart

    pub enum CompiledTemplatePart {
    Lit(String)
    Interp(stmts~ : ReadOnlyArray[Stmt], slot~ : Int)
    } derive(Eq,
    Debug
    )

    One part of a compiled Rego template string ($"..." or $`...` ).

    DynamicLeafKind

    pub enum DynamicLeafKind {
    DynamicValue
    DynamicSetElem
    } derive(Eq,
    Debug
    )

    Leaf contribution mode for dynamic ref-head object clauses (a.b[c].d := v or a.b[c].d contains v).

    Operand

    pub enum Operand {
    Const(
    Value
    )
    Local(Int)
    Input
    Data
    } derive(Eq,
    Debug
    )

    A pure operand read by a Plan VM statement. Read-only externally; only pkgs/rego/compile constructs validated operands.

    Pattern

    pub enum Pattern {
    PConst(
    Value
    )
    PLocal(Int)
    PWildcard
    PArray(ReadOnlyArray[Pattern])
    PObject(ReadOnlyArray[(Pattern, Pattern)])
    PSet(ReadOnlyArray[Pattern])
    } derive(Eq,
    Debug
    )

    A structural unification pattern (lhs = rhs or function parameter pattern).

    RefKey

    pub enum RefKey {
    Static(String)
    Dynamic(Operand)
    BindKey(Int)
    BindPattern(Pattern)
    } derive(Eq,
    Debug
    )

    One segment of a runtime reference lookup base[seg0][seg1]....

    Stmt

    pub enum Stmt {
    Block(ReadOnlyArray[Stmt])
    Break(Int)
    AssertTruthy(Operand)
    AssertCollection(Operand)
    Assign(dst~ : Int, src~ : Operand)
    Equal(lhs~ : Operand, rhs~ : Operand)
    Unify(lhs~ : Pattern, rhs~ : Pattern)
    EvalRef(dst~ : Int, base~ : Operand, segments~ : ReadOnlyArray[RefKey])
    Scan(domain~ : Operand, key_slot~ : Int?, val_slot~ : Int)
    WalkScan(target~ : Operand, out~ : Pattern)
    Not(ReadOnlyArray[Stmt])
    CallBuiltin(name~ :
    BuiltinName
    , args~ : ReadOnlyArray[Operand], dst~ : Int?)
    CallRule(path~ : ReadOnlyArray[String], dst~ : Int)
    CallFunc(path~ : ReadOnlyArray[String], args~ : ReadOnlyArray[Operand], dst~ : Int)
    With(overlays~ : ReadOnlyArray[WithOverlay], body~ : ReadOnlyArray[Stmt])
    ElseChain(branches~ : ReadOnlyArray[CompiledBranch], dst~ : Int)
    MakeArray(dst~ : Int)
    ArrayPush(arr~ : Int, elem~ : Operand)
    MakeSet(dst~ : Int)
    SetAdd(set~ : Int, elem~ : Operand)
    MakeObject(dst~ : Int)
    ObjectInsert(obj~ : Int, key~ : Operand, val~ : Operand)
    BuildArrayComp(dst~ : Int, elem~ : Operand, body~ : ReadOnlyArray[Stmt])
    BuildSetComp(dst~ : Int, elem~ : Operand, body~ : ReadOnlyArray[Stmt])
    BuildObjectComp(dst~ : Int, key~ : Operand, val~ : Operand, body~ : ReadOnlyArray[Stmt])
    FormatTemplate(dst~ : Int, parts~ : ReadOnlyArray[CompiledTemplatePart])
    ResultSetAdd(bindings~ : ReadOnlyArray[(String, Int)])
    } derive(Eq,
    Debug
    )

    A structured Plan VM instruction.

    WithOverlay

    pub struct WithOverlay {
    target : WithTarget
    value : WithValue
    } derive(Eq,
    Debug
    )

    One resolved with modifier overlay.

    WithTarget

    pub enum WithTarget {
    WithInput(ReadOnlyArray[String])
    WithData(ReadOnlyArray[String])
    WithBuiltin(
    BuiltinName
    )
    } derive(Eq,
    Debug
    )

    Target of a with <target> as <value> overlay.

    WithValue

    pub enum WithValue {
    WithOperand(Operand)
    WithFuncPath(ReadOnlyArray[String])
    WithBuiltinName(
    BuiltinName
    )
    } derive(Eq,
    Debug
    )

    Replacement supplied by a with <target> as <value> overlay.

    compile_modules

    Compiles a set of Rego v1 AST modules into an immutable CompiledPolicy containing resolved virtual document rules, scheduled HIR, and structured Plan VM instructions.

    compile_query

    fn compile_query(query :
    Query
    , policy : CompiledPolicy) -> CompiledQuery raise CompileError

    Compiles a standalone Rego v1 query against a CompiledPolicy into an immutable CompiledQuery.