![visual prolog 5.2 key visual prolog 5.2 key](https://i1.rgstatic.net/publication/251676852_VISUAL_PROGRAMMING_IN_PROLOG/links/542944050cf2e4ce940c9672/largepreview.png)
VISUAL PROLOG 5.2 KEY CODE
Code for TASM 5 Assembler, command-line call for compilation: OK, so here is the Assembly language code: = _apply_func.asm = %This program should produce " result = 60" (sum of ). % converts a predicate to a doubleword/addressįunc2dword(FUNC,DW):- DW = cast(dword,FUNC). % where arg-1 is a predicate-domain, such as "dom_iii"Īfter you compile the Assembly language code, you could create a simple “EasyWin” Visual Prolog project, with the following ines: PREDICATES (i,i,i) language c % <- example domain GLOBAL PREDICATESĪpply_func(DWORD,ListDomain) -(i,i) language c However, before you (even begin to) look at the Assembly Language Code, the following simple definitions in Visual Prolog (5.*) are a prerequisite for easier understanding: GLOBAL DOMAINSĭom_iii = determ INTEGER (INTEGER,INTEGER,INTEGER) If you understand Assembly Language and intend to use this code for other (meta-programming) tasks, all you have to do is modify just a couple of lines in the code that follows. The only difference between the way it works for Visual Prolog and the way it might work for another Prolog (or -indeed- ANY programming language, using a ‘C’-calling convention) is the Visual-Prolog-specific structure of a LIST, which in Visual Prolog has a different form than in all other languages. However, this does not exist in Visual Prolog, which sacrifices such “luxuries” for speed (which is the reason I also often use ISO-Prolog compilers, such as LPA-WinProlog and SWI-Prolog).Īnyway… The code you are about to see can be useful more generally, as an example of Prolog meta-programming, implemented in Assembly Language. Now, in ISO-Prolog there is a standard predicate known as “univ”, written as “ =.“, which turns a list like into a predicate call such as PRED(ARG1,ARG2,…). here is an Assembly language predicate, that takes as inputs another (external) predicate’s memory-address and a ( Visual Prolog-) argument-list, and calls this (external) predicate, using the (arbitrary-length-) list of N arguments, as arguments of “arity N”:Īpply_func(PRED, ) PRED(Arg1,Arg2,…) They also have an intrinsic fascination in themselves, as general tools for Prolog meta-programming.Į.g. Prolog even further, potentially valuable for a multitude of other purposes. Recently, I discovered some Assembly language techniques to enhance G.I.S.
![visual prolog 5.2 key visual prolog 5.2 key](http://www.mit.jyu.fi/opiskelu/seminaarit/bak/visual_prolog/leipa07.gif)
Code modifications could therefore be done very quickly and most mistakes were (semi-)automatically corrected by the interpreter’s own enhanced error-checking capabilities. Prolog produced immediate results, without any need for (often tedious) EXE-file compilation. Prolog for easy immediate experimentation: Coding in G.I.S. A multitude of extra predicates, implemented in pure Assembly language, became available through G.I.S. So, the only way to implement ISO-Prolog functionality in Visual Prologis to extend the “ PIE Interpreter” (and G.I.S. Of course, such attempts are inherently limited by the internal design of Visual Prolog compilers. Ever since I started using the Visual Prolog compilers (and the PDC Prolog compilers preceding them) I was fascinated by the possibilities of implementing additional ISO-Prolog functionality in Visual Prologthrough Assembly Language and ‘C’.