next up previous contents index
Next: An Example Up: Prop Language Reference Manual Previous: Persistence

Inference

tex2html_wrap6558. INFERENCE  

Semantic processing in compilers and other language processors, such as data flow analysis, can frequently be specified as in a rule-based, logical deductive style. In Prop, deductive inference using forward chaining7 is provided as a built-in mechanism, orthogonal to pattern matching and rewriting, for manipulating user-defined algebraic datatypes.

Similar to syntax classes, inference classes may be used for data encapsulation. An inference class is a combination of a C++ class, a database of inference relations, and a collection of inference rules of the form lhs -> rhs. The lhs of an inference rule is a set of patterns in conjunctive form. During the inference process, a rule is fired when its lhs condition is satisfied. A fired rule then executes the corresponding rhs action, which may assert or retract additional relations from the database. Using multiple inheritance, it is possible to combine a rewriting class with an inference class such that the rewriting process generates new relations to drive the inference process, or vice versa.





Allen Leung
Mon Apr 7 14:33:55 EDT 1997