Meta interpreter

Note: If you have Trust level: Basic you can edit this by clicking on the edit icon in the lower right. Capture

Note: Do not reply to this topic; questions, concerns, comments, etc. are to be handled in
Wiki Discussion: Meta interpreter

Note: This is just to get the topic started and hopefully others to jump in and make this useful. Even if you are brand new to Prolog, this is such a basic and fundamental concept that you can and should join in to help improve the value of this Wiki. Join the discussion at Wiki Discussion: Meta interpreter

There are roughly 5 classes of predicates relevant to meta-interpretation:

  • With predicate property foreign. These are written in C (or have a C wrapper to Java/Python/…). You cannot do clause/2 and thus you cannot meta-interpret them.

  • Stuff handled by the compiler that has a clause that is exactly the same. Below is an example. You can get a clause, but this is the same as the original clause and thus you make no progress :frowning: You find the full set in boot/, currently from line 318.

    (G1, G2) :- call((G1, G2)).
  • Normal Prolog code that is part of the core system. They are reported as built_in.

  • Normal Prolog code from the libraries. The way to find them is using the imported_from(Module) property and module_property/2, checking for class(library)

  • User code. This may be local to the module (or not in a module) or imported user code.

The first two cannot be meta-interpreted. The rest is a choice up to the user.