Rust AST parser & emitter: what do you use?
⚓ Rust 📅 2025-09-08 👤 surdeus 👁️ 11In Python I use builtin ast; in Java I use javaparser; in C I wrote a custom parser/emitter; in TypeScript I use builtin functions; …
What should I use in Rust? - In the past I've hacked away with nom, syn, quote, and prettyplease… it would be nice to see a higher level API that enables:
- parsing—without evaluation—and emission of the following:
derives and other macros- imports (
use) structsimplblocksfnprototypes (I don't care about body-parsing, just want to understand the interface and be able to replace the interface and push the body back verbatim)- global
const/letbindings - comments
Thanks
5 posts - 2 participants
🏷️ Rust_feed