Reference: Jess document
salience: use to define the priority of rules, higher value have higher priority.
the following code can match expressions with one pair parenthesis.
clear: clear working memory. The working memory will be empty.
reset: reset working memory and insert all facts in deffacts.
batch hw2.clp: execute the Jess file named hw2.clp
all command must be enclosed with parenthesis
Jess> (defrule example-6 (declare (salience -100)) (command exit-when-idle) => (printout t "exiting..." crlf))
?f <- (expr $?front "(" $?middle ")" $?end)$?front can match the string until reach the first "(" $?middle can match the string until reach the first ")" so does $?end.