tact-lang / tact

Tact compiler main repository
https://tact-lang.org
MIT License
275 stars 56 forks source link

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

Closed byakuren-hijiri closed 3 weeks ago

byakuren-hijiri commented 3 weeks ago

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

byakuren-hijiri commented 3 weeks ago

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.