The message predicate posts a message from a Typol rule. This
predicate must be imported from message as follows:
import message(string, string, string, string, path, string, _)
from message ;
where the arguments are the following:
- the formalism name, here "Exp".
- the message module name. We will call the message module for
the interpreter,
interpreter. It is possible to refer to
any number of message modules in a program.
- the message name.
- the message class. Message classes may be any identifier, but
the following identifiers are treated specially in the message display
window: Fatal, Error, Warning, Info, and Debug.
- the message position. This is a path that designates a subtree
in the source. Typically this is a descendent of the subject.
- supplementary information. In most cases, this information may
be the empty string. However, if the information is the word "private" and the message has an associated location in the source,
this location is not highlighted in the source. The location may be
highlighted by clicking on the message in the message display.
- arguments. Each argument should be constructed by the syntactic
construct messarg.
Since each argument has a value but may also have an
associated position in the source and supplementary information, the
messarg construction allows you to regroup this information when
posting a message. This syntactic construction comes from a formalism
named messargs and must be used in a Typol program as any
other formalism:
use messargs;
The messarg construct has the following syntax:
messarg(, ref(), info )
where:
- The <value> is the message argument value. If the value
is an abstract syntax tree stored in the Typol variable TREE, <value> must have the form tree(TREE). If the value is a string,
<value> must have the form string <string-value> (e.g.,
string "7").
- The <path> is the position of the argument in the source
tree. This is a path (e.g. subject). It may be nil() to
mean that no position information should be associated with this
argument. The value nil() is a syntactic construct from the PSP path language. If you use it in a Typol program, you must also
use the PSP formalism at the beginning of the program.
- The last value is additional argument information, a string.
Indicating info "private" makes the message argument
private as explained above. Indicating info "" means that the
message has no associated information.