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

feat(api): Introduce fold/map functions for AST traversal #368

Merged
merged 2 commits into from
Jun 3, 2024

Conversation

byakuren-hijiri
Copy link
Contributor

@byakuren-hijiri byakuren-hijiri commented May 30, 2024

This improves compiler's API providing an interface to traverse the AST. It should be a part of the compiler, since it is be useful for devtools using the API and might be useful internally.

See: #314

  • I have updated CHANGELOG.md
  • I have added tests to demonstrate the contribution is correctly implemented: this usually includes both positive and negative tests, showing the happy path(s) and featuring intentionally broken cases
  • I have run all the tests locally and no test failure was reported
  • I did not do unrelated and/or undiscussed refactorings

This improves compiler's API providing an interface to traverse the AST.
It should be a part of the compiler, since it is be useful for devtools
using the API and might be useful internally.

Refers to tact-lang#314
@byakuren-hijiri
Copy link
Contributor Author

Here are some examples of usage of these functions:

They could be used to traverse the AST by calling callback functions or accumulating information about the AST, so they are quite useful for all the tools working with Tact AST. Implementing this API in the compiler will make it easier to maintain the API upon AST changes.

Copy link
Member

@anton-trunov anton-trunov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!

@anton-trunov anton-trunov merged commit 1590a4c into tact-lang:main Jun 3, 2024
3 checks passed
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.

2 participants