melt-umn / silver

An attribute grammar-based programming language for composable language extensions
http://melt.cs.umn.edu/silver/
GNU Lesser General Public License v3.0
58 stars 7 forks source link

Change over remaining built-in operators to use algebra type classes #817

Closed krame505 closed 9 months ago

krame505 commented 10 months ago

Fixes #802.

Changes

Finish changing over the built-in operators to use the algebra type class methods. This makes those operators overloadable, but more significantly, allows the removal of a massive amount of code in type checking and implicit monads.

There may be a slight performance regression here, due to primitive operations like && now involving a function call in the translation. We should still probably special-case the translation of these operators for common primitive types, but that is currently impractical due to #812 - see the comments I added on the translation.

Documentation

This is mostly deleting code and making a few productions forward - the algebra type classes themselves are already fairly well documented.

Testing

No new features added.

Checked that errors for operators are still reasonable when operands have the wrong types.