Node:CHR Control Flow Model, Next:, Previous:CHR Debugging, Up:CHR Debugging



Control Flow Model

The entities reflected by the CHR debugger are constraints and rules. Constraints are treated like ordinary Prolog goals with the usual ports: [call,exit,redo,fail]. In addition, constraints may get inserted into or removed from the constraint store (ports: insert,remove), and stored constraints containing variables will be woken and reconsidered (port: wake) when variables are touched.

The execution of a constraint consists of trying to apply the rules mentioning the constraint in their heads. Two ports for rules reflect this process: At a try port the active constraint matches one of the heads of the rule, and matching constraints for the remaining heads of the rule, if any, have been found as well. The transition from a try port to an apply port takes place when the guard has been successfully evaluated, i.e. when the rule commits. At the apply port, the body of the rule is just about to be executed. The body is a Prolog goal transparent to the CHR debugger. If the rule body contains CHR constraints, the CHR debugger will track them again. If the rules were consulted, the Prolog debugger can be used to study the evaluations of the other predicates in the body.