I'm not sure what version of "tourguide.p" you are using, but I've
attached one that I wrote as an example of a tourist guide from the
Computers and Thought book. It includes a Prodsys rulebase from Chapter
7, the sentence analysis from Chapter 5 and the London Underground
search from Chapter 4. I have tested the code on Windows Poplog and it
seems to work.
Mike Sharples
-----Original Message-----
From: owner-pop-forum@cs.bham.ac.uk
[mailto:owner-pop-forum@cs.bham.ac.uk] On Behalf Of Aaron Sloman
Sent: 31 December 2004 01:48
To: pop-forum@cs.bham.ac.uk
Subject: Re: tourguide.p
Thanks for the further detail.
> sorry for any inconveniences..forgive my lack of experience. here is
> the exact info.....
>
> 1.tourguide for ebook(computers and thought --code copied from there)
Is there a URL for the precise file from which you copied it?
As I don't know the exact context I don't know if something is not
explained in the file which should be.
> 2. using win pop also tried in linux...
>
>
> 3.this is the piece of code referenced... ( hope this is clearer)
>
> false -> repeating;
>
>
>
> rule find_type [entertainment medium unknown];
> ;;; <- referenced line
That is not legal pop11.
However this syntax can work if you have compiled the 'prodsys library'
as explained in the file TEACH PRODSYS.
The Prodsys library package defines "rule" as a new syntax word
extending the syntax of Pop-11. It also defines "endrule".
The teach file states:
(line 64):
| The PRODSYS package provides an interpreter for production rules that
| are written in the form:
|
| rule RULENAME [ CONDITION ] ;
| ACTION ;
| ACTION ;
| .
| .
| endrule ;
|
| To use it, type
|
| lib prodsys;
|
| Then define your production rules as follows - etc.
I.e. you must start with
lib prodsys
or
uses prodsys
in order to compile the prodsys package before you can use the prodsys
syntax.
(The second format can be used in a file that you will frequently
recompile while developing your program. Some library programs cause
problems if recompiled. See HELP USES).
I don't know whether the same information is provided in the C&T book,
but if it isn't it should be! (I don't know if the online version
contains all of the text of the book or only a subset.)
There are many packages that extend the syntax of pop11 in some way or
other. The fact that this can be done is one of the reasons why pop11
(like Lisp) is classed as a muti-paradigm programming language: it has
the abilithy to be extended with new syntax supporting programming
paradigms required for new programming tasks.
Examples of such syntactic extensions include the Prodsys package,
Poprulebase, Objectclass, Flavours, and also the complete languages
embedded in Pop11, namely Prolog, Common Lisp and ML.
However, none of them allows the new syntax simply to be compiled by
pop11: you first have to compile the library that defines the new
syntax.
I am not familiar with the example you are using, but my guess is that
if you put
uses prodsys
at the top of your program file, i.e. before the first occurrence of the
'rule' syntax, you will not get the errors you have have seen.
(There may be other errors.).
>
> Setpop
> : load tourguide.p
> : load tourguide.p
You should not have to give that command twice.
I am surprised the first one did not produce the error messages and
warning messages.
> ;;; LOADING tourguide.p
That's a standard message if you use 'load'
> ;;; DECLARING VARIABLE rulebase
I don't see where that came from in your example above. You did not use
the symbol "rulebase" in your example. There must be something you put
in the file that you have not reported.
> ;;; DECLARING VARIABLE chatty
The same goes for this. There is no occurrence of "chatty" in your
example. So it must have been in a part of your file not reported.
> ;;; DECLARING VARIABLE repeating
You assigned false to this variable without first declaring it so you
get a warning message.
If you copied that from the book it probably means that the variable is
defined in the prodsys package. I assume 'chatty' is also.
(You can check what is in the package by doing this in Ved
ENTER showlib prodsys
though the package may use features of pop11 that you have not yet
learnt about, so don't worry if the code is too difficult to
understand.)
> ;;; DECLARING VARIABLE rule
This would not happen if the word "rule" had been declared as a syntax
word introducing a new syntax form. So if you first compile the package
that message should go away.
>
> ;;; MISHAP - msep: MISSING SEPARATOR (eg semicolon) ;;; INVOLVING:
> rule find_type
Similarly: that's not legal pop11, even if it is legal prodsys syntax.
I am assuming that the prodsys library is included in windows poplog,
though I have not checked.
Aaron
===
Attachment:
tourist_guide.p
Description: tourist_guide.p
|