How might one go about building a parser that can distinguish custom operators in prefix, infix or postfix positions.
For example:
# Hypothetical operator
@postfix(Precedence.Not)
let ~ = fn(a) = ...
@infixleft(Precedence.Addition)
let ~^ = fn(a, b) = ...
@prefix(Precedence.Not)
let ^ = fn(a) = ...
How can a parser distinguish a~^b
deterministically?
Is it ~^(a, b)
or ~(a)(^(b))
where a is a single argument function?