0

As an academic project, I have to create a front-end for a static analyser. I am new to C/C++ and my main language is Java. Initially I have to use Clang to generate an AST for the input C program. Then I need to create the corresponding CFG where after I will do some other tasks. I am struggling to find any good examples or tutorials of how to generate an AST of a C program. Any thoughts or suggestions of how should I approach this project?

Thanks in advance.

2
  • 1
    You might want to have a look at this list. Also, libclang may be what you want. Commented Nov 15, 2017 at 15:18
  • Unfortunately, I could not find a way to generate a CFG with libclang. Though, it was very useful to understand the process of parsing the source code. :) Commented Nov 22, 2017 at 15:55

1 Answer 1

2

Post that includes links to Clang AST tutorials and related posts:

http://variousburglarious.com/2017/01/18/getting-started-with-clang-refactoring-tools/

Repository of Clang AST examples, mostly refactoring and analyzing using AST matchers. Nothing to do with CFG, but maybe it will help?

https://github.com/lanl/CoARCT

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks a lot for the info. I have also found a good presentation from a lecture: Program Analysis with Clang
The top link no longer exists.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.