[antlr-interest] code analysis tool

Brad b.knotwell at f5.com
Thu Oct 16 10:41:36 PDT 2003


Hello all--

Disclaimer:  I'm new to antlr and, though I've done some research, not
exactly familiar with methodologies for solving the problem I'd like to
solve.

Problem:  I'd like to create a tool that can be used to search for
common C coding errors (eg unchecked mallocs or fopens, memory leaks
under error conditions, malloc(strlen(myString + 1)) etc).  Furthermore,
I'm much more concerned about easily adding new checks than I am
efficiency.

My current high-level strategy (again, this is the first time I've
thought about this so I might be way off).

  1) use one of antlr's C tree parsers (specifically, GNUCTreeParser) to
create an abstract syntax tree.
  2) have each check traverse the tree to find and display instances of
its issue.

A coupla small questions:

  1) does this sound like a reasonable approach (AKA do I understand the
utility of tree parsers)?
  2) how difficult would you rate a project like this?
  3) how would you structure things to make adding new checks simple?

If these are inappropriate for this forum, lemme know.

Thanks.

-- 
Brad <b.knotwell at f5.com>


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 




More information about the antlr-interest mailing list