java parser in c++?

This is a discussion on java parser in c++? within the C++ Programming forums, part of the General Programming Boards category; This is a long shot, but does anyone know of a parser (in c++, of course) that can parse java ...

  1. #1
    Registered User
    Join Date
    Jan 2005
    Posts
    108

    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
    Posts
    8,893
    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!
    CornedBee

    "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
    Posts
    108
    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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,592
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

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, 08:54 AM
  2. C#, Java, C++
    By incognito in forum A Brief History of Cprogramming.com
    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 Cprogramming.com
    Replies: 26
    Last Post: 06-11-2004, 09:07 PM
  4. Java woes
    By DavidP in forum A Brief History of Cprogramming.com
    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, 03:12 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21