Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
sesiuni:llvm:intro [2015/09/07 11:20]
freescale Add backend
sesiuni:llvm:intro [2015/09/08 10:52] (current)
freescale Explain how to get the AST
Line 14: Line 14:
 ** AST Examples: ** ** AST Examples: **
  
-To get a better understanding of what an AST looks like, we can dump the ASTs produced by Clang for some simple files. You can start with the ones below. You should ​try to modify them and check out other language constructs to see how they are expressed in the AST.+To get a better understanding of what an AST looks like, we can dump the ASTs produced by Clang for some simple files. To do this, run: 
 +<code bash> 
 +clang -Xclang -ast-dump -fsyntax-only <​your-file>​ 
 +</​code>​ 
 + 
 +You should try this for a few examples to get a feel of it. You can start with the ones below. You can try to modify them and check out other language constructs to see how they are expressed in the AST
 + 
 +The **-fsyntax-only** option tells Clang to stop the compilation process after building the AST. The **-Xclang** flag specifies that the option following it should be passed to the front-end (which is confusingly dubbed Clang, just like the command line driver). Without this flag, **-ast-dump** is not recognized
  
 <file c 1-basic.c>​ <file c 1-basic.c>​
sesiuni/llvm/intro.txt · Last modified: 2015/09/08 10:52 by freescale