[cfe-commits] [PATCH] More Docs: Mastering the Clang AST

Joshua Cranmer pidgeot18 at gmail.com
Tue Jul 17 18:40:09 PDT 2012


On 7/17/2012 6:07 PM, Sean Silva wrote:
> 1. lots of superfluous information; I don't care about the pointer
> values when I'm trying to learn the structure of the AST. Same for
> line/column number information. I understand that this dumping
> functionality wasn't really designed with this in mind; it's just a
> matter of writing a suitable dumper.

On the contrary, I actually like having line/column numbers so I can 
match things up with where they are in the source tree.

> This requires:
> 1. The diagram.
> 2. An easy and complete way to visualize the AST that corresponds to
> the diagram.
> 3. Iteration time should be very fast.

When I worked with another C++ parser (now defunct), I built the 
following tool for being able to play along: 
<http://www.tjhsst.edu/~jcranmer/static/webpork/>. It's basically a PHP 
script that does an XML dump of the parser and turns it into some basic 
HTML structure that I through some CSS around to give it the tree-ish 
view it has. It turned out to be invaluable for poking around the AST, 
particularly when trying to figure out how to trigger specific values.

My attempt to do a similar thing for clang ended up failing extremely 
miserably.

I think web-appy stuff works really well for very fast iteration times, 
but I'm biased by being in an organization that loves web apps.

-- 
Joshua Cranmer
News submodule owner
DXR coauthor




More information about the cfe-commits mailing list