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

Origins #5

Open
4 tasks
Virtlink opened this issue Sep 14, 2016 · 3 comments
Open
4 tasks

Origins #5

Virtlink opened this issue Sep 14, 2016 · 3 comments

Comments

@Virtlink
Copy link
Owner

Virtlink commented Sep 14, 2016

Spoofax uses origin tracking to track where terms came from. This information must be added to the green tree, and be kept under transformations.

  • Add nullable origin information to proto-terms.
  • Add an option to copy origin information to a replacement term (in withChild).
  • Write example for working with origin information.
  • Write test for origin information.
@Apanatshka
Copy link

Doesn't adding this to green tree make all green nodes unique and unshareable in normal parse trees? Is the width info not enough to reconstruct origin info in the red trees?

@Virtlink
Copy link
Owner Author

Yes and yes. Adding origins will makes each node unique and therefore unshareable, and the width info should be enough to reconstruct the origin info.

However, once we start moving subtrees and terms around (term rewriting, transformations, desugarings), the only way to know where a term came from (e.g. for error reporting, highlighting, etc) is by storing the origin information explicitly with the term.

@Apanatshka
Copy link

I can think of other ways.. Like a transformed term points back to the origin parse tree, where it came from. Of course this might be problematic with the original parse tree needing to stay alive all the time and further and further away from the information source that you derive origin info from..

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

No branches or pull requests

2 participants