C++ parser in Java

Discussion in 'Java' started by PaulR, Apr 27, 2005.

  1. PaulR

    PaulR Guest

    Hi,

    can anyone recommend a reliable C++ parser for Java?

    I have a C++ project with around 300 (very similar) classes which I
    want to migrate to Java. It would be a big help to be able to parse the
    original files and extract key information from them. Especially struct
    info, variable and method names, comments etc and then create Java
    skeletons.

    I see that Eclipse has a C++ project. Is the parser accessible?

    Any ideas?

    Thanks

    Paul Ramsden
    PaulR, Apr 27, 2005
    #1
    1. Advertising

  2. PaulR

    Hal Rosser Guest

    Try some of the modeling software.
    Argo and Poseidon can convert Java code to UML and back
    Some may be able to do the same with C++ AND Java

    "PaulR" <> wrote in message
    news:...
    > Hi,
    >
    > can anyone recommend a reliable C++ parser for Java?
    >
    > I have a C++ project with around 300 (very similar) classes which I
    > want to migrate to Java. It would be a big help to be able to parse the
    > original files and extract key information from them. Especially struct
    > info, variable and method names, comments etc and then create Java
    > skeletons.
    >
    > I see that Eclipse has a C++ project. Is the parser accessible?
    >
    > Any ideas?
    >
    > Thanks
    >
    > Paul Ramsden
    >
    Hal Rosser, Apr 27, 2005
    #2
    1. Advertising

  3. PaulR

    bugbear Guest

    PaulR wrote:
    > Hi,
    >
    > can anyone recommend a reliable C++ parser for Java?
    >
    > I have a C++ project with around 300 (very similar) classes which I
    > want to migrate to Java. It would be a big help to be able to parse the
    > original files and extract key information from them. Especially struct
    > info, variable and method names, comments etc and then create Java
    > skeletons.
    >


    Do you want a C++ parser coded in java, a parser
    that will generate java from C++, and if the latter
    do you want it implemented in C++, java or other?

    Since Java is so different from C++, I suspect a simple
    perl (or similar) HACK would server, especially since the
    C++ can be assumed to follow (your) textual conventions.

    In any case, this may be helpful:
    http://www.parashift.com/c -faq-lite/compiler-dependencies.html#faq-38.11

    BugBear
    bugbear, Apr 28, 2005
    #3
  4. PaulR

    Betty Guest

    "bugbear" <bugbear@trim_papermule.co.uk_trim> wrote in message
    news:42709d2c$0$83083$...
    > PaulR wrote:
    > > Hi,
    > >
    > > can anyone recommend a reliable C++ parser for Java?
    > >
    > > I have a C++ project with around 300 (very similar) classes which I
    > > want to migrate to Java. It would be a big help to be able to parse the
    > > original files and extract key information from them. Especially struct
    > > info, variable and method names, comments etc and then create Java
    > > skeletons.
    > >

    >
    > Do you want a C++ parser coded in java, a parser
    > that will generate java from C++, and if the latter
    > do you want it implemented in C++, java or other?
    >
    > Since Java is so different from C++, I suspect a simple
    > perl (or similar) HACK would server, especially since the
    > C++ can be assumed to follow (your) textual conventions.
    >
    > In any case, this may be helpful:
    > http://www.parashift.com/c -faq-lite/compiler-dependencies.html#faq-38.11
    >
    > BugBear


    Try this, first compile the C++ program to gen an object file.
    Then use a decompiler to get the source back. This will get rid
    of all the preprocessor, comments, etc. and put the source into
    a regular style that should be the same for all your c++ programs.
    This should make it easier to write a program to convert from c++
    to java. Maybe even you can play with "lex" (not the bad guy
    on superman.)
    Betty, Apr 29, 2005
    #4
  5. PaulR

    PaulR Guest

    Thanks Betty. That's a useful idea, but I would like to migrate the
    comments as well.

    Ideally, I would like to get some kind of a tree structure which I can
    navigate through.

    e.g. get all private methods, get member variables etc.

    Paul
    PaulR, Apr 29, 2005
    #5
  6. On 29 Apr 2005 01:03:44 -0700, PaulR <> wrote:

    > Thanks Betty. That's a useful idea, but I would like to migrate the
    > comments as well.
    >
    > Ideally, I would like to get some kind of a tree structure which I can
    > navigate through.
    >
    > e.g. get all private methods, get member variables etc.
    >
    > Paul
    >


    There may be a C++ grammar for JavaCC, try googling for that.
    Michiel
    Michiel Konstapel, May 1, 2005
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bernd Oninger
    Replies:
    0
    Views:
    744
    Bernd Oninger
    Jun 9, 2004
  2. ZOCOR

    XML Parser VS HTML Parser

    ZOCOR, Oct 3, 2004, in forum: Java
    Replies:
    11
    Views:
    797
    Paul King
    Oct 5, 2004
  3. Bernd Oninger
    Replies:
    0
    Views:
    799
    Bernd Oninger
    Jun 9, 2004
  4. Joel Hedlund
    Replies:
    2
    Views:
    488
    Joel Hedlund
    Nov 11, 2006
  5. Joel Hedlund
    Replies:
    0
    Views:
    294
    Joel Hedlund
    Nov 11, 2006
Loading...

Share This Page