


SYNTAX.TXT                                             Page 1




                                   SYNTAX.TXT

                            (The Amateur Reasoner v1.5 +)

                                 Norman Newman
                             Kibbutz Mishmar David
                              MP Emek Sorek 73250
                                    Israel
                                  August 1988


This document explains the syntax needed for rule files which are used as
input for the Amateur Reasoner inference engine. The syntax is described
here using Backus-Naur form, where
         ::=  denotes 'is equivalent to'
         |    denotes 'or'
         <text> indicates that 'text' must appear literally.

program    ::= statements <#>
statements ::= stmt | stmt statements
stmt       ::= rule | goal | values | prompt | comment | intro

rule       ::= <if> prem <then> prem <.>
prem       ::= premise | premise <&> prem
premise    ::= token <=> token

goal       ::= <goal (> token <)>

values     ::= <values (> token <) = > list <.>
list       ::= token | token <,> list

prompt     ::= <prompt (> token <) = > text <?>
intro      ::= <intro = > text <.>
comment    ::= <!> text <!>
text       ::= token | token text

token      ::= any combination of alphanumeric characters upto a maximum
               length of 16. A token may not include the characters
               ( ) , . = & ? # !

The final line of the program must be the character #.

Of the six kinds of statement, the goal statement must appear only once; a
second goal statement will be flagged as an error but ignored. The 'intro'
statement is optional, but if it appears, it may do so only once; more than
one intro statement is a fatal parsing error. All the other statement forms
are optional, although a rule file without rules is not very useful.

Comments may be inserted anywhere in the program (although not inside
tokens) and are delimited by exclamation marks (!). Comments may not be
nested. It should be noted that comments add to the clarity of a program
but cause slower parsing.



SYNTAX.TXT                                             Page 2


The Amateur Reasoner is case sensitive, although the five keywords (if,
goal, prompt, values and goal) may be entered in upper or lower case. Rule
files are free-form ASCII files and empty lines or indentation may be
introduced at will to enhance readability.

New lines may be introduced in the introductory text by using the 'escape
sequence' "\n". This sequence must be delimited on both sides by spaces;
otherwise it will not be interpreted correctly.

The file 'animal' is an example of a rule file which demonstrates the
syntactic forms and rules.

The program is invoked by simply typing 'amateur' at the DOS prompt. The
name of the rule file may be passed as an optional parameter; the program
will prompt for a rule file if one is not given. There is no default
extension for the rule file; it should be found in the current directory or
else its full name should be given. Examples -

       C> amateur animal

       C> amateur

       C> amateur b:\ai\animal


Comments, queries and bug reports are cordially invited (although I hope
that there won't be any of the third category!).


