users-prolog
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to read a line of text?


From: Ron Stodden
Subject: Re: How to read a line of text?
Date: Fri, 09 Jan 2004 19:21:20 +1100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031015

Fergus Henderson wrote:
On 09-Jan-2004, Ron Stodden <address@hidden> wrote:
  
Re 4 below, I have just discovered the neat (swi-prolog) ability to 
specify a literal character code in the form 0\'z.
    

Huh?  What's with the backslash?
The ISO Prolog standard way of doing that is just "0'z",
with no backslash, e.g.

	p(0'z).

I just tried your suggested syntax in SWI-Prolog 5.0.8,
and it reported a syntax error, but it accepted the ISO Prolog
syntax just fine.
  
Thanks for the research.    The 0\'z form is at the bottom of one of the swi-prolog 5.0.10 manual pages - hard to find.    recursive grep is useless to find it, seems to get all confused with the \, etc.

The syntax.html page of that manual specifies the correct 0'z notation, and it works in both gprolog and swi-prolog.   The 0\'z form gives a syntax error in both.

I would also have tried it in your Mercury product, but it seems not to be downloadable in the RPM format.      That's necessary if you want the public to take Mercury seriously.    I would greatly like to support an Australian logic programming tool - see my sig <g>.

The backslash form (escaping the ') should work also, but does not, that's possibly a bug.    Escaping it may have been a forlorn attempt to prevent editor highlighting of it as starting an unterminated literal string.
Except in editing, where kwrite under Prolog 
highlighting wrongly takes the ' as the start of a quote.
    

Use a better editor, or at least a better Prolog mode.  Any good editor
designed for editing Prolog code that supports syntax highlighting should
be able to properly tokenize Prolog.
  
I agree.
Unfortunately, I cannot locate any similar facility in GNU Prolog. 
    

GNU Prolog supports the ISO Prolog syntax just like SWI Prolog 5.0.8.
  
Not 100% true in my experience - both have extensions (and are therefore ISO non-compliant) which are incompatible with each other.   Edinburgh compatibility is also part of the picture.
-- 
Ron. [Melbourne, Australia]
"If you keep a green bough in your heart, the singing bird will come"
Get Fastest Mandrake downloader, English-only, from:
http://members.optusnet.com.au/ronst/    <--- Last Change 2nd November!

reply via email to

[Prev in Thread] Current Thread [Next in Thread]