[fpc-other] PROLOG written in Pascal

Mark Morgan Lloyd markMLl.fpc-other at telemetry.co.uk
Sat Sep 20 22:20:34 CEST 2014


Hans-Peter Diettrich wrote:
> Mark Morgan Lloyd schrieb:
>> Is anybody interested in a PROLOG interpreter written in Turbo Pascal, 
>> plus a couple of typeset articles which outline how it works internally?
>>
>> When I found it I was wondering whether it could be usefully used to 
>> handle inference rules in a Delphi/FPC/Lazarus program, in the same 
>> way that MS use Prolog for some of their network configuration stuff. 
>> However it turns out that it is coded explicitly for Turbo Pascal with 
>> a garbage collector on top of the normal heap, which I think implies 
>> that porting it to FPC would need either a mark/release facility or 
>> multiple heaps which could be "thrown away" when no longer needed.
> 
> Reference counting is just another way to implement garbage collection, 
> and is already available (for Interfaces). Wouldn't this be sufficient 
> for the Prolog interpreter?

Probably not in its current form, since it is implemented in a very 
Lisp-like fashion with lots of tiny cells in linked lists. If rewritten 
with coarser granularity then there's lots of ways of doing it, noting 
that in the general case rules and queries don't have to be textual.

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]


More information about the fpc-other mailing list