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

Require explicit new for undecoration #849

Open krame505 opened 2 months ago

krame505 commented 2 months ago

Changes

Fixes #751.

This changes the semantics of referring to a (non-data) nonterminal child/local/translation attribute/pattern variable to be always decorated, and require explicit new to undecorate the tree. Let expressions binding decorated trees also no longer implicitly undecorate.

The bulk of the changes here are a largely automated refactor to use tree sharing, and explicit new where that isn't possible. Thus if anyone would actually like to try reviewing this, it is probably easiest to look at individual commits that have the type system changes.

This is a major breaking change - downstream projects will need to be refactored as well before merging this PR. Issues #842 and #843 should probably also be addressed before attempting this refactoring.

There is a slight regression in the deep-rebuild time (maybe 10%?) , which I haven't investigated too closely yet. I was expecting performance to improve through more use of sharing and type system simpliciations, but there is also a new pass for specializing InhSets, and a lot of calls to new added.

Documentation

The documentation has not yet been updated. I think the main things to fix are https://melt.cs.umn.edu/silver/concepts/decorated-vs-undecorated/#implicit-decoration and any uses of implicit undecoration in examples.

Testing

The Silver compiler, test suite and tutorials have been updated to account for these changes.