At the level of structured specifications, ambiguities of grouping are resolved as follows:
Within a FORMULA, the use of prefix and infix notation for the logical connectives gives rise to some potential ambiguities. These are resolved as follows:
The declaration of infix, prefix, postfix, and general mixfix operation symbols may introduce further potential ambiguities, which are partially resolved as follows (remaining ambiguities have to be eliminated by explicit use of grouping parentheses in terms):
Thus `a+b*c' is ambiguous (regardless of the sorts of a, b, c), whereas `a+b+c' is accepted provided that `__+__' is declared to have the `assoc' attribute for the appropriate argument sorts (ensuring that the grouping is semantically irrelevant).
Note that iterations of infix symbols (such as `a+b+c') may always be parsed initially as if they had been explicitly grouped (e.g.) to the left, their rejection in the absence of `assoc' being deferred until sort-checking. This requires the presence (or absence) of explicit grouping parentheses to be recorded as auxiliary information in the abstract syntax tree constructed by the parser.
Various other techniques for allowing the omission of grouping parentheses and/or list-separators in input (and display) are familiar from previous specification and programming languages, e.g., user-specified precedence (relative or absolute), and the "offside" rule. Moreover, not all parsers are expected to implement full mixfix notation. CASL is therefore to allow parsing annotations on (libraries of) specifications, to indicate the possible omission of grouping parentheses, and the degree of use of mixfix notation. Such annotations are expected to apply uniformly to CASL sublanguages, and to most extensions.