[m-users.] A predicate taking a lists of predicates as input?

Volker Wysk post at volker-wysk.de
Sat Sep 27 00:22:02 AEST 2025


Am Freitag, dem 26.09.2025 um 15:29 +0200 schrieb Tomas By:
> Just tying up some loose ends here.
> 
> On Wed, 24 Sep 2025 18:35:00 +0200, Volker Wysk wrote:
> > DCGs are just a handy syntax for predicates with a state variable at the
> > end
> > of the arguments.
> 
> No, DCG is parsing technology.

Sure it is parsing technology. But it's easy enough to see how your DCG
rules will be evaluated. It's a thin layer on top the backtracking, which
evaluates ordinary Mercury. It's syntactic sugar. 

Section 3.8 of the Language Reference Manual specifies how a DCG rule will
be interpreted. The predicate "transform" can be used as a meta interpreter,
but it also can be read as instructions on how to rewrite a DCG rule, such
that it becomes ordinary Mercury.

Cheers,
Volker


More information about the users mailing list