G3Kappa / Ergo

Other
4 stars 0 forks source link

Unary operators ignore precedence rules #1

Closed G3Kappa closed 1 year ago

G3Kappa commented 2 years ago

This makes defining operators involving certain problematic functors, such as ., impossible because they clash with some other symbol.

The fix requires undefining the punctuation symbol . and defining a well-known postfix operator '.'/1 with precedence 0, so that it correctly encloses statements.

Unfortunately, the current expression parser is incapable of parsing unary expressions in such a way because it only cares about precedence and associativity when parsing infix expressions.

G3Kappa commented 1 year ago

After some trials and tribulations, . is now correctly lexed and parsed contextually, so that it may be defined as an operator.

It is currently used for dict dereferencing.

G3Kappa commented 1 year ago

Unary operator precedence should still be investigated however

G3Kappa commented 1 year ago

Fixed! There may still be some edge cases to prod, but that's for testing.