metaborg / nabl

Spoofax' Name Binding Language
Apache License 2.0
7 stars 12 forks source link

Export proper Scope Graph Libraries. #72

Open AZWN opened 3 years ago

AZWN commented 3 years ago

Short description Correctly configure project scope of a library, and limit library to externally visible scopes.

Problem description. Currently, Statix provides a menu option to export scope graph libraries, which can subsequently be imported by other projects. However, the exported scope graphs have five important deficiencies:

Describe the solution you'd like To solve these problems, we should include the project root scope in the ProjectResult. On export, that will allow adding it to the list of shared scopes of the library, and avoid setting the datum. Addintionally, we can filter out all scopes with the same resource as the project root scope, which effectively removes all declarations from the projectOk constraint. The fourth problem can be solved by transitively traversing the edges and data of all scopes reachable from the root scope, and only including these scopes in the final library.

Additional context The manual solution to the first two steps in described in https://www.spoofax.dev/howtos/statix/migrating-to-concurrent-solver/#using-libraries.