Are there Prolog compilers that can be optimized by targeting specific requests?

Given Prolog's theory and a small set of possible queries, it seems plausible that it would be possible to generate the required search tree / graph, and then optimize / reduce it to something that can be easily translated into a fast procedural program.

Obviously, the ability to issue generic queries to the Prolog database will be lost after compiling it this way. Prolog theory would also have to include some type of I / O, otherwise reduction would leave only static result sets.

Are there any Prolog systems or compilers that have such a tool, or are there any relevant documents on this?

+4
source share
1 answer

I don’t know anything specific, but what you are looking for are terms such as “specialized compiler”, “specialization of the program”, “assembly of the semantic direction” and “partial evaluation”. Try them with and without the "Prolog" in your request; The functional programming community has also done a lot of research in this area.

Note that Prolog completes Turing, so no approach would be perfect. Subsets of Prolog are known, such as Datalog, but they do not have I / O. I believe that Datalog is described in "Art of Prolog" by Sterling and Shapiro. (Datalog still contains variables, although it's good enough for simple stream-based input / output.)

If this does not work, consider cstheory .

+3
source

Source: https://habr.com/ru/post/1344668/


All Articles