Next: , Up: Data-terms   [Contents]

2.15.1 Data-functors

A data-functor is an integer, a float, a string, a character literal (any single-character name), a name, an implementation-defined literal, or a compound data-term. A compound data-term is a compound term which does not match the form of a special data-term (see Data-terms), and whose arguments are data-terms. If a data-functor is a name or a compound data-term, its top-level functor must name a function, predicate, or data constructor declared in the program or in the interface of an imported module.

Implementation-defined literals are symbolic names whose value represents a property of the compilation environment or the context in which it appears. The implementation replaces these symbolic names with actual constants during compilation. Implementation-defined literals can only appear within clauses. The following literals must be supported by all Mercury implementations:


a string that gives the name of the file that contains the module being compiled. If the name of the file cannot be determined then it is replaced by an arbitrary string.


the line number (integer) of the goal in which the literal appears or -1 if it cannot be determined.


a string representation of the fully-qualified module name.


a string containing the fully-qualified predicate or function name and arity.

The Melbourne Mercury implementation additionally supports the following extension:


the grade (string) in which the module is compiled.