help with prolog and C 
Author Message
 help with prolog and C

Does anybody know of a way to call upon some prolog code from inside
a C program? I need to pass in a text string, and receive a different
text string in return. Any help would be greatly appreciated. Please
respond by e-mail, as I don't check this board regularly.

Thanks,

--joe
--
        "If people want to use DOS, they should pay the price."
                                                --C. Schmidtmann




Mon, 05 Feb 1996 07:31:29 GMT  
 help with prolog and C
How about prolog/c++ integrations/interfaces.

Thanks,

M.

--
You are no bunny, until some bunny loves you!
                - My Daughter (1993)



Mon, 12 Feb 1996 07:25:27 GMT  
 help with prolog and C

Quote:

>How about prolog/c++ integrations/interfaces.

Nigel Horspool & I designed a high-level C++ interface
to Prolog as part of the TOPIC project. It is described
in a paper entitled "Translator Based Multi-Paradigm Programming"
which is about to appear in the Journal of Systems and Software.
It allows you to write C++ code like this:
Variable X,Y,Z;
Goal g(append(X,Y,L) & cut() & append(Y,Z,L2)).
In Topic you get the answers by using the method "next":
   while(g.next()){
        cout << "X=" << g.Eval(X) << "\n";
   }
(My C++ is a bit rusty, so forgive any C++ errors in the above example.)
There are more examples in the paper.
...Michael Levy



Wed, 14 Feb 1996 01:46:48 GMT  
 help with prolog and C

|>
|> >How about prolog/c++ integrations/interfaces.
|>
|> Nigel Horspool & I designed a high-level C++ interface
|> to Prolog as part of the TOPIC project. It is described
|> in a paper entitled "Translator Based Multi-Paradigm Programming"
|> which is about to appear in the Journal of Systems and Software.
|> It allows you to write C++ code like this:
|> Variable X,Y,Z;
|> Goal g(append(X,Y,L) & cut() & append(Y,Z,L2)).
|> In Topic you get the answers by using the method "next":
|>    while(g.next()){
|>   cout << "X=" << g.Eval(X) << "\n";
|>    }
|> ...

That's interesting because I have done the same type of thing. My typical
test program looks like this:

#include "logic.h"
#include "logic_lib.h"
#include "logic_op.h"
#include "logic_utl.h"

#include <stream.h>

#define L LOGIC_list

main(){
    LOGIC_k_atom a("a"),b("b"),c("c"),d("d"),nl("\n");
    LOGIC_k_variable X,Y,Z,ZZ;
    LOGIC_k x = L(a,b);
    LOGIC_k y =  L(c,d);
    print(x);
    print(nl);
    print(y);
    print(nl);
    for(LOGIC_k_rule ap3 = LOGIC_append(x, y, X) && LOGIC_pick(Y, X, Z);
        ap3.active();
        ap3.next()){
        print(Y);
        cout <<"\n";
        print(Z);
        cout <<"\n\n";
        }
    }

The trick here is that it is all C++.  My current implementation is really
not efficient but I am working part time on making it so.  I am writing
this because my boss does not want me to write in PROLOG, it is not
politically correct!  So I prototype my stuff in prolog and plan to copy it
all over in to "C++".

--
__________________________________________________________________

James Litsios                        Phone: +41 1/256 49 50
Integrated Systems Laboratory        Fax:   +41 1/252 09 94

CH-8092 Zurich, Switzerland                      

Two roads diverged in a wood, and I- I took the one less traveled by,
And that has made all the difference. (Robert Frost)



Thu, 15 Feb 1996 01:15:41 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Prolog as Intro CS Language

2. to CS: or not to CS: in F-PC assembler

3. help with cs.ch include file

4. Help a Non Cobol CS Instructor with CASE...

5. Help on ProLog by BIM versus Quintus Prolog

6. HELP, HELP, matching in PROLOG ???

7. PDC prolog and prolog++ (object-prolog)

8. Camp Smalltalk (CS 6) registration

9. APL as First Language for CS

10. SoftEng or CS Graduate Program Search

11. Test and Set (TS) vs Compare and Swap (CS)

12. Refactored Plus All Missing CS ANSI Tests In SIF

 

 
Powered by phpBB® Forum Software