Visualizing Rust AST - Help -needed

Questions:

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

./x.py build -i src/grammar

(from: https://github.com/rust-lang/rustc-guide/blob/master/src/how-to-build-and-run.md)

x.py 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: Command-line Arguments - The rustc book)

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