Wiki Discussion: Meta interpreter

Stated Wiki: Meta Interpreter because it is one of the essential skills all Prolog programmers should posses.

As a community we can share what we know to help all of us acquire this essential skill.

A useful place to start learning about them is A Couple of Meta-interpreters in Prolog by Markus Triska


Personal Notes

Be aware of library(apply_macros) (ref)

static void
registerControlFunctors()
{ static functor_t control[] =
  { FUNCTOR_comma2,
    FUNCTOR_semicolon2,
    FUNCTOR_bar2,
    FUNCTOR_ifthen2,
    FUNCTOR_softcut2,
    FUNCTOR_not_provable1,
    FUNCTOR_colon2,			/* Module:Goal */
#ifdef O_CALL_AT_MODULE
    FUNCTOR_xpceref2,			/* Goal@Module */
#endif
    (functor_t) 0
  };
  functor_t *f;

  for(f	= control; *f; f++)
  { valueFunctor(*f)->flags |= CONTROL_F;
  }
}

(ref)