Expand description
The solve driver: dispatches a parsed goal into compiled predicates and runs the backtracking loop.
Forward execution inside compiled code is all musttail chains; when
a chain fails it returns 0 all the way back here, and this loop pops
the next choice point, rewinds, and invokes its retry function. The
C stack therefore never grows with Prolog recursion or backtracking
depth — this loop is the trampoline.
Enums§
Functions§
- call_
goal - Dispatch a goal term: control constructs and deterministic builtins
go through
control::try_builtin; everything else is a registry lookup into compiled code. Also used by control continuations (and later by call/1 and findall/3). - drive
- The backtracking driver: pops choice points down to
floor, rewinding and retrying, and unwinds errors to the nearest catch frame. Shared by the top level and findall/3’s bounded sub-search. Returns 1 if a continuation stopped enumeration; otherwise 0 (CP stack drained to floor, or an uncaught error left inm.errorfor the next layer out). - solve
- Solve
goal, capturing solutions via the print continuation.