KRB Syntax
This section describes the syntax for defining rules in KRB files.
Keywords
as | foreach | taking |
assert | in | True |
bc_extras | None | use |
check | plan_extras | when |
extending | python | with |
False | step | without |
fc_extras |
Syntax of the Entire KRB File
file ::= [NL] ['extending' IDENTIFIER ['without' {IDENTIFIER,}] NL] [{fc_rule} ['fc_extras' NL INDENT {<python_statement> NL} DEINDENT]] [{bc_rule} ['bc_extras' NL INDENT {<python_statement> NL} DEINDENT] ['plan_extras' NL INDENT {<python_statement> NL} DEINDENT]]
The KRB file has three optional parts. It must contain at least one rule (either forward-chaining or backward-chaining).
The filename (minus the .krb extension) is the name of the rule base. This must be a legal Python identifier.
Extending clause
The optional extending clause, if used, is the first line of the file. This defines the parent rule base that this rule base inherits from. It may also specify a list of backward-chaining goal names to be excluded from this inheritance.
Forward-Chaining Section
If the krb file contains any forward-chaining rules, a Python source file will be created named <rb_name>_fc.py, where <rb_name> is the rule base name.
The syntax of a forward-chaining rule (fc_rule) is defined here.
The fc_extras may only be used if there are forward-chaining rules. This allows you to add other Python code (for example, import statements) to the generated Python source file.
Backward-Chaining Section
If the krb file contains any backward-chaining rules, a Python source file will be created named <rb_name>_bc.py, where <rb_name> is the rule base name.
The syntax of a backward-chaining rule (bc_rule) is defined here.
The bc_extras can only be used if there are backward-chaining rules. This allows you to add other Python code (for example, import statements) to the generated Python source file.
In addition, if any of the backward-chaining rules have plan code (a with clause or any subgoals in the when clause with a plan_spec), a Python source file will be created named <rb_name>_plans.py, where <rb_name> is the rule base name.
You use the plan_extras to include arbitrary Python code in this plans file.