3 ms·
One approach to taking existing Prolog code and executing it with different semantics (like a different search algorithm, but also tracing, debugging, etc.) is
by tom_mellior 8y ago
One approach to taking existing Prolog code and executing it with different semantics (like a different search algorithm, but also tracing, debugging, etc.) is through metainterpreters. These are Prolog programs that interpret Prolog programs; you can write one in a few dozen lines. You can find several examples at https://www.metalevel.at/acomip/ https://www.metalevel.at/acomip/, including one in the "Changing the search strategy" section that does what you want.
The drawback of metainterpretation is that it is, well, an interpreter layered on top of (on many systems) another interpreter. If you need your Prolog code to be really really "fast", then this approach may be "too slow". (Quotes because people love complaining about the speed of computation even in many situations where it really does not matter.)
A different approach is to use code generation. Prolog programs are collections of Prolog terms; once you have written the abstract computation you want, you can write a program that takes that code, mangles it into a different form, then compiles that new form just as if you had written it by hand.
So in summary, the separation you ask for is not there, but you have much more powerful tools than most other languages to implement it yourself quite easily.