HDTenEightyP/NetNews huggingface dataset:
From: milan@bcsaic.boeing.com (Milan Richter)
Newsgroups: comp.lang.prolog,comp.lang.c
Subject: Re: Need code to match strings with regular expressions
Date: 9 Sep 92 20:55:21 GMT
Organization: Boeing Computer Services

Thanks to all who replied to my request. I wasn't entirely clear about what 
I wanted: a procedure, let's say 

match_regexp( +String, +Regexp)

that succeeds iff a character string String matches the regular expression
Regexp. Both String and Regexp are represented as lists of characters.

From the replies I received it appears that the best solution for me is to use
the /usr/include/regexp.h code, as recommended by Arjen Duursma, and link it
with my Quintus Prolog code.

Thanks again for help.

-- Milan Richter.
Newsgroups: comp.lang.prolog
From: alufml@purple.fnma.com (Francois-Michel Lang)
Subject: Re: pretty printer
Organization: Fannie Mae, Washington, DC
Date: Fri, 11 Sep 1992 13:26:01 GMT

In article <1992Sep11.091413.676@tom.rz.uni-passau.de> baier@forwiss.uni-passau.de (Joern Baier) writes:

>As the subject says it I'm looking for a pretty printer.
>It should read a source code and write it down in a nicer format.
>It should also be able to deal with comments and keep the vaiable
>names. I have been looking for it in the libraries but I think there is
>nothing appropriate.

