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

Sean Silva silvas at purdue.edu
Tue Jul 17 20:51:38 PDT 2012


> 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 is usually unnecessary in my experience (at least while learning)
because usually the stuff you feed it to be dumped will only contain
one use of a give identifier or number, which uniquely tracks the node
back to the source.

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

any diagnosis as to why it failed?

--Sean Silva

On Tue, Jul 17, 2012 at 6:40 PM, Joshua Cranmer <pidgeot18 at gmail.com> wrote:
> 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
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits



More information about the cfe-commits mailing list