# Fc_rule Syntax ## Fc_rule Forward-chaining rules have three parts: A unique name. An optional foreach clause. An assert clause.
    fc_rule ::= IDENTIFIER NL INDENT
                   [fc_foreach]
                   fc_assert
                DEINDENT
The `IDENTIFIER` uniquely names this rule and is used as the corresponding Python function name in the generated <rb_name>_fc.py file. ## Foreach clause
    fc_foreach ::= 'foreach' NL INDENT
                       {fc_premise NL}
                   DEINDENT

    fc_premise ::= fact_pattern
                 | compound_premise
                 | python_premise

    fact_pattern ::= IDENTIFIER '.' IDENTIFIER '(' [{pattern,}] ')'
Here are links to the definitions for pattern, compound_premise and python_premise. If the `foreach` clause is omitted, the rule is always fired once. If the `foreach` clause is present, the rule is fired for each combination of true premises. ## Assert clause
    fc_assert ::= 'assert' NL INDENT
                      {assertion NL}
                  DEINDENT

    assertion ::= fact_pattern
                | python_statements
Here is the link to the definitions of python_statements. The `assert` clause lists new facts to assert, and/or Python statements to execute each time the rule is fired. Each of these may include pattern variables which should also appear in the `foreach` clause where they are bound to a value. These values will then be substituted into the facts and Python statements.
Copyright © 2007-2009 Bruce Frederiksen

Page last modified Mon, Oct 27 2008.