[Next] [Previous] [Up] [Top] [Contents]

4 Firing rules

4.2 Compilation


In SDML, rules can either be interpreted or compiled. Compiled rules usually run much faster than interpreted rules, but interpretation is useful for debugging. Of course, the time spent during compilation may sometimes outweigh the speed-up, particularly for rules that are only fired once (such as those generated by meta-level rules). This problem is reduced, however, by caching the code generated by compilation; the same code can be used for the same rule in a different rulebase.

The compiler utilises type information supplied by clause definitions in order to optimise common situations. For example, database retrieval can often be compiled into simple operations to fetch specified clauses or to check whether particular clauses exist, avoiding the relatively time consuming unification process. Some primitives, such as sum, can be compiled into particularly efficient code.

Checks must be made to ensure that a clause adheres to the syntax specified in the clause definition group before asserting it to a database. Such checks can usually be fully performed at compile time, but code is generated to perform such checks during rule firing when necessary.


Efficient Forward Chaining for Declarative Rules in a Multi-Agent Modelling Language - 16 FEB 95
[Next] [Previous] [Up] [Top] [Contents]

Generated with CERN WebMaker