prologmetaprogrammingprolog-metainterpreter

examples of prolog meta-interpreter uses?


I'm reading several texts and online guides to understand the possibilities of prolog meta-interpreters.

The following seem like solid use cases:

Question - what other compelling use-cases are there?


Solution

  • Quoting from A Couple of Meta-interpreters in Prolog which is a part of the book "The Power of Prolog":

    Further extensions

    Other possible extensions are module systems, delayed goals, checking for various kinds of infinite loops, profiling, debugging, type systems, constraint solving etc. The overhead incurred by implementing these things using MIs can be compiled away using partial evaluation techniques. [...]

    This quite extends your proposed uses, e.g., by

    1. changing the search of p(X) :- p(s(X)). to detect loops (including "obvious" ones like this one),
    2. hinting at where most compute time is spent ("profiling"),
    3. or by reducing a program to a simpler fragment that is easier to analyse—but still has the property of interest: unexpected non-termination (explained via ), unexpected failure, or unexpected success.