1

I've been searching for a semantic analyzer for C language lately, but couldn't find any. I've found flex and yacc C language files to generate a parser. I've managed to modify them and generate a parser. But now i need to perform next step. I'll appreciate if someone could point me to some examples of semantic analysis for C and building the tree. Any information about semantic analysis will be helpful either. I've found some tiny C compilers but they use their own parsers so they doesn't suite me.

roman
  • 5,100
  • 14
  • 44
  • 77

1 Answers1

1

Our DMS Software Reengineering Toolkit and its C Front End probably provide what you need.

DMS provides general purpose parsing, tree building, and program analysis machinery. The C front end specializes this for the C language. It handles many common dialects/variants of C (GCC, Microsoft, Green Hills) with their dark corners, parses and builds ASTS, builds control and data flow graphs, points-to analysis as well as global call graphs accounting for indirect function pointers.

You can try to do all of this yourself, but you'll find it takes man-years to get all this right.

Ira Baxter
  • 93,541
  • 22
  • 172
  • 341