Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scopes: Update encoding to 'tags' approach #171

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

szuend
Copy link
Collaborator

@szuend szuend commented Feb 4, 2025

This PR changes the encoding of the "Scopes" proposal to the "Tag" approach presented in the TG4 meeting of 2024-01-30 (see slides.

The information contained is exactly the same, we just use a different encoding scheme to be future-proof.

The PR includes some changes w.r.t. to the slides. These are of course up for discussion:

  • The PR stores binding expressions in a separate JSON field "expressions" rather than piggy-backing on "names". This was discussed in some forums. I'm not 100% sure about this as some strings may end up twice in the source map this way. Especially if no variable renaming happened.
  • The slides didn't contain a way how to connect original scope trees to source file indices. The PR includes a new (optional) original_scope_source_index item that can be used to connect a root original scope tree with a specific source file. A second way is to include exactly as many root original scope trees as there are source files, so the connection is implicit via indices. The generator can choose the approach.
  • The PR moves FLAGS in original_scope_start to the beginning to. be more consistent with generated_range_start.
  • DEFINITION in generated_range_start is not an item index, but rather the nth original_scope_start item to further reduce the magnitude of the value.
  • The PR splits bindings into 2 separate items: The general case is a simple list of expressions that map 1:1 to the variables list. I.e. the variables use the same expression throughout the full generated range. The subrange mechanism was split into its own item: It contains a variable index, so it can be applied to some variables. This allows us to encode expressions relative to each other and we no longer have the shenanigans with -1 meaning unavailable and < -1 means "number of subranges".

The wording is still ambiguous in some cases, but should be (mostly) enough for the proposal doc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant