next up previous contents
Next: 5 Term Reconstruction Up: Elf Users Guide Previous: 3 Grammar

4 Fixity and Name Preference Declarations

Fixity declarations have the form

%infix <assoc> <prec> c1 ... cn
%prefix <prec> c1 ... cn
%postfix <prec> c1 ... cn

Here assoc is left, right, or none; prec is the precedence (the higher, the tighter) between 0 and 10000; c1 through cn are the declared symbols. The declaration ends with the line. For example:

%infix left 10 + -
%infix left 20 * /
%prefix 30 ~

%infix right 5 &
%infix right 4 =>
%prefix 3 |-

Name preference declarations are given as

%name <fam> x1 ... xn

Here, x1 through xn will be used as the names for variables whose type (family) is fam. Regular numbering will only be used when the list is exhausted. For example:

i : type.
%name i  x x' x''

o : type.
%name o  A B C

|- : o -> type.
%name |-  P



fp@cs