a trait may introduce infix, prefix, and postfix
trait function symbols.
These are recognized as such
in Larch/C++ predicates and terms
(see section 6.1 Predicates).
The following grammar details how such symbols are made into tokens.
Briefly, one can use strings of operator characters
or symbols that start with a backslash (such as
The token extends as far to the right as possible,
so sometimes white space must be used
to delimit such tokens.
See section 4.11 Keywords in Predicates for a list of such forms that are reserved by Larch/C++.
\identifier | star-or-op-char [ op-char ] ... star-or-op-char ::=
*| op-char op-char ::=
Note that in the definition of op-char,
| in `
|' above is not a meta symbol,
but a terminal representing the symbol
Many C++ operator symbols, for example,
->*, are parsed as lsl-ops
within a predicate or term.
These can be defined by the user to mean various things,
as usual in LSL.
~ may be written as
This follows the proposed C++ standard's support for international
character sets [Stroustrup95] [ANSI95] (see section 4.15 Alternative Tokens).
However, tokens consisting of more than one op-char,
~~, have no such equivalent.
!= can be written as
see section 6.1.3 Equality Terms and Quantifiers).
In LSL one can customize such things as the set of operator characters,
and which characters are opening and closing bracket symbols.
Such freedom is not allowed in Larch/C++, where these sets are fixed
to the defaults in LSL version 3.1.
When you wish a special symbol, it is best
to use one that starts with a backslash
Furthermore, although LSL allows names that do not start with a backslash
\) to be used as prefix, infix, or postfix operators,
Larch/C++ does not recognize a name such as
as an lsl-op.
Hence, for prefix, infix, and postfix operators
you should also use a name beginning with a backslash.
Go to the first, previous, next, last section, table of contents.