预期构造错误的开始 [英] expected the beginning of a construct error

查看:79
本文介绍了预期构造错误的开始的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我运行系统时,它显示错误预期结构的开始" ..我该如何纠正这个错误

When I run system, it shows error "expected the beginning of a construct" .. how can I correct this mistake

我的规则如下

(defrule UFP
 (not (repair ?))
   ?f <- (rule1)

   =>
(retract ?f)
(printout t "Finish UFP (y/n)
yes> go to rule 10 - Advise : Select your major
No> go to rule 2 - Advise : please finish all the levels of UFP to enter your major
q>Exit system" crlf)

(bind ?response (check-YNoptions-input))
(if (eq ?response y)
then
(assert (rule10))
)
(if (or(eq ?response q) (eq ?response Q))
    then 
    (output-exitmessage)
)
(if (eq ?response n)
    then



            (assert (rule2))
        )
)
)



; --------------------------------------------------
; Define coleege-system rule2
; --------------------------------------------------
(defrule rule2
?f <- (rule2)
   =>
   (retract ?f)

(bind ?response (ask-question "which level from OET result: (A0 or A1 =level1 ,A2= level2, B1=level3)
 (level1/level2/level3)
level1 > go to rule 3
level2 > go to rule 5
level3 > go to rule 7"


                   level1 level2 level3))
   (if (eq ?response level1)
       then 
      (assert (rule3))
       else (if (eq ?response level2)
                then (assert (rule5))

     else  (assert (rule7))
     )))

第二期:

在按"q"键时希望退出系统,每个规则都有y和n键...什么是正确的功能失效..

want to exit system when press "q" key, with each rule, which every rule has y and n keys ..... what is the proper defunction ..

推荐答案

如果您观看编译,则可以看到发生错误的地方:

If you watch compilations, you can see the point at which the error occurs:

CLIPS> (clear)
CLIPS> (watch compilations)
CLIPS> (load problem.clp)
Defining deffunction: check-YNoptions-input
Defining deffunction: output-exitmessage
Defining deffunction: ask-question
Defining defrule: UFP +j+j+j

[CSTRCPSR1] Expected the beginning of a construct.
Defining defrule: rule2 +j+j
FALSE
CLIPS> 

该问题在UFP规则之后发生.规则后有一个右括号.在编辑CLIPS规则时,使用具有某种括号平衡类型的编辑器会很有帮助.这样可以更轻松地发现这些类型的错误.

The issue occurs after the UFP rule. There is an extra right parenthesis after the rule. When editing CLIPS rules, it's helpful to use an editor that has some type of parentheses balancing. It makes it easier to find these types of mistakes.

如果要在不退出CLIPS的情况下停止CLIPS执行,请使用(halt)命令.如果要退出CLIPS,请使用(退出)命令.

If you want to halt CLIPS execution without exiting CLIPS, use the (halt) command. If you want to exit CLIPS, use the (exit) command.

这篇关于预期构造错误的开始的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