Prev Up Next
Go backward to 4.1 Precedence Annotations
Go up to 4 Parsing Annotations
Go forward to 4.3 Visibility and Interaction with Structured Specifications

4.2 Associativity Annotations

There are two associativity annotations

which may be used immediately after an operation or predicate declaration. For example, declaring __+__ to be left associative means that t1 + t2 + t3 is parsed as (t1 + t2) + t3, while declaring it to be right associative leads to t1 + (t2 + t3). If there is no associativity annotation for a mixfix symbol, it is not allowed to repeat that symbol without explicit grouping using parentheses.

Due to the CASL summary, section 2.1.2.1, an assoc operation attribute implies a parsing annotation that allows an infix operation to be iterated without explicit grouping parentheses. We choose just %left assoc to be this parsing annotation - %right assoc would also do the job, and the resulting parsed term would be different but semantically equivalent due to associativity of the operation. Thus the choice between %left assoc and %right assoc is arbitrary here, but we have to make a choice to be definite.


CoFI Note: L-11 -- Version: 0.1 -- 11 March 1999.
Comments to roba@informatik.uni-bremen.de

Prev Up Next