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

compiler: maybe make AST visitors run in sequence #638

Closed
josephjclark opened this issue Mar 21, 2024 · 0 comments
Closed

compiler: maybe make AST visitors run in sequence #638

josephjclark opened this issue Mar 21, 2024 · 0 comments

Comments

@josephjclark
Copy link
Collaborator

At the moment, the compiler will walk the job AST once, and call out to each transformer function as it walks the tree.

This sort of means that all the visitors run at the same time. There's no sequencing.

That's been fine up until now. But the experiment lazy-state transformer give us a problem. Technically, it needs to replace the $ references before import statements are generated - otherwise the $ (which is an unused variable) will be imported from the adaptor.

Solutions:

  • Run each transformer once, in order, in its own parse of the tree, and pass the tree downstream. This means parsing the AST like 4 times (becasue we have 4 transformers right now)
  • Add an order to the transformer, and for each order key, build a single visitor. This introduces multiple passes of the AST, but not one per transformer

I prefer that second approach - it's a better compromise.

@github-project-automation github-project-automation bot moved this to New Issues in v2 Mar 21, 2024
@christad92 christad92 moved this from New Issues to Backlog in v2 Mar 26, 2024
@josephjclark josephjclark moved this from Backlog to In review in v2 Apr 10, 2024
@github-project-automation github-project-automation bot moved this from In review to Done in v2 Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

1 participant