This repository was archived by the owner on Sep 27, 2026. It is now read-only.
Moxy is replacing Zyn #31
aacebo
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Moxy is replacing Zyn
Zyn started as an attempt to make procedural macros easier to build: templates, reusable elements, typed extraction, diagnostics, attribute parsing, and a more ergonomic layer over the usual
syn+quote+proc_macro2stack.Over time, though, it became clear that many of the problems Zyn was trying to solve weren't really framework-level problems. They were limitations created by composing several independent syntax libraries and then building another abstraction layer on top of them.
Moxy is the result of taking a different approach.
Rather than sitting on top of the existing procedural macro stack, Moxy is a modular Rust syntax toolkit that owns the layers underneath it:
tokenization and token streams
parsing and typed syntax trees
templates / quasi-quoting
formatting
diagnostics
derive tooling
build-script utilities
optional
proc_macro2interoperabilityThis gives Moxy considerably more control over how the entire pipeline fits together.
Why replace Zyn?
Zyn is primarily a proc-macro framework. Its core still depends on
syn,quote, andproc_macro2, and most of its abstractions ultimately need to translate back into those libraries.Moxy instead treats Rust syntax itself as the foundation.
That distinction matters.
Owning the token model, parser, AST, formatter, and template system means those components can share the same conventions and data structures rather than adapting between independently designed libraries. It also makes it possible to optimize the complete pipeline rather than just the framework sitting on top of it.
Moxy is therefore not intended to be "Zyn 2.0" or simply a rewritten version of the same API. It is a lower-level and more general foundation from which the higher-level functionality that motivated Zyn can be built.
Performance
Performance was also one of the motivations for owning more of the stack.
Moxy is continuously benchmarked against
Benchmark | Difference -- | -- Control-flow expressions | Moxy ~25% faster Nested types | Moxy ~24% faster Invalid expressions | Moxy ~42% faster Mixed file items | Moxy ~11% faster Attributed uses | Syn ~15% fastersyn. Current benchmarks show Moxy ahead in several representative parsing workloads:The goal isn't to claim that Moxy is universally faster than
syn—it currently isn't. The important part is that the architecture gives us direct control over the parser and the ability to improve those cases without being constrained by another syntax layer.See the Moxy benchmarks for the current numbers.
Where this leaves Zyn
Zyn was useful for figuring out what a better procedural-macro development experience could look like. A number of those ideas—particularly templates, diagnostics, ergonomic token construction, and reducing proc-macro boilerplate—directly influenced Moxy.
Moxy does not yet contain every feature available in Zyn. Some of Zyn's higher-level conveniences are still being rebuilt on top of Moxy's new foundation, and those missing capabilities are planned to be added to Moxy soon.
The difference is that they can now be implemented on top of a syntax stack designed specifically to support them rather than maintained as another abstraction layer over
syn,quote, andproc_macro2.Because of that, maintaining Zyn as a separate framework alongside Moxy no longer makes much sense.
Going forward, development will focus on Moxy.
Zyn will remain available for existing users, while Moxy will continue gaining the remaining Zyn functionality and carry these ideas forward.
Moxy: https://github.com/aacebo/moxy
# Moxy is replacing ZynZyn started as an attempt to make procedural macros easier to build: templates, reusable elements, typed extraction, diagnostics, attribute parsing, and a more ergonomic layer over the usual
syn+quote+proc_macro2stack.Over time, though, it became clear that many of the problems Zyn was trying to solve weren't really framework-level problems. They were limitations created by composing several independent syntax libraries and then building another abstraction layer on top of them.
[Moxy](https://github.com/aacebo/moxy) is the result of taking a different approach.
Rather than sitting on top of the existing procedural macro stack, Moxy is a modular Rust syntax toolkit that owns the layers underneath it:
proc_macro2interoperabilityThis gives Moxy considerably more control over how the entire pipeline fits together.
Why replace Zyn?
Zyn is primarily a proc-macro framework. Its core still depends on
syn,quote, andproc_macro2, and most of its abstractions ultimately need to translate back into those libraries.Moxy instead treats Rust syntax itself as the foundation.
That distinction matters.
Owning the token model, parser, AST, formatter, and template system means those components can share the same conventions and data structures rather than adapting between independently designed libraries. It also makes it possible to optimize the complete pipeline rather than just the framework sitting on top of it.
Moxy is therefore not intended to be "Zyn 2.0" or simply a rewritten version of the same API. It is a lower-level and more general foundation from which the higher-level functionality that motivated Zyn can be built.
Performance
Performance was also one of the motivations for owning more of the stack.
Moxy is continuously benchmarked against
syn. Current benchmarks show Moxy ahead in several representative parsing workloads:The goal isn't to claim that Moxy is universally faster than
syn—it currently isn't. The important part is that the architecture gives us direct control over the parser and the ability to improve those cases without being constrained by another syntax layer.See the [Moxy benchmarks](https://github.com/aacebo/moxy/blob/master/BENCH.md) for the current numbers.
Where this leaves Zyn
Zyn was useful for figuring out what a better procedural-macro development experience could look like. A number of those ideas—particularly templates, diagnostics, ergonomic token construction, and reducing proc-macro boilerplate—directly influenced Moxy.
Moxy does not yet contain every feature available in Zyn. Some of Zyn's higher-level conveniences are still being rebuilt on top of Moxy's new foundation, and those missing capabilities are planned to be added to Moxy soon.
The difference is that they can now be implemented on top of a syntax stack designed specifically to support them rather than maintained as another abstraction layer over
syn,quote, andproc_macro2.Because of that, maintaining Zyn as a separate framework alongside Moxy no longer makes much sense.
Going forward, development will focus on Moxy.
Zyn will remain available for existing users, while Moxy will continue gaining the remaining Zyn functionality and carry these ideas forward.
Moxy: https://github.com/aacebo/moxy
All reactions