prolog natural language interface to unix

From: ade <a.l.hotson_at_ncl.ac.uk>
Date: Fri 10 Sep 1999 03:26:53 PM GMT
Message-ID: <37D9233D.D16EF690@ncl.ac.uk>
Can anybody help me?
I am trying to write a natural language parser for Unix, but am having
difficulty passing commands to the operating system and receiving
responses back .My main program loop is:

pass_to_os(Command) :-
   make_string(Command,S),name(C,S),exec(C, stdout).

make_string([H|T],Result) :-
   name(H,Hstring),
   make_string(T,Tstring),
   append(Hstring,Tstring,Result).

make_string([],[]).


eg. when I send as C : /usr/bin/find . -name  filename -print

       exec('/usr/bin/find . -name  filename -print', stdout).
the result does not come back to the program on stdout :

[eclipse 10]:  exec('/usr/bin/find . -name junk -print', stdout).

yes.
[eclipse 11]: read_string(stdout, "\n",_,R).
type error in read_string(stdout, [92, 110], _61, R)


Likewise if I use
            exec('/usr/bin/find . -name filename -print',[in,out],P)
with
            read_string(out, "\n", _, Answer)
I get

[eclipse 13]: read_string(out,"\n",_,R).
type error in read_string(out, [92, 110], _61, R)


I have tried passing the output to a file but yet again it fails:

             sh('/usr/bin/find . -name junk -print' > 'testout.dat')
(dbg)?- creep
Segmentation violation - possible reasons are:
- a faulty external C function
- certain operations on circular terms
- machine stack overflow
- an internal error in ECLiPSe
Aborting execution....

*** ECLiPSe fatal error: reset/0 called
ECLiPSe: Fatal error, memory corrupted.
Received on Fri Sep 10 17:03:59 1999

This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:07:04 PM GMT GMT