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 6749445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:41:27+00:00 2026-05-26T12:41:27+00:00

I need to parse files written in some languages(Java, C, C#…) and then trace

  • 0

I need to parse files written in some languages(Java, C, C#…) and then trace the AST(Abstract syntax tree) to xml. (Actually the aim is to manipulate it and trace to another language – this second part have been implemented). After investigation I find out that there is no common approach to do this.

The most closest one is srcML. But first problem is that it is not Java =). The second problem is amount of languages (only 3).

I know that DMS can solve this problem, but it is not free and open-source.

So, as I understand, there is single way to do this: take ANTLR and try to convert AST to XML. So question is how to do it with ANTLR(Java), or maybe I miss some(not ANTLR way) to do this.

  • 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. Editorial Team
    Editorial Team
    2026-05-26T12:41:28+00:00Added an answer on May 26, 2026 at 12:41 pm

    There are more Java tools besides ANTLR that can do this (JavaCC is a popular alternative, to name just one).

    Using a parser generator to solve this problem, you’d need to do the following:

    1. define a grammar which the parser can interpret and generate a lexer and parser (in your case, you need 3 grammars for your 3 languages);
    2. iterate over the AST your parser created, and output plain text (XML, in your case);

    Grammars for Java, C# and C are available on ANTLR’s Wiki, I’m sure readily available grammars exist for JavaCC (and other parser generator tools: Google is your friend here). But be aware that it is a Wiki, and many grammars are in an experimental state, or contain errors.

    You could just skip step #1 and find existing parser that construct the AST for you. You only need to walk the AST yourself and create an XML from it. Here‘s a Java 5 parser, for example (for the other ones, again, Google is your friend).

    Good luck.

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

Sidebar

Related Questions

I have a rather big number of source files that I need parse and
I need a PHP Regex that can parse .strings files. In particular, it needs
I need parse through a file and do some processing into it. The file
I need to parse a xml file which is practically an image of a
I have an XML file which I need to parse using PHP and send
I’m working on some expression tree code written by a colleague and am looking
I have some reasonable (not obfuscated) Perl source files, and I need a tokenizer,
I have a Java application that monitors a folder for incoming XML files. When
We have a need to parse and extract the content from html files. We
I have some data files that are written as tag = value, where tag

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.