C parser for reading C source files?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Neo

    #1

    C parser for reading C source files?

    Hi all,

    I've to parse C source files to put some profiling points at all basic
    blocks like IF, FOR, WHILE, and FUNCTIONS. Is there any generic parser
    available?

    -Neo


  • Ira Baxter

    #2
    Re: C parser for reading C source files?

    "Neo" <timeless_illus ion@yahoo.com> wrote in message
    news:30g74vF30g nb6U1@uni-berlin.de...[color=blue]
    > I've to parse C source files to put some profiling points at all basic
    > blocks like IF, FOR, WHILE, and FUNCTIONS. Is there any generic parser
    > available?[/color]

    You can get such a parser for ANSI, GNU and MSVC from Semantic Designs.
    See http://semanticdesigns.com/Products/DMS/DMSToolkit.html.

    Techniques for doing code instrumentation with DMS are documented
    in a PDF file on the web page
    http://semanticdesigns.com/Products/TestCoverage.
    This page also describes test coverage tools, and leads to
    a page on profiling tools (for C and many other languages)
    that may already do exactly what you need, off the shelf.

    --
    Ira D. Baxter, Ph.D., CTO 512-250-1018
    Semantic Designs, Inc. www.semdesigns.com


    Comment

    • Ben Pfaff

      #3
      Re: C parser for reading C source files?

      "Neo" <timeless_illus ion@yahoo.com> writes:
      [color=blue]
      > I've to parse C source files to put some profiling points at all basic
      > blocks like IF, FOR, WHILE, and FUNCTIONS. Is there any generic parser
      > available?[/color]

      http://osx.freshmeat.net/projects/sparse/
      --
      int main(void){char p[]="ABCDEFGHIJKLM NOPQRSTUVWXYZab cdefghijklmnopq rstuvwxyz.\
      \n",*q="kl BIcNBFr.NKEzjwC IxNJC";int i=sizeof p/2;char *strchr();int putchar(\
      );while(*q){i+= strchr(p,*q++)-p;if(i>=(int)si zeof p)i-=sizeof p-1;putchar(p[i]\
      );}return 0;}

      Comment

      Working...