rusty-ast
A Rust Abstract Syntax Tree (AST) visualization tool. This tool parses Rust source code and displays its syntactic structure in text or JSON format.
Features
- Generate AST from Rust source code files or strings
- Display AST in readable text format
- JSON output option
- Support for various Rust syntax elements:
- Function definitions
- Struct definitions
- Enum definitions
- Variable declarations
- Control flow (if, while, loop)
- Expressions (binary operations, function calls, literals, etc.)
Installation
Install using Cargo:
Or clone and build from this repository:
Usage
Command Line Tool
Basic usage:
# Parse a Rust source file
# Parse Rust code directly
# Output in JSON format
As a Library
Add to your Cargo.toml:
Example code:
use ;
use Visit;
License
MIT
Contributing
Contributions are welcome, including bug reports, feature requests, and pull requests.