Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 121349
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T03:57:25+00:00 2026-05-11T03:57:25+00:00

What are some good tools for getting a quick start for parsing and analyzing

  • 0

What are some good tools for getting a quick start for parsing and analyzing C/C++ code?

In particular, I’m looking for open source tools that handle the C/C++ preprocessor and language. Preferably, these tools would use lex/yacc (or flex/bison) for the grammar, and not be too complicated. They should handle the latest ANSI C/C++ definitions.

Here’s what I’ve found so far, but haven’t looked at them in detail (thoughts?):

  • CScope – Old-school C analyzer. Doesn’t seem to do a full parse, though. Described as a glorified ‘grep’ for finding C functions.
  • GCC – Everybody’s favorite open source compiler. Very complicated, but seems to do it all. There’s a related project for creating GCC extensions called GEM, but hasn’t been updated since GCC 4.1 (2006).
  • PUMA – The PUre MAnipulator. (from the page: ‘The intention of this project is to provide a library of classes for the analysis and manipulation of C/C++ sources. For this purpose PUMA provides classes for scanning, parsing and of course manipulating C/C++ sources.’). This looks promising, but hasn’t been updated since 2001. Apparently PUMA has been incorporated into AspectC++, but even this project hasn’t been updated since 2006.
  • Various C/C++ raw grammars. You can get c-c++-grammars-1.2.tar.gz, but this has been unmaintained since 1997. A little Google searching pulls up other basic lex/yacc grammars that could serve as a starting place.
  • Any others?

I’m hoping to use this as a starting point for translating C/C++ source into a new toy language.

Thanks! -Matt

(Added 2/9): Just a clarification: I want to extract semantic information from the preprocessor in addition to the C/C++ code itself. I don’t want ‘#define foo 42′ to disappear into the integer ’42’, but remain attached to the name ‘foo’. This, unfortunately, excludes several solutions that run the preprocessor first and only deliver the C/C++ parse tree)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T03:57:25+00:00Added an answer on May 11, 2026 at 3:57 am

    Parsing C++ is extremely hard because the grammar is undecidable. To quote Yossi Kreinin:

    Outstandingly complicated grammar

    ‘Outstandingly’ should be interpreted literally, because all popular languages have context-free (or ‘nearly’ context-free) grammars, while C++ has undecidable grammar. If you like compilers and parsers, you probably know what this means. If you’re not into this kind of thing, there’s a simple example showing the problem with parsing C++: is AA BB(CC); an object definition or a function declaration? It turns out that the answer depends heavily on the code before the statement – the ‘context’. This shows (on an intuitive level) that the C++ grammar is quite context-sensitive.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 120k
  • Answers 120k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Initialise the ValueChangedCallback the first time the ItemsSourceCallBack is executed.… May 12, 2026 at 12:10 am
  • Editorial Team
    Editorial Team added an answer You could possibly use ITrackingHandler to track when your object… May 12, 2026 at 12:10 am
  • Editorial Team
    Editorial Team added an answer You're asking more about Search Engine Optimization (SEO), which has… May 12, 2026 at 12:10 am

Related Questions

Why are pointers such a leading factor of confusion for many new, and even
I just wonder what options there are to properly measure/profile/optimize ASP.net 2.0 Web Parts,
I want to get smarter in AJAX, but not sure which way to go.
I myself am one of these types of coders, who never learned coding in

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.