In LSL,
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
(such as !==?
and <>
,
or symbols that start with a backslash (such as \U
and \union
).
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++.
lsl-op ::=\
identifier | star-or-op-char [ op-char ] ... star-or-op-char ::=*
| op-char op-char ::=~
|=
|<
|>
|+
|-
|/
|!
|#
|$
|&
|?
|@
| `|
'
Note that in the definition of op-char,
the |
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.
The tokens &
and ~
may be written as bitand
and compl
, respectively.
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,
such as &&
or ~~
, have no such equivalent.
(But !=
can be written as not_eq
,
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
(such as \I
).
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 intersection
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.