syn is a Rust syntax tree parser and token stream converter. It serves as a toolkit for procedural macro development, providing a framework to parse Rust source code into structured syntax trees for analysis and transformation.
The project enables the manipulation of Rust abstract syntax trees through specialized visitor and folder patterns for traversing and mutating nodes. It provides a bidirectional mapping that allows developers to convert token streams into structured trees and print those trees back into tokens for code generation.
The library covers a broad range of syntax analysis capabilities, including the parsing of expressions, type definitions, and top-level items. It also includes mechanisms for tracking source code spans to support precise error reporting and the ability to define custom syntax for specific identifiers or symbols.