I'm a first time CLIPS user off to a shaky start. I'm running CLIPS
v6.24 on a Microsoft Windows XP machine.
When I manually enter the following in the CLIPS interactive
interpreter:
;<code>
(clear)
(defrule take-a-walk
(status walking)
(walk-sign walk)
=>
(printout t "Go" crlf))
(assert (status walking))
(assert (walk-sign walk))
(run)
;</code>
it works as expected. However, it I save the above to a file and load
it, here is the result:
CLIPS (V6.24 06/15/06)
CLIPS> (load "C:/Documents and Settings/jim.vickroy/My Documents/
Projects/CLIPSWin/traffic-robot.clp")
[CSTRCPSR1] Expected the beginning of a construct.
Defining defrule: take-a-walk +j+j
[CSTRCPSR1] Expected the beginning of a construct.
FALSE
CLIPS>
What mistake(s) have I made?
Thanks,
-- jv
> ... However, it I save the above to a file and load
> it, here is the result:
>
> CLIPS (V6.24 06/15/06)
> CLIPS> (load "C:/Documents and Settings/jim.vickroy/My Documents/
> Projects/CLIPSWin/traffic-robot.clp")
>
> [CSTRCPSR1] Expected the beginning of a construct.
> Defining defrule: take-a-walk +j+j
>
> [CSTRCPSR1] Expected the beginning of a construct.
> FALSE
> CLIPS>
>
> What mistake(s) have I made?
I think you want the batch command ("File/Load batch..." if you're
using the GUI). Try:
CLIPS> (batch "C:/Documents and Settings/jim.vickroy/My
Documents/Projects/CLIPSWin/traffic-robot.clp")
instead and it will work without problems.
The load command is used to load constructs from a file - rules,
facts, globals, methods and such (things that start with "def") and
the batch command basically loads and runs everything in the file as
if it was entered into the interpreter.
You can read more about both commands in the Clips docs. See Basic
Programming Guide chapters 13.1.1 Loading Constructs From A File and
13.1.9 Executing Commands From a File.
HTH
Johan Lindberg
jo...@pulp.se
> I saw your answer on this matter 3 years ago.
> Could you please take a look of my program below {which I type in
> CLIPS text editor (& save in clp extension) then I load it into CLIPS
> dialog (CLIPS 6.24)}, as I also get the same problem ( Expected the
> beginning of a construct error when load the program).
> 1. do you think the source of the problem & the solution are the same?
> 2. And while the loading process return in False, I could still
> running the program, is it always the case when [CSTRCPSR1] happen?
> Thanks in advance.
>
> ...
> CLIPS (V6.24 06/15/06)
> CLIPS> (load "C:/Documents and Settings/Dana/My Documents/CLIPS/
> Research_prototype/cobacheckquestion.CLP")
> Defining deffunction: ask-question
> Defining defrule: start +j
>
> [CSTRCPSR1] Expected the beginning of a construct.
> Defining defrule: designtype +j
>
> [CSTRCPSR1] Expected the beginning of a construct.
> Defining defrule: designtypejuga +j
>
> [CSTRCPSR1] Expected the beginning of a construct.
> Defining defrule: Stop1 +j
> Defining defrule: Stop2 +j
> FALSE
> ...
1. Your problem is different from the one I replied to in 2007. You
have an extra closing parenthesis in each of the rules: start,
designtype and designtypejuga and that is the source of the error
messages you're seeing.
2. CSTRCPSR1 means that CLIPS has failed to load a specific construct.
In this particular case it had no effect since those extra parenthesis
weren't meant to be loaded anyway but I think that it is wise to
always assume that the program is invalid if load returns false and
instead try to fix it.
HTH
Johan Lindberg
jo...@pulp.se