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
59 stars 7 forks source link

Implement `undecorates to` and decoration site expressions, and use them in Silver #722

Closed krame505 closed 1 year ago

krame505 commented 2 years ago

This is based on #550 and should be reviewed after that is merged. Otherwise this branch is at a reasonable checkpoint, renaming PartiallyDecorated -> Decorated!, finishing the uniqueness analysis, and implementing decoration site projections will come in future PRs.

Changes

This adds support for undecorates to in production bodies to specify how a tree containing unique reference can be undecorated, and @e syntax for wrapping a unique reference to e with no attributes as an undecorated term that, when decorated, gives the same tree as e refers to. A very minimal version of the uniqueness analysis is also added, to the extent needed in the translation. For now, multiple decorations of a unique reference with the same inherited attribute gives a runtime error.

Documentation

Documentation is partially written, but has been partially outdated due to the subsequent renaming and work on uniqueness analysis. As such it doesn't make sense to focus on updating the docs until this sequence of PRs is merged.