Previous: , Up: More Of Operators   [Index]


3.12.3 Ambiguous Operators Sets

The expression parser is ill equiped to deal with ambiguous operators sets and will produce undefined results when parsing expressions for such sets. Yet, ambiguous operators sets should be avoided anyhow: if they confuse the parser they’ll confuse the user as well.

The expression parser is a greedy one: it takes the longest match, it does not track back. The subexpression types are resolved after the operator parsing, the operator types are resolved as subexpressions are constructed and typed.

For the simple nature of the operator resolution, it becomes required that operators of the same name match in most of their properties.

Rules to create sound operators sets include:

Not a non ambiguous operator set rule, but a general operator definition rule: the highest precedence (and lowest struct x1f4_operator_type priority value) is 128 and it is reserved for binary (and ternary component) operators associating left to right. All unary operator definitions are to have their priority set to 136.

See struct x1f4_operator_type.


Previous: Expressive Operators, Up: More Of Operators   [Index]