A Note to Tool Builders
Parsing
The grammar in this chapter might not prove to be the most efficient
way to directly construct a tool. Of course, a toolbuilder is free to
use a different parsing mechnism. He can e.g. first parse an OCL
expression using a special concrete syntax tree, and do the semantic
validation against a UML model in a second pass. Also, error correction
or syntax directed editing might need hand-optimized grammars. This
document does not prescribe any specific parsing approach. The only
restriction is that at the end of all processing a tool should be able
to produce the same well-formed instance of the abstract syntax,
as would be produced by this grammar.
Visibility
The OCL specification puts no restrictions on visibility. In OCL, all
modelelements are considered visible. The reason for this is to
allow a modeler to specify constraints, even between `hidden' elements.
At the lowest implementation level this might be useful.
As a separate option OCL tools may enforce all UML visibility rules to
support OCL expressions to be specified only over visible
modelelements. Especially when a tool needs to generate code for
runtime evaluation of OCL expressions, this visibility enforcement is
necessary.