Visualizing Rust AST - Help -needed


I’d like to visualize Rust code’s Abstract Syntax Tree (AST). The verbose output from /rust/src/grammar/parser-lalr-main.c looked like a good start. I tried

./ build -i src/grammar

(from: runs but I can’t locate it’s output specific to /rust/src/grammar/parser-lalr-main.c. Building the entirety of rustc works so I may have the binary I need but I don't know where it is. I tried rustc verbose and didn't see the commented output I expected from /rust/src/grammar/parser-lalr-main.c.

I researched and built llvm and I see llvm can output ASTs and intermediate code; does rustc have this facility? For example, would it be a .mir file? (from:

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.