[Next] [Previous] [Up] [Top] [Contents] [Index]
2 Dynamically-Typed Core
2.6 Precedence Declarations
Cecil programmers can define their own infix binary operators. Parsing expressions with several infix operators becomes problematic, however, since the precedence and associativity of the infix operators needs to be known to parse unambiguously. For example, in the following Cecil expression
foo ++ bar *&&! baz *&&! qux _max blop
the relative precedences of the ++
, *&&!
, and _max
infix operators is needed, as is the associativity of the *&&!
infix operator. For a more familiar example, we'd like the following Cecil expression (**
represents exponentiation)
x + y * z ** e ** f * q
to parse using standard mathematical rules, as if it were parenthesized as follows:
x + ((y * (z ** (e ** f))) * q)
- 2.6.1 - Previous Approaches
-
- 2.6.2 - Precedence and Associativity Declarations in Cecil
-
The Cecil Language: Specification and Rationale, Version 2.1 - 25 MARCH 1997
[Next] [Previous] [Up] [Top] [Contents] [Index]
Generated with Harlequin WebMaker