next up previous contents
Next: Parsing and generation Up: Procedural Semantics Previous: Solving a query


Note that I did restrict a grammar to consist only of a set of definite clauses defining the predicate sign/1. However, I will also use definite clauses of $ \cal {R}$($ \cal {L}$) to define meta-interpreters for such grammars. For these meta-interpreters I will assume the operational semantics sketched above. In such cases I treat the definite clauses defining sign as data; a clause:

\mbox{\it sign}(\mbox{\rm X}_{0}) \mbox{\tt :-} \mbox{\it si...{\rm X}_{1}) \dots
\mbox{\it sign}(\mbox{\rm X}_{n}), \phi.
is represented as the clause

\mbox{\it rule}(\mbox{\rm X}_{0},\langle \mbox{\rm X}_{1}, \dots \mbox{\rm X}_{n}\rangle) \mbox{\tt :-} \phi.
i.e. the body of the clause is represented as a list. A meta-interpreter for $ \cal {R}$($ \cal {L}$) thus may be defined as in program 6, which follows the procedural semantics of $ \cal {R}$($ \cal {L}$), i.e. it is a top-down proof procedure with a left-most computation rule and a depth-first search rule.

\head{\mbox{\it refutation}(\mbox{\rm Goal}) \mbox{\tt :-}}
\body{ \mb...
...ation}(\mbox{\rm H}),}
\body{ \mbox{\it refutations}(\mbox{\rm T}).}
For example, a rightmost computation rule can be implemented by defining the predicate refutations as follows:

\head{\mbox{\it refutations}(\langle\rangle).}
\head{\mbox{\it refutati...
...ations}(\mbox{\rm T}),}
\body{ \mbox{\it refutation}(\mbox{\rm H}).}

Noord G.J.M. van