Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Is there a straight-forward way of compiling Prolog to C?

0
Posted

Is there a straight-forward way of compiling Prolog to C?

0

Two methods of compiling Prolog to C have been reported in the literature: – WAM-based approaches – Continuation-based approaches The WAM-based approach compiles Prolog programs into a sequence of C function or macro calls to WAM instructions. A brief description of this method and some results are given in the paper: Michael R. Levy and R. Nigel Horspool, “Translating Prolog to C: a WAM-based Approach”, in Proceedings of the Second Compulog Network Area Meeting on Programming Languages, and the Workshop on Logic Languages in Pisa, May 1993. (Available by anonymous ftp from csr.uvic.ca:/pub/mlevy/.) The best tutorial for writing a WAM-based compiler or WAM emulator is Hassan Ait-Kaci’s book, “Warren’s Abstract Machine: A Tutorial Reconstruction” (see [1-3] above). A “quick-and-dirty” method is to implement the WAM functions as described in Ait-Kaci’s tutorial, to label each call with a C case label, and then throw a giant switch(P) statement around the entire sequence of calls, where P

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123