[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Mon Apr 26 23:52:18 2001 
Subject:Re: calling prolog from pop-11 
From:Aaron Sloman See text for reply address 
Volume-ID:1010427.01 

[To reply replace "Aaron.Sloman.XX" with "A.Sloman"]

David L Reece <ug29dlr@cs.bham.ac.uk> writes:

> Date: Thu, 26 Apr 2001 18:01:43 +0000 (UTC)
> ..
> I have a large pop-11 program, with a NLP system written in prolog. I
> wanted to use pop-11 as the base language, but I am having problems
> intergrating the two languages. Basically what I'm after are methods for:
>
> * Calling prolog procedures (i.e. calling foo(Arg1, Arg2). from pop-11)
> * Reading prolog variables (i.e. the result of the foo(Arg1, Arg2). )

Read these files


    PROLOG HELP MIXED_LANGUAGES
        In Ved, if running prolog do
            ENTER help mixed_languages
        otherwise:
            ENTER prolog help mixed_languages
        which can be shortened to
            ENTER ploghelp mixed_languages
This tells you about

        (a)    prolog_newvar() -> <prologvar>
               (See PLOGHELP * TERMSINPOP)

        (b)    prolog_maketerm({<word|list|prologterm>}*, <word>, <integer>)
                                                            -> <prologterm>
               (See PLOGHELP * TERMSINPOP)

        (c)    prolog_deref(<prologvar:V>) -> <term>
               (See PLOGHELP * TERMSINPOP)

        (d)    prolog_full_deref(<prologvar:V>) -> <term:T>
               (See PLOGHELP * PROLOG_DEREF)

        (e)    prolog_invoke(<prolog_term>) -> <boolean>
               (See PLOGHELP * PROLOG_INVOKE)

    The file includes some examples.

See also
    HELP PLOGINPOP
    PLOGHELP PLOGTOPOP

> * Intergrating the two languages in a single file - how do I make pop-11
> realise that I am writing prolog as well as pop-11?

The most complex example of this that I know of is the Prolog
Tracer/Tutor written by Chris Mellish. See

    $usepop/pop/plog/lib/tracer.pl

It illustrates the use of these two constructs to switch between
prolog and pop-11 in the same file:

:- prolog_language("pop11").
        Switch from Prolog to Pop-11

:- prolog_language("prolog").
        Switch from Pop-11 to Prolog.

> If anyone has examples of how to do these things I would be very grateful.

The above should be enough to get you going.

There is more information in online documentation.

Aaron
====
Aaron Sloman, ( http://www.cs.bham.ac.uk/~axs/ )
School of Computer Science, The University of Birmingham, B15 2TT, UK
EMAIL A.Sloman AT cs.bham.ac.uk   (ReadATas@please !)
PAPERS: http://www.cs.bham.ac.uk/research/cogaff/
FREE TOOLS: http://www.cs.bham.ac.uk/research/poplog/freepoplog.html