dtolnay/syn

Parser for Rust source code

View on GitHub ↗Jump to charts ↓Open shareable report

Summary Information

Updated 13 minutes ago
Added to GitGenius on September 20th, 2026
Created on September 3rd, 2016
Open Issues & Pull Requests: 72 (+0)
GitHub issues: Enabled
Number of forks: 375
Total Stargazers: 3,422 (+0)
Total Subscribers: 24 (+0)

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Open issues: 47
New in 7 days: 1
Closed in 7 days: 2
Avg open age: 391 days
Stale 30+ days: 47
Stale 90+ days: 23

Recent activity

Opened in 7 days: 1
Closed in 7 days: 1
Comments in 7 days: 0
Events in 7 days: 0

Top labels

  • syntax (53)
  • breaking change (12)
  • docs (2)
  • bug (1)

Most active issues this week

Detailed Description

Syn is a parsing library for Rust source code that converts token streams into syntax trees, primarily designed for use in procedural macros.

Syn solves the problem of parsing Rust tokens into structured syntax trees that procedural macros can inspect and manipulate. It provides data structures representing Rust syntax at multiple levels of granularity, from complete files down to individual expressions and types. The library includes specialized entry points like DeriveInput for derive macros, along with generic parser functions that accept a ParseStream and return a Result, allowing both use of predefined syntax tree types and construction of custom syntaxes. Every parsed token carries span information tracking line and column positions, enabling procedural macros to generate error messages that point to exact locations in user code.

Syn is the natural choice for anyone writing procedural macros in Rust. It suits projects that need to parse and analyze Rust code at compile time, whether implementing derive macros, attribute macros, or function-like macros. The library's aggressive feature gating means you only pay compile-time costs for the syntax tree nodes and functionality your macro actually uses. The README positions Syn as the standard tool for this task, referencing a procedural macro workshop as the canonical learning resource.

The project maintains a comprehensive test suite covering the syntax tree implementations. Development activity shows consistent attention to correctness and compatibility with Rust's evolving syntax, including support for both stable and unstable language features. The library receives regular updates to track changes in the Rust language and maintain compatibility with the procedural macro ecosystem.