Thread: java parser in c++?

  1. #1
    Registered User
    Join Date
    Jan 2005

    java parser in c++?

    This is a long shot, but does anyone know of a parser (in c++, of course) that can parse java files, and get me the call graphs of the functions?

    I tried looking around for it, couldn't find much. Parsing C++ seems to be a challenge (think cure for AIDS), but they have have some incomplete solutions around (all thanks to the c++ templates). There seems to be a solid, stable one available, but for $40k to $250k, according to the developers (edg).

    So yeah, any ideas?

  2. #2
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    So what, parse Java or C++?

    For C++, the Mozilla project has some static analysis projects that should be able to do this.

    For Java, I don't know. Maybe you can hook up the GCC-based tools that Mozilla has to GCJ.

    Anyway, getting a complete callgraph for a program with dynamic dispatch (like function pointers or virtual functions) is impossible.
    All the buzzt!

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  3. #3
    Registered User
    Join Date
    Jan 2005
    Yeah, well if I can have both it'd be great, but that's unlikely to happen..

    I stumbled across a free c++ parser (Elsa), but it doesn't seem to work as well as I had hoped (compilation errors here and there). Maybe I'm just not trying hard enough..

    It's true that you can't get a complete callgraph, but even an incomplete one would be useful for code analysis I'd imagine..

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    Sounds like Doxygen is what you need.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem with a file parser.
    By Hulag in forum C++ Programming
    Replies: 7
    Last Post: 03-17-2005, 09:54 AM
  2. C#, Java, C++
    By incognito in forum A Brief History of
    Replies: 10
    Last Post: 10-05-2004, 02:06 PM
  3. The Java language is being expanded
    By DavidP in forum A Brief History of
    Replies: 26
    Last Post: 06-11-2004, 09:07 PM
  4. Java woes
    By DavidP in forum A Brief History of
    Replies: 15
    Last Post: 07-06-2003, 12:37 AM
  5. How to use Java with C++
    By Arrow Mk 84 in forum C++ Programming
    Replies: 2
    Last Post: 02-27-2003, 04:12 PM