Hi,
I implemented a COM based call interface to SICStus Prolog for Dolphin.
The raw COM interface enables you doing things like:
sics := SICStusProlog default. "a default COM wrapper instance"
sics qExec: 'ensure_loaded(app(gene))'.
sics qExec: 'ensure_loaded(app(england))'.
sics qOpen: 'father(''Henry VIII'',C)'.
[sics qNext] whileTrue:[
Transcript show: (sics qValue: 'C') ; cr].
sics qClose.
Which gives the following output to Transcript:
Mary Tudor
Elizabeth I
Edward VI
The COM interface is then wrapped into a more general <Prolog> class,
allowing
things like:
Prolog loadAll: #('gene' 'england' 'permutation').
p1 := Prolog collectionToPrologList: #(1 2 3).
p2 := Prolog collectionToPrologList: #(2 1 3).
Prolog exec: ('permutation(%1,%2)'
formatWith: p1
with: p2).
==>true
or:
Prolog query: 'mother(X,Y)'
==>#(#('Margaret Beaufort' 'Henry VII') #('Elizabeth of York' 'James IV')
#('Elizabeth of York' 'Henry VIII') #('Elizabeth of York' 'Mary')
#('Margaret Tudor' 'James V') #('Margaret Tudor' 'Lady Margaret Douglas')
#('Catherine of Aragon' 'Mary Tudor') #('Anne Boleyn' 'Elizabeth I') #('Jane
Seymour' 'Edward VI') #('Mary' 'Lady Frances Brandon') #('Mary of Guise'
'Mary Queen of Scots') #('Lady Margaret Douglas' 'Henry Lord Darnley')
#('Lady Margaret Douglas' 'Lord Charles Stuart') #('Lady Frances Brandon'
'Lady Jane Grey') #('Lady Frances Brandon' 'Lady Catherine Grey') #('Lady
Frances Brandon' 'Lady Mary Grey') #('Mary Queen of Scots' 'James I'))
Although the thingy is not yet totally complete (e.g. lacks a
Prolog>>prologListToCollection:),
those of you, who are interested should mail me.
I always remember the times of Smalltalk V/286 with it's famous <Prolog>
class.
(I believe it was reimplemented in Squeak).
That was great, having a kind of logic server embedded in Smalltalk !
The metalinguistic approach has almost always disadvantages, speed or
insufficient
language subset implementation, mostly both.
But this here, is definitely better, since it enables access to one of the
most powerul
Prolog implementations available. SICStus is *very* complete and *very*
fast.
(>14 MLIPS on my machine)
I know that SICStus isn't a free product. Should this be a problem, I might
get persuaded
to do a similar thing for Amzi! Prolog.
But you can get a free 30 day license of SICStus.
http://www.sics.seN.B.: Since the COM interface relies on the original SICStus vbsp.dll (the
VB API), I decided
to implement it the most natural way, in VB.
Therefore the VB runtime is needed. (For now, perhaps I redesign it for pure
C++/ATL in the future).
Ingo