Section "embedding"
We do not combine the unify instruction stream with the build
instruction stream. Instead, we have host language objects for
Prolog clauses and Prolog goals. The host language objects record
further attributes to be able to assert or execute. Host language
functions then allow passing these objects to the Dogelog player.
The host language routines make_defined() and make_special()
yield anonymous predicates. These can then be used as an argument
to add() so that a named predicate in the knowledge base results.
Alternatively, they can be used as a functor of a compound or as
an atom. They then become executable without registering them.
The cross-compiler generates the following calls:
- new Clause(S, H, B, R, K): (host language)
- The constructor creates an object representing a clause with
variable count S, head in-structions H, body instructions B, cut
variable index R and index key K.
- add(F, A, C): (host language)
- The function adds the clause or anonymous predicate C to the
knowledge base for the predicate indicator F/A.
- new Goal(S, B): (host language)
- The constructor creates an object representing a goal with
variable count S, body in-structions B.
- run(G): (host language)
- The function executes the goal G, cuts away its choice points
and undoes its bindings. If the goal fails, it throws a new
error. If the goal throws an error, it re-throws this error. If
the goal succeeds, the built-in succeeds.
- make_defined(L): (host language)
- The function returns an anonymous predicate for the given
clauses L.
- make_special(P): (host language)
- The function returns an anonymous predicate for the special P.
Kommentare