![]() |
[NEXT] [PREV]
HANDBOOK
/ LANGUAGE REFERENCE MANUAL
/Predefined Predicates |
||||||||||||
Gentle
Applications Concepts Examples Handbook Support Download
|
The following predicates can be used without being declared:
RelationsThe predicates eq and ne are declared for each type T'condition' eq(T, T) 'condition' ne(T, T)The invocations eq(X, Y) ne(X, Y)succeed if X is equal (not equal) to Y.
The predicates
gt,
ge,
lt,
le, 'condition' gt(T, T) 'condition' ge(T, T) 'condition' lt(T, T) 'condition' le(T, T)where T is INT or STRING. The invocations lt(X, Y) le(X, Y) gt(X, Y) ge(X, Y)succeed if X is less than (less or equal to, greater than, greater or equal to) Y.
Printing ValuesThe predicate print is defined for each type T.'action' print(T)An invocation print(X)prints the value of X. Inspecting and Defining VariablesThe predicate where is defined for each type T.'action' where(T -> T) 'rule' where(X -> X)
Source CoordinatesThe predicate @ is defined'action' @(-> POS)It may appear after a nonterm or token predicate and it defines its output variable as the coordinate of the source text recognized by the preceding symbol. It may also appear at the beginning of a rule for a grammar rule, in which case it defines its output variable as the coordinate of the source text recognized by the body of the rule. The coordinate of the text recognized by a rule body is the coordinate of the leftmost token, if there is one, or else the coordinate of the leftmost nonterm. If the body is empty, the current coordinate is used.
|