Parser for Rust source code is a major Rust crate for parsing Rust source code (token streams) into a syntax tree (AST) that procedural macros can inspect or transform. The primary target is macro authors: you can parse TokenStreams into syn::File, syn::Item, syn::Expr, syn::Type, etc. It offers rich data structures, fine-grained parsing, span tracking (for error reporting), traversal and mutation APIs (visit, fold, visit_mut), printing back to tokens, and strong feature-gating so you only compile what you need. The documentation emphasises that while the crate is geared for procedural macros (and custom derives), some of the APIs may be of more general use. Using syn you can effectively write code that analyzes or generates Rust code at compile time.

Features

  • Full syntax tree representation of Rust source (syn::File, syn::Item, etc)
  • Parsing support from token streams via syn::parse*, Parse trait, etc
  • Span-information tracking for tokens (line/column) to support diagnostics
  • Tree traversal/mutation via visit, visit_mut, fold traits
  • Printing/output support to convert AST back to TokenStreams for macros
  • Modular feature flags (derive, full, parsing, printing, extra-traits) to minimize compile-time cost

Project Samples

Project Activity

See All Activity >

License

Apache License V2.0

Follow Parser for Rust source code

Parser for Rust source code Web Site

Other Useful Business Software
ACI Learning: Internal Audit, Cybersecurity, and IT Training Icon
ACI Learning: Internal Audit, Cybersecurity, and IT Training

Proven skill building for every aspect of your support or IT team.

Traditional training doesn't equip employees with the practical skills they need to drive business success. ACI Learning provides hands-on IT and cybersecurity training designed to build real-world, on-the-job skills. Our outcome-based programs empower employees with certification prep, industry-recognized credentials, and flexible learning options. With expert-led video training, labs, and scalable solutions, we help businesses, individuals, governments, and academic institutions develop a skilled workforce, align with business goals, and stay ahead in a rapidly evolving digital world.
Learn More
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of Parser for Rust source code!

Additional Project Details

Programming Language

Rust

Related Categories

Rust Libraries, Rust Parser Generators

Registered

2025-11-14