title: Using CDT's Abstract Syntax Tree API to generate/write C code?
body: <p>I have been able to use CDT's AST API for parsing source code successfully. My question involves the reverse: How can I build an C AST programmatically, and then tell it to write itself to a file? I have seen the class ASTWriter (but that is internal) and can't find any tutorials or documentation on building the actual AST. </p>
  
  <p>I have found a paper that goes over the idea of what I want to do: <a href="http://jeff.over.bz/papers/2008/sle2008.pdf" rel="nofollow">Generating Rewritable Abstract Syntax Trees</a> which makes it seem like generating code would be easy if I could construct the tree and say 'write yourself'. Is this possible in CDT and how might I get started (preferably without deprecated/internal methods?)</p>