# KFB Syntax

This uses the same lexical structure as KRB files, except that the only keywords are:

- None
- True
- False

The name of the fact base is simply the filename with the `.kfb` suffix stripped. This must be a valid Python identifier.

## Syntax for KFB File

    file ::= [NL] {fact NL}

    fact ::= IDENTIFIER '(' [{data,}] ')'

    data ::= 'None' | 'True' | 'False'
           | NUMBER | IDENTIFIER | STRING
           | '(' [{data,}] ')'

## Example

This is taken from the family_relations example:

    # family.kfb

    son_of(bruce, thomas, norma)
    son_of(fred_a, thomas, norma)
    son_of(tim, thomas, norma)
    daughter_of(vicki, thomas, norma)
    daughter_of(jill, thomas, norma)

    daughter_of(nanette, arthur2, kathleen)
    son_of(arthur3, arthur2, kathleen)
    daughter_of(sue, arthur2, kathleen)
    son_of(ed, arthur2, kathleen)
    daughter_of(marilyn, arthur2, kathleen)
    son_of(david_b, arthur2, kathleen)
    daughter_of(m_helen, arthur2, kathleen)

    son_of(m_thomas, bruce, marilyn)
    son_of(david_a, bruce, marilyn)

Copyright © 2007-2009 Bruce Frederiksen

Page last modified Mon, Oct 27 2008.