Path: utzoo!attcan!utgpu!news-server.csri.toronto.edu!rutgers!usc!samsung!munnari.oz.au!goanna!ok From: ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) Newsgroups: comp.lang.prolog Subject: Re: Standard ---> IBM PROLOG translation Keywords: translation Message-ID: <3850@goanna.cs.rmit.oz.au> Date: 30 Sep 90 12:44:00 GMT References: <2574@dsacg3.dsac.dla.mil> Organization: Comp Sci, RMIT, Melbourne, Australia Lines: 50 In article <2574@dsacg3.dsac.dla.mil>, ntm1169@dsacg3.dsac.dla.mil (Mott Given) writes: > This is a program that will translate Edinburgh style PROLOG syntax to > that of IBM PROLOG, to reduce the number of changes you need to make manually. May I respectfully suggest that a better way to translate from Prolog to IBM PROLOG is to write a Prolog program? What you want is something that will read in Prolog code and write out IBM PROLOG code. You will of course want to be wary of "blind" replacement. It would, for example, be asking for trouble to replace 'close' by 'dcio'; consider estimated_distance_to_goal(State, close) % not 'distant' Better still, by using a Prolog program you can translate findall/3 to compute/4 -- do others find it strange that "compute" and "computable expressions" are unrelated? -- using a rule like prolog_to_PROLOG(findall(Template, Generator, List) ,compute(list, Template, Generator1, List) ) :- prolog_to_PROLOG(Generator, Generator1). The thing that puzzles me most is that Chapter 13 of the IBM PROLOG manual states clearly and explicitly in the very first paragraph that IBM PROLOG can process programs written with the Edinburgh syntax and using predicates that are normally part of an [sic] Prolog implementation for the Edinburgh syntax. You can switch freely between syntaxes in your program, and programs written in Edinburgh syntax can use all the built-in predicates and data types of IBM PROLOG. IBM's "Edinburgh" syntax (called 'synt2') isn't _quite Edinburgh syntax, but it's close enough for government work. I note that > REPL=(1,0,C":-",C"<-"), <- and :- are both accepted in *both* syntaxes, and that IBM PROLOG supports abolish/2, assert/1, asserta/1, ... > REPL=(1,0,C"abolish",C"delax"), > REPL=(1,0,C"assert",C"addax"), > REPL=(1,0,C"asserta",C"addax"), so that the most you should have to do to get at them in an IBM PROLOG program is to stick 'built2:' in front of them. The same applies to pretty well all the other predicates listed in the message. see/1 and tell/1 are provided. open/ and create/ aren't, but then there is no (de facto or ISO) standard predicate called create/. Admittedly, the manual I have is for Version 1 Release 1 on VM/SP, but if IBM's MVS release of IBM PROLOG differs significantly from IBM's VM/SP release, other Prolog vendors will have difficulty keeping the smiles off their faces. -- Fixed in the next release.