acmpesuecc / ASTViz

A Visualizer for the clang AST
MIT License
0 stars 5 forks source link
hacknight-2024 hacktoberfest

ASTViz

Visualize and grep through the AST nodes for your codebases.

What are ASTs you might ask? Here you go

holy

Build Instructions

  1. Clone this repo

  2. Run the following commands in the project folder

    mkdir build && cd build
    cmake ../
    make

Usage

It is advised to have clang on your system for generating the AST.

# Where x.c is a random C source file.
clang -Xclang -ast-dump=json -fsyntax-only x.c > ast.json
./plot <path-to-json-file>

Resources

Jonas Devlieghere's Blog

Official Clang AST documentation

Baby steps with LibClang