Skip to content
Documentation out of dateLearn more

Fixity declaration

The %infix, %prefix and %postfix declarations assign fixity and precedence to constants for the purpose of parsing (they have no meaning in the logic).

Higher numbers bind tighter, and the pretty printer only prints out necessary information. Hence the following example:

%sort a %.
%term b a %.
%term c a %.
%term d a %.
%term + %pi a %-> a %-> a %.
%prec %left 1 + %.
%term * %pi a %-> a %-> a %.
%prec %left 2 * %.
%define x a b + c * d %.
%% The parenthesis are necessary here
%define y a b + (c * d) %.
%% This means the same thing as b + c * d.
  • Operator Declaration (guide §3.11)