4.1.7.3 Syntax of Sentences as Terms

sentence ::= module : sentence
| list { where list is a list of sentence }
| clause
| directive
| query
| grammar-rule

clause ::= rule | unit-clause

rule ::= head :- body

unit-clause ::= head { where head is not otherwise a sentence }

directive ::= :- body

query ::= ?- body

head ::= module : head
| goal { where goal is not a variable }

body ::= module : body
| body -> body ; body
| body -> body
| \+ body
| body ; body
| body , body
| goal

goal ::= term { where term is not otherwise a body }

grammar-rule ::= gr-head --> gr-body

gr-head ::= module : gr-head
| gr-head , terminals
| non-terminal { where non-terminal is not a variable }

gr-body ::= module : gr-body
| gr-body -> gr-body ; gr-body
| gr-body -> gr-body
| \+ gr-body
| gr-body ; gr-body
| gr-body , gr-body
| non-terminal
| terminals
| gr-condition

non-terminal ::= term { where term is not otherwise a gr-body }

terminals ::= list | string

gr-condition ::= ! | {body}

module ::= atom

Send feedback on this subject.