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

refactor(AztecMacro): Refactor the macros to improve stability and readability #5080

Closed
Tracked by #5077
LHerskind opened this issue Mar 8, 2024 · 1 comment
Closed
Tracked by #5077
Assignees

Comments

@LHerskind
Copy link
Contributor

LHerskind commented Mar 8, 2024

Working with the macros can currently be quite painful and difficult. They should be refactor to improve the readability, and make it easier to participate in.

How this task will be solved greatly depends on what the timeline looks like for Noir Macros

@github-project-automation github-project-automation bot moved this to Todo in A3 Mar 8, 2024
Thunkar added a commit that referenced this issue Mar 11, 2024
Partially addresses
#5080

Until we have full macro support in noir, this PR aims to make using
what we currently have a little bit less painful.
The crate is now divided into utils of several kind (ast manipulation,
error handling, hir manipulation...) and transforms.

A transform is an end-to-end modification to the noir code that
generates a valid compilation result from a given contract. This makes
it easier to manipulate (and hopefully soon, replace) said modifications
atomically, improving readability.

This also modifies the first macro pass to iterate over all crates, not
only the root one, which allows us to implement more stuff without
having to dig deep into the def collector or (god forbid) the interner.

The second macro pass has been renamed to `process_collected_defs`.
Tried to generalize it a bit more, but providing a mutable ref for the
whole `def_collector` turned out to be tricky without cloning
`def_maps`, so it's staying like it is now.
AztecBot added a commit to noir-lang/noir that referenced this issue Mar 11, 2024
Partially addresses
AztecProtocol/aztec-packages#5080

Until we have full macro support in noir, this PR aims to make using
what we currently have a little bit less painful.
The crate is now divided into utils of several kind (ast manipulation,
error handling, hir manipulation...) and transforms.

A transform is an end-to-end modification to the noir code that
generates a valid compilation result from a given contract. This makes
it easier to manipulate (and hopefully soon, replace) said modifications
atomically, improving readability.

This also modifies the first macro pass to iterate over all crates, not
only the root one, which allows us to implement more stuff without
having to dig deep into the def collector or (god forbid) the interner.

The second macro pass has been renamed to `process_collected_defs`.
Tried to generalize it a bit more, but providing a mutable ref for the
whole `def_collector` turned out to be tricky without cloning
`def_maps`, so it's staying like it is now.
@LHerskind
Copy link
Contributor Author

Closing this as it is in a good state for now.

@github-project-automation github-project-automation bot moved this from Todo to Done in A3 Mar 25, 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

2 participants