Next: , Previous: Builtin operators, Up: Syntax   [Contents]


2.7 Items

Each item in a Mercury module is either a declaration or a clause. If the top-level functor of the term is ‘:-/1’, the item is a declaration, otherwise it is a clause. There are three types of clauses. If the top-level functor of the item is ‘:-/2’, the item is a rule. If the top-level functor is ‘-->/2’, the item is a DCG rule. Otherwise, the item is a fact. There are two types of rules and facts. If the top-level functor of the head of a rule is ‘=/2’, the rule is a function rule, otherwise it is a predicate rule. If the top-level functor of the head of a fact is ‘=/2’, the fact is a function fact, otherwise it is a predicate fact.