Internals

Types documented for contributors — not part of the stable surface.

MatchMaker.NodePlan — Module
NodePlan

Per-node matching plan, indexed by pattern-IR node index. A Moshi ADT — the variant is the match instruction the engine dispatches on.

Extended help

  • Literal() — match iff isequal.
  • Slot(var_id, optional) — a slot/optional marker occurrence.
  • Segment(var_id) — a segment marker occurrence.
  • Call(op, head, children) — free head: positional children.
  • SeqCall(op, head, children) — ordered-sequence matching: a contiguous run of subject arguments per segment child. Used for an associative-not-commutative head, or any free head whose children include a segment — a node containing a sequence doesn't have to be associative; associativity only adds identity coercion.
  • CommCall(op, head, fixed, slots, optionals, segments) — commutative-not-associative head: children partitioned by kind.
  • ACCall(op, head, fixed, slots, optionals, segments) — AC head: children partitioned by kind.

op is operation(node); head is the node index of a symbolic-head obligation — nonzero when the operation is itself symbolic (including head-slots like slot(f)(x)).

source
MatchMaker.NetState — Type
NetState

One trie node of a DiscrimNet — the continuation frontier shared by all patterns whose preorder label prefixes reach it.

Extended help

  • ops: (op, arity) → next — deterministic call-head transition.
  • opwilds: arity → next — head-marker call (slot(f)(…)) — any op.
  • literals: literal leaf expr → next.
  • defers: SeqCall/CommCall/ACCall subtree edges — confirm iscall + op (nothing = head-marker, any op) + arity bounds, then hand the whole subtree to the engine.
  • wild: slot transition — fires on any subject node (0 = none).
  • finals: rule ids whose label sequence ends here.
source