A couple of years ago, when I was a heavy-duty Quintus Prolog user,
Dave Bowen sent me a `C' program ppl.c written by Richard that does
exactly what you want.  I used it quite a bit, and it did quite well.

I still have a copy, but I don't think I should post or e-mail it,
because I'm not sure of its copyright status.  Dave?  Richard?
Quintus?  Can this program be shared?

-- 
------------------------------------------------------------------
Francois-Michel Lang          (202) 752-6067   FAX: (202) 752-4463
alufml@fnma.com ............. Fannie Mae; Asset/Liability Strategy
lang@linc.cis.upenn.edu ..... Dept of Comp & Info Science, U of PA
From: serge@irisa.fr (Serge Le Huitouze)
Newsgroups: comp.lang.prolog
Subject: Turbo Prolog is not Prolog (was Re: Commercial Prolog)
Date: 11 Sep 92 08:00:07 GMT
Reply-To: serge@irisa.fr
Organization: Irisa, Rennes(FR)

In article <1992Sep10.032600.8565@athena.cs.uga.edu>, mcovingt@athena.cs.uga.edu
(Michael A. Covington) writes:
|> PDC Prolog (formerly Turbo Prolog) is not Prolog; it is a different
|> Prolog-like language, with strong typing rather than Prolog's typeless
|> approach to variables.

I certainly agree with M. Covington that Turbo Prolog is not Prolog.

However, I don't think this is because TP has "strong typing".

Other logic programming languages DO have types.
As an example, lambda-Prolog is a typed language: the unification of lambda-terms,
upon which lambda-Prolog is based, is only practicable (in fact semi-decidable)
on TYPED lambda-terms.
However, lambda-Prolog shares many features with Prolog and can be considered as a
"brother" of Prolog.


The difference between Turbo Prolog and standard Prolog must be elsewhere.

I think people more familiar with Turbo Prolog than myself could enlighten
this point.
From: rajiv@dvorak.amd.com (Rajiv Malhotra)
Newsgroups: comp.lang.prolog
Subject: Commercial Prolog
Date: 9 Sep 92 22:50:15 GMT
Organization: Advanced Micro Devices, Inc.; Austin, Texas

I will begin programming in Prolog; I have never done it before.
While looking around for a commercial compiler/interpreter I came across
two:

1. Airty Prolog Compiler/Interpreter
2. PDC Prolog 

I know nothing about them. How do I choose between the two? First, I
will be learning the language, so I would like something that is
easy to use. Second, as my level of sophistication grows, I would 
like the tool to be "full featured" enough to accomodate my needs.

Are there any other Prolog implementations I should be looking at?
If so, I would appreciate the name and phone number.

Thanks for any information.

- Rajiv

-- 
  
--- There is no future in time travel.
 
****     Rajiv Malhotra    *** 
Xref: sparky comp.lang.prolog:1659 comp.lang.c:13256
From: milan@bcsaic.boeing.com (Milan Richter)
Newsgroups: comp.lang.prolog,comp.lang.c
Subject: Need code to match strings with regular expressions
Date: 5 Sep 92 00:08:25 GMT
Organization: Boeing Computer Services

I am looking for a public domain code for matching strings with regular
expressions. Essentially, given a string and a regular expression (such as,
e.g., are used in emacs), I want to tell whether they match.

Can anyone provide pointers to either C or Prolog implementation?

Thanks for help.
==========================================================
== Milan Richter                                        ==
== M/S 6C-04                    tel.: 206-865-3277      ==
== P.O. Box 24346               fax.: 206-865-2965      ==
== Seattle, WA 98124-0346                               ==
==========================================================
From: roland@sics.se (Roland Karlsson)
Newsgroups: comp.lang.prolog
Subject: Re: Compilation of Disjuncts
Date: 8 Sep 92 07:59:39 GMT
	<14395@goanna.cs.rmit.oz.au>
Organization: Swedish Institute of Computer Science, Kista


SICStus Prolog do it this way:

p :- (x,! ; y).                 q :- a, (b,! ; c).
p :- z.                         q :- d.

                  is converted to

p :- choice(C), x, cut(C).      q :- choice(C), a, q'(C).
p :- y.                         q :- d.
p :- z.
                                q'(C) :- b, cut(C).
                                q'(_) :- c.

Where choice(C) binds C to a reference to the youngest choicepoint alive
when calling q/0 or p/0, and cut(C) clears all choicepoints younger than C.


 o
Ralle
--
Roland Karlsson             SICS, PO Box 1263, S-164 28 KISTA, SWEDEN
Internet: roland@sics.se    Tel: +46 8 752 15 40          Fax: +46 8 751 72 30
Telex: 812 6154 7011 SICS   Ttx: 2401-812 6154 7011=SICS
From: ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe)
Newsgroups: comp.lang.prolog
Subject: Re: Compilation of Disjuncts
Date: 8 Sep 92 04:15:13 GMT
Organization: Comp Sci, RMIT, Melbourne, Australia

In article <1992Sep1.160505.6828@irisa.fr>, serge@irisa.fr (Serge Lehuitouze) writes:
> You, WAM gurus, do you do anything special about this construct, or do you just
> consider it as an ordinary predicate with a definition like:
> P ;_Q :- P.
> _P; Q :- Q.

There is a third possibility:  when a clause contains a goal of the form
(P ; Q), e.g. H :- A, (P ; Q), B
split that goal out as a separate predicate:
	T(Xs) :- P.
	T(Xs) :- Q.
	H :- A, T(Xs), B.
where Xs is vars([P,Q]) intersect vars([H,A,B]).

But yes, disjunction is usually compiled specially, for two important
reasons:
    1.  It would be unreasonably slow and inefficient to do otherwise.
    2.  Disjunction and if->then;else are transparent to cuts, that is,
	a cut inside one of them has effect on the whole predicate,
	not just the disjunction or if->then;else.

-- 
You can lie with statistics ... but not to a statistician.
Newsgroups: comp.lang.prolog
Newsgroups: comp.lang.prolog
Subject: Re: pretty printer
From: spratt@hawk.cs.ukans.edu (Lindsey Spratt)
Date: Fri, 11 Sep 1992 19:51:26 GMT
Organization: University of Kansas Computer Science Dept

In article <1992Sep11.152125.5315@athena.cs.uga.edu> mcovingt@athena.cs.uga.edu (Michael A. Covington) writes:
>By all means let's work on it!  
>
>What we need is, as Paul Singleton says, a parser that parses Prolog and
>also preserves white space, or at least comments.
...
>First of all, does someone have the appropriate parser?  It should be a
>very minor modification of an ordinary Prolog parser.

There was some discussion of this recently in this news group. It is
difficult to handle comments "formally" in a parser for Prolog (or
most any language), since the comments can appear anywhere whitespace
can, yet have some semantic correspondence to the other syntactic
element which the parser must maintain. The output formatting of
comments can be quite tricky as well. Thus, I found a minor modification
of an existing  grammar to be inadequate and built a DCTG grammar from
scratch. This system allows one to specify the formatting approach
desired for handling the various operators (another tricky area), and
it (optionally) reformats the comments into "canonical" locations with
appropriately indented text. The target of this formatting system
was ASCII files, so only ASCII output is handled (the other kinds of
output could easily be added). Another issue here  is that using a
word processing system for final formatting can be a problem if the 
word processing system is going to choose the places to introduce
new lines, and the way to indent the "new" line. Both of these
decisions should be made in a syntax-sensitive fashion which the
word processing system is unlikely to be able to do (except, perhaps, for
the text of comments).



	-lindsey
Xref: sparky comp.lang.prolog:1663 comp.lang.c:13292
From: torbenm@diku.dk (Torben AEgidius Mogensen)
Newsgroups: comp.lang.prolog,comp.lang.c
Subject: Re: Need code to match strings with regular expressions
Date: 7 Sep 92 09:42:08 GMT
Organization: Department of Computer Science, U of Copenhagen

milan@bcsaic.boeing.com (Milan Richter) writes:

>I am looking for a public domain code for matching strings with regular
>expressions. Essentially, given a string and a regular expression (such as,
>e.g., are used in emacs), I want to tell whether they match.

>Can anyone provide pointers to either C or Prolog implementation?

Below is a Prolog program that does this. It is not terribly
efficient, as it doesn't generate an automaton but rewrites the
regular expression as it reads the text. Partial evaluation with
respect to the regular expression can yield a program equivalent to an
automaton.

	Torben Mogensen (torbenm@diku.dk)


% interpreter for regular expressions

:- op(300,yf,*).
:- op(200,fx,`).

% R ::= empty       -- empty string
%    |  ` Symbol    -- terminal symbol
%    |  R ; R       -- alternative
%    |  R , R       -- sequence
%    |  R *         -- repetition

accepts(R,[]) :-
	accepts_empty(R).
accepts(R,[S|Ss]) :-
	first(R,S),	% test if S can start R
	next(R,S,R1),	% find reg-exp R1 for rest of string
	accepts(R1,Ss).	% and test that


accepts_empty(empty).
accepts_empty((R1 ; R2)) :-
	accepts_empty(R1) ->	% the use of -> reduces backtracking.
	 true ;			% ! could be used instead (but I hate !).
	 accepts_empty(R2).
accepts_empty((R1 , R2)) :-
	accepts_empty(R1),
	accepts_empty(R2).
accepts_empty(_ *).

first(` S,S).
first((R1 ; R2),S) :-
	first(R1,S) ;
	(first(R2,S), \+ first(R1,S)).	% reduces backtracking (\+ is not)
first((R1 , R2),S) :-
	first(R1,S) ;
	(accepts_empty(R1), first(R2,S), \+ first(R1,S)).	% ditto
first(R *,S) :-
	first(R,S).

next(` S,S,empty).
next((R1 ; R2),S,R) :-
	first(R1,S) ->
	 next(R1,S,R11),
	 (first(R2,S) ->
	   next(R2,S,R21),
	   reduce_or(R11,R21,R) ;
	   R = R11) ;
	 next(R2,S,R).
next((R1 , R2),S,R) :-
	first(R1,S) ->
	 next(R1,S,R11),
	 (accepts_empty(R1), first(R2,S) ->
z	   next(R2,S,R21),
	   reduce_seq(R11,R2,R3),
	   reduce_or(R3,R21,R) ;
	   reduce_seq(R11,R2,R)) ;
	 next(R2,S,R).
next(R *,S,R2) :-
	next(R,S,R1),
	reduce_seq(R1,R *,R2).

% these reduce the derived regular expressions to avoid blow-up of size

reduce_or(R1,R2,R) :-
	R1 = R2 ->
	 R = R1 ;
	 ((R1 = (R3,R2) ; R1 = (R2,R3)), accepts_empty(R3) ->
	   R = R1 ;
	   ((R2 = (R3,R1) ; R2 = (R1,R3)), accepts_empty(R3) ->
	     R = R2 ;
	     (R1 = (R2 ; _) ->
	       R = R1 ;
	       (R1 = (_ ; R2) ->
	         R = R1 ;
		 (R2 = (R1 ; _) ->
	           R = R2 ;
	            (R2 = (_ ; R1) ->
	              R = R2 ;
	              R = (R1 ; R2))))))).

reduce_seq(R1,R2,R) :-
	R1 = empty ->
	 R = R2 ;
	 (R2 = empty ->
	  R = R1 ;
	  R = (R1 , R2)).
From: ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe)
Newsgroups: comp.lang.prolog
Subject: Re: Time and Date in Quintus P.
Date: 8 Sep 92 04:42:23 GMT
Organization: Comp Sci, RMIT, Melbourne, Australia

In article <1992Sep4.185308.12558@tom.rz.uni-passau.de>, baier@forwiss.uni-passau.de (Joern Baier) writes:
: gandalf:~/prolog/dp 104> prolog
: | ?- [library(date)].
: [consulting /private/projects/quintus/generic/qplib2.5.1/library/date.pl...]
:  [consulting /private/projects/quintus/generic/qplib2.5.1/library/errno.pl...]
:  [errno.pl consulted in module errno 0.500 sec 11,884 bytes]
: ld:
: Undefined:
: gmtime
: localtime
: [ERROR: Foreign interface, call to Unix "ld" failed (error 413)]
:  [Loading of foreign files NOT completed]
: [date.pl consulted in module date 1.333 sec 22,508 bytes]
: 
You have a serious problem there, because gmtime() and localtime() are
UNIX library functions.  More than that, they are required by the ANSI
C standard.  The linker should have found them.  You will need to check
that QP has been installed correctly, and especially to verify that ld
is being called with the correct command-line arguments.

: ----------------------------------------------------------------------
: gandalf:~/prolog/dp/date 111> gcc date.c

You do not want a complete program.  You want a ".o" (object, linkable)
file.  For that, the correct command is
	gcc -c date.c
	    ^^
: date.c: In function `QD4mat':
: date.c:358: warning: suggest parentheses around && within ||
Sheesh.  Does it also say "suggest parentheses around * within +"?
Ignore that message.
: ld:
: Undefined:
: main
: QP_atom_from_string
: collect: /usr/bin/ld returned 1 exit status

: It seems that 'QP_atom_from_string' is not defined.

Yes it is.  It is defined in the Quintus Prolog system itself.
The *.c files in the library area are _not_ meant to be compiled as
separate programs, but as ".o" files which will later be linked with
the Prolog system (either statically, if you so choose when using qpc,
or dynamically, if you use load_foreign_files).  Just add the "-c" option.

-- 
You can lie with statistics ... but not to a statistician.
From: popx@vax.oxford.ac.uk
Newsgroups: comp.lang.prolog
Subject: Re: Wanted: production system/coroutiner
Date: 5 Sep 92 17:37:56 GMT
Organization: Oxford University VAX 6620

> In article <1992Aug25.202004.8511@vax.oxford.ac.uk>,
> popx@vax.oxford.ac.uk writes:
> > I'm looking for ... a meta-interpreter for implementing coroutines.
> >
> Have you seen L.M. Pereira's "Logic control with logic" in
> _Implementations of Prolog_, J.A. Campbell editor, Ellis Horwood
> Limited, 1984? Section 2.2 of the paper is entitled "An Interpreter to
> Control Coroutining".
>
> John E. Kreznar, jkreznar@ininx.com, uunet!ininx!jkreznar
>
Yes I have, thanks for the reference. I was hoping to get a reply from
someone who had used such a meta-interpreter seriously, and who had
optimised it. The code in Pereira's article is easy to read, but (for
that reason), not as efficient as it could be.

Pereira gives a listing, and then says "Although this rendering of the
interpreter is clearer than others, it is not very efficient as it
stands. Use of the cut, more indexing, and non-normalised resolvents
and clause bodies permit much more efficient versions, even surpassing
in efficiency compiled Prolog in the case of programs that do benefit
much from the special control. They also surpass lower-level
implementations (see Filgueiras, M: "On the implementation of control
in logic programming languages", Research Report, Departmento de
Informa'tica, Universidade Nova de Lisboa, 1984).

I want my meta-interpreter to be capable of co-routining _large_
programs (animal "brains", containing production systems, planners,
etc), so time and space efficiency is important.

Jocelyn Paine         
Newsgroups: comp.lang.prolog
From: thomas@IFComputer.de (Thomas Schoenauer)
Subject: Re: Hypertext with Prolog
Date: Mon, 7 Sep 92 15:33:56 GMT
Organization: InterFace Computer GmbH, Munich, Germany

sby@ern.doe.ernet.in (S. Bhardwaj Yadavalli) writes:
> Query 1 :
> 
> Can any one give ANY references to ANY work done in the direction
> of using a hypertext tool with Prolog ( Quintus Prolog ) preferably on Unix
> 386 ? In general has any on successfully implemented something of this type
> ? Some one SHOULD have !! 
> 
> 
> Query 2 :
> 
> Where can I get a GOOD, WORKING, X-Window interface for Quintus Prolog ?
> I remember to have seen someting reg XWIP ? Any help will be thankfully
> acknowledged !!
> 
> 
> S.Bharadwaj Yadavalli
> AI Division
> National Informatics Centre, New Delhi INDIA

I can only give you some answers concerning IF/Prolog:

For Query 1:

IF/Prolog by InterFace Computer includes a nice Hypertext reference
manual. It has been built by an automatic conversion process which
reads plain text (and embedded laser printer PCL commands) and converts
it to structured hypertext.


For Query 2:

In IF/Prolog, we have an interface to OSF/Motif and to
X11R4 Athena Widgets. Both include a special hypertext widget
which allows one to show a page on the X screen similar to a laser
printer and allows one to follow links with special callbacks.

Our interfaces to OSF/Motif and X11R4 Athena widgets are very stable.
They are used to implement the entire window based development
environment of IF/Prolog, which is available on a very wide range
of different hardware platforms. (All 32 and 64 Bit UNIX computers,
DOS and Windows for 386 and 468 machines and VAX VMS)

Some users of IF/Prolog have already implemented their own
Hypertext systems with IF/Prolog.


	Thomas Schoenauer
	InterFace Computer GmbH
	Garmischer Str.4
	D-8000 Muenchen 2
	fax +49+89+51085-28
	thomas@IFComputer.de
From: popx@vax.oxford.ac.uk
Newsgroups: comp.lang.prolog
Subject: Re: pretty printer
Date: 11 Sep 92 13:40:19 GMT
Organization: Oxford University VAX 6620

In article <1992Sep11.091413.676@tom.rz.uni-passau.de>, baier@forwiss.uni-passau.de (Joern Baier) writes:
> Hi!
> 
> As the subject says it I'm looking for a pretty printer.
> It should read a source code and write it down in a nicer format.
> It should also be able to deal with comments and keep the vaiable
> names. I have been looking for it in the libraries but I think there is
> nothing appropriate.
> 
> Thanx in advance,
> 			Joern
> -- 
> Joern Baier     (baier@forwiss.uni-passau.de) 
>
I don't have a complete pretty-printer. However, the code that comes 
with my "Logic Programming Tutor" includes some of what you need to 
build one. There's a set of predicates (SDO.PL and SDO_OUTPUT.PL) which
read the grammar of a language in a notation that's like DCGs augmented
with formatting commands and generate Prolog predicates from it. Portability
note: you'll need to be able to 'write' into lists or other structures.

There's also a tokeniser and parser, built from the Richard O'Keefe one
that comes with the Dec-10 library. This can read variable names. It ignores
comments, but you could make it capture them and return them hooked
onto the term in some way. I'm not sure what the best way to represent
a term augmented in this way would be.

You can FTP the code from packages/prolog-pd-software/tutor.tar.Z at
src.doc.ic.ac.uk . It's a compressed TAR file, so fetch it in binary
mode, and decompress then untar before using. 

If you do build a pretty-printer from these predicates, please send me
a copy of it.


General note: the library contains a lot of other code. See README in the
aforenamed directory for a short list, CATALOGUE for a long one. 
I would like more contributions: the number I've been offered so far is
very low compared with the amount of Prolog code that exists.


Jocelyn Paine
From: mcovingt@athena.cs.uga.edu (Michael A. Covington)
Newsgroups: comp.lang.prolog
Subject: Re: pretty printer
Date: 11 Sep 92 15:21:25 GMT
Organization: University of Georgia, Athens

By all means let's work on it!  

What we need is, as Paul Singleton says, a parser that parses Prolog and
also preserves white space, or at least comments.

I propose:    boldface for functors
              roman for variable names
              Courier for quoted strings ('this' and "this")
              italics for comments

Output formats:   LaTeX
                  Word Perfect without header (simple)
                  perhaps others

First of all, does someone have the appropriate parser?  It should be a
very minor modification of an ordinary Prolog parser.

-- 
+ Michael Covington - Artificial Intelligence Programs - U of Georgia - USA 
+ Unless otherwise noted, these are private opinions, not official statements.
Newsgroups: comp.lang.prolog
From: gordon@cs.uwa.oz.au (Gordon Royle)
Subject: running out of stack space on a PC
Organization: Dept. Computer Science, University of Western Australia.
Date: Tue, 15 Sep 1992 08:46:09 GMT


I am trying to set a decent size project for my students, who use 
Arity Prolog on IBM-PCs. The trouble is that even the most modest Prolog
program runs out of stack space more or less immediately. (For example,
a Turing machine simulator that I got them to write only runs for a hundred
or so steps before running out of space).

Does anyone have any suggestions that might help? (this might be a DOS 
problem rather than a Prolog program, just knowing that fact might help a
bit). Will a different Prolog (eg Prolog2) be better?

Cheers

gordon
Newsgroups: comp.lang.prolog
From: axs@cs.bham.ac.uk (Aaron Sloman)
Subject: Re: Wanted: production system/coroutiner
Organization: School of Computer Science, University of Birmingham, UK
Date: Sun, 6 Sep 1992 10:58:07 GMT

popx@vax.oxford.ac.uk writes:

> Date: 5 Sep 92 17:37:56 GMT
> Organization: Oxford University VAX 6620

> I want my meta-interpreter to be capable of co-routining _large_
> programs (animal "brains", containing production systems, planners,
> etc), so time and space efficiency is important.

It is possible that someone has said this already, but if you don't
insist on portability you can use the "lightweight process"
mechanism in Poplog, which works with prolog, I believe. For details
see the online Poplog file

    REF PROCESS

which describes consproc, runproc, suspend, resume. LIB TPARSE,
described in HELP TPARSE illustrautes the use of the mechanism in a
simple top down parser written in Pop-11 that finds all parses by
backtracking.

For information on using the mechanism with Prolog see the prolog
help file
    PLOGHELP PROCESSES

You may need help from someone who has already done this, e.g. one
of the Sussex Poplog people.

Aaron
-- 
Aaron Sloman, School of Computer Science,
The University of Birmingham, B15 2TT, England
EMAIL   A.Sloman@cs.bham.ac.uk
Phone: +44-(0)21-414-3711       Fax:   +44-(0)21-414-4281
From: popx@vax.oxford.ac.uk
Newsgroups: comp.lang.prolog
Subject: Re: Programs from Bratko Book?
Date: 4 Sep 92 21:03:23 GMT
Organization: Oxford University VAX 6620

In article <benanav.715577354@earth.njit.edu>, benanav@earth.njit.edu (Dan Benanav) writes:
> Does anyone know if the programs from the Bratko Book 
> Prolog Programming for AI are available somewhere?
> I'm teaching a class and would like to have them.
>
So would I. I would like to add to my library, programs 
that have been printed in books such as Bratko, Rowe,
O'Keefe, Dodd, and others. Authors, or those who have typed
in their own copies, please contact me.

Jocelyn Paine
Newsgroups: comp.lang.prolog
From: baier@forwiss.uni-passau.de (Joern Baier)
Subject: pretty printer
Organization: University of Passau, Germany
Date: Fri, 11 Sep 1992 09:14:13 GMT

Hi!

As the subject says it I'm looking for a pretty printer.
It should read a source code and write it down in a nicer format.
It should also be able to deal with comments and keep the vaiable
names. I have been looking for it in the libraries but I think there is
nothing appropriate.

Thanx in advance,
			Joern
-- 
Joern Baier     (baier@forwiss.uni-passau.de) 
Jesuitengasse 9      __o
D-W8390 Passau     _ \<,_
Tel +49/851/35239 (_)/ (_)