C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

C++ to XML parser - does one exist?

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ Language (Moderated)
View previous topic :: View next topic  
Author Message
John Nagle
Guest





PostPosted: Sat Oct 22, 2005 1:55 pm    Post subject: C++ to XML parser - does one exist? Reply with quote



I'm looking for a tool to simplify program manipulation.
I need something that parses C++ into a tree format,
INCLUDING the comments and line breaks, and which can
also turn that tree format back into source text.
The parse tree must identify the syntatic elements of C++,
with function calls and type declarations correctly parsed.

Ideally, the parser would generate the tree as an XML
file, for ease of handling. But that's optional.

The idea is to allow writing simple tools that check
or modify declarations and function calls to add some
safety checks.

Does anything like this exist?

John Nagle
Animats

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Back to top
David Abrahams
Guest





PostPosted: Sat Oct 22, 2005 6:10 pm    Post subject: Re: C++ to XML parser - does one exist? Reply with quote



John Nagle <nagle (AT) animats (DOT) com> writes:

Quote:
I'm looking for a tool to simplify program manipulation.
I need something that parses C++ into a tree format,
INCLUDING the comments and line breaks, and which can
also turn that tree format back into source text.
The parse tree must identify the syntatic elements of C++,
with function calls and type declarations correctly parsed.

Ideally, the parser would generate the tree as an XML
file, for ease of handling. But that's optional.

The idea is to allow writing simple tools that check
or modify declarations and function calls to add some
safety checks.

Does anything like this exist?

http://synopsis.fresco.org/ may help.

There is also http://www.gccxml.org/HTML/Index.html although I believe
that the bodies of functions may not be represented.

--
Dave Abrahams
Boost Consulting
www.boost-consulting.com

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]


Back to top
Ismail Pazarbasi
Guest





PostPosted: Sat Oct 22, 2005 6:15 pm    Post subject: Re: C++ to XML parser - does one exist? Reply with quote



I don't know whether one exists, neither searched for one. You want
something special, I think. Because how would you build a tree from C++
source? If you need something like UML, there are ULM-to-XML
converters. But most (AFAIK) UML applications do not like C++ at all.
(I guess, Rational Rose is exception)

I guess you need something more like a lex-yacc work, write your very
own parser, translator.

Ismail


[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Back to top
jeff.koftinoff@gmail.com
Guest





PostPosted: Sun Oct 23, 2005 9:57 am    Post subject: Re: C++ to XML parser - does one exist? Reply with quote


John Nagle wrote:
Quote:
I'm looking for a tool to simplify program manipulation.
I need something that parses C++ into a tree format,
INCLUDING the comments and line breaks, and which can
also turn that tree format back into source text.
The parse tree must identify the syntatic elements of C++,
with function calls and type declarations correctly parsed.


Not exactly what you are thinking of, but you can probably add the
remaining features to GCC-XML, seen at:

http://www.gccxml.org/HTML/Index.html

I think this is a very worthwhile idea and project.

Jeff

--
Jeff Koftinoff
[email]jeffk (AT) jdkoftinoff (DOT) com[/email]
[email]jeff.koftinoff (AT) gmail (DOT) com[/email]
www.jdkoftinoff.com


[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]


Back to top
ben
Guest





PostPosted: Sun Oct 23, 2005 10:00 am    Post subject: Re: C++ to XML parser - does one exist? Reply with quote

John Nagle wrote:
Quote:
I'm looking for a tool to simplify program manipulation.
I need something that parses C++ into a tree format,
INCLUDING the comments and line breaks, and which can
also turn that tree format back into source text.
The parse tree must identify the syntatic elements of C++,
with function calls and type declarations correctly parsed.

Ideally, the parser would generate the tree as an XML
file, for ease of handling. But that's optional.

The idea is to allow writing simple tools that check
or modify declarations and function calls to add some
safety checks.


I think all C++ compilers represent the program in trees at some point
of compilation. If you can't find an existing tool maybe you can try to
tweak a (open source) compiler to do so.

ben

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]


Back to top
John Nagle
Guest





PostPosted: Sun Oct 23, 2005 10:00 am    Post subject: Re: C++ to XML parser - does one exist? Reply with quote

David Abrahams wrote:

Quote:
John Nagle <nagle (AT) animats (DOT) com> writes:


I'm looking for a tool to simplify program manipulation.
I need something that parses C++ into a tree format,
INCLUDING the comments and line breaks, and which can
also turn that tree format back into source text.
The parse tree must identify the syntatic elements of C++,
with function calls and type declarations correctly parsed.

Ideally, the parser would generate the tree as an XML
file, for ease of handling. But that's optional.

The idea is to allow writing simple tools that check
or modify declarations and function calls to add some
safety checks.

Does anything like this exist?


http://synopsis.fresco.org/ may help.

There is also http://www.gccxml.org/HTML/Index.html although I believe
that the bodies of functions may not be represented.

Thanks. Both look promising, although neither is really finished
yet. Synopsis, in particular, will tear apart code,
keep the comments, produce a parse tree, and retain enough info
to regenerate the source. Almost. I'll have to see how well it
works.

John Nagle

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]


Back to top
Greg Herlihy
Guest





PostPosted: Sun Oct 23, 2005 10:02 am    Post subject: Re: C++ to XML parser - does one exist? Reply with quote

John Nagle wrote:
Quote:
I'm looking for a tool to simplify program manipulation.
I need something that parses C++ into a tree format,
INCLUDING the comments and line breaks, and which can
also turn that tree format back into source text.
The parse tree must identify the syntatic elements of C++,
with function calls and type declarations correctly parsed.

Ideally, the parser would generate the tree as an XML
file, for ease of handling. But that's optional.

The idea is to allow writing simple tools that check
or modify declarations and function calls to add some
safety checks.

Does anything like this exist?

Yes. Translating C++ into some kind of XML schema has been the subject
of several research projects at various universities in recent years.
There is little consensus about which parts of a C++ program should be
captured in the XML; some translate only declarations and not
definitions, for example. There have been attempts to formulate a
standard XML schema to describe a C++ program, but issues like the
preprocessor and inline assembly language complicate the
representation. I believe more research is probably needed in this
area.

The only tool that I am aware of that preserves comments and identation
of the C++ source files is srcML, which is an open source tool
available at this link: http://www.sdml.info/projects/srcml/

Greg


[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]


Back to top
PORKOLAB Zoltan
Guest





PostPosted: Sun Oct 23, 2005 10:02 am    Post subject: Re: C++ to XML parser - does one exist? Reply with quote

Hi,

Check Columbus/CAN at http://www.frontendart.com
It is free for academic purposes. There are various
export formats including XML. Columbus is capable to
parse large input files, and as I now it fullfils the
requirements you wrote.

Zoltan

John Nagle <nagle (AT) animats (DOT) com> wrote:
Quote:
I'm looking for a tool to simplify program manipulation.
I need something that parses C++ into a tree format,
INCLUDING the comments and line breaks, and which can
also turn that tree format back into source text.
The parse tree must identify the syntatic elements of C++,
with function calls and type declarations correctly parsed.


[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]


Back to top
Ira Baxter
Guest





PostPosted: Sun Oct 30, 2005 1:21 pm    Post subject: Re: C++ to XML parser - does one exist? Reply with quote


"John Nagle" <nagle (AT) animats (DOT) com> wrote

Quote:
I'm looking for a tool to simplify program manipulation.
I need something that parses C++ into a tree format,
INCLUDING the comments and line breaks, and which can
also turn that tree format back into source text.
The parse tree must identify the syntatic elements of C++,
with function calls and type declarations correctly parsed.

Ideally, the parser would generate the tree as an XML
file, for ease of handling. But that's optional.

The idea is to allow writing simple tools that check
or modify declarations and function calls to add some
safety checks.

Does anything like this exist?

See http://www.semdesigns.com/Products/FrontEnds/CppFrontEnd.html

This is a C++ front end built on top of DMS,
general-purpose program transformation machinery,
and is offered as an industrial strength
commercial product.

It has a full C++ preprocessor and parser (for most commonly
used dialects including ANSI, GNU, and the various MS dialects),
automatically builds trees as it parses, capturing comments
and lexical formats (indentation, number radix, ...)
and builds a full symbol table.
It makes those trees/symbol table available to custom code
you write to accomplish your task, including arbitrary analysis
and or serious automated transformation of the code.
You can regenerate complete source text from the trees,
including preprocessor directives (with some limitations)
the comments and other lexical formats as undisturbed,
or programmatically change that lexical information.

A trivial custom task is to call the XML export
function in the supplied AST management API
to dump out the tree as XML ;-}. While you
can do this, when you discover how big trees
are, you may find this isn't the best option,
especially considering that DMS provides
extremely good facilities for transforming trees.

This tool has been used for massive C++ source-to-source
transformations. See the DoD Crosstalk article on
automate C++ component reengineering at
http://www.semdesigns.com/Company/Publications/CrosstalkArticle/Crosstalk-05-2005.html


--
Ira D. Baxter, Ph.D., CTO 512-250-1018
Semantic Designs, Inc. www.semdesigns.com







[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]


Back to top
Johan
Guest





PostPosted: Tue Nov 01, 2005 3:33 pm    Post subject: Re: C++ to XML parser - does one exist? Reply with quote

"John Nagle" <n... (AT) animats (DOT) com> wrote


Quote:
I'm looking for a tool to simplify program manipulation.
I need something that parses C++ into a tree format,
INCLUDING the comments and line breaks, and which can
also turn that tree format back into source text.
The parse tree must identify the syntatic elements of C++,
with function calls and type declarations correctly parsed.

Ideally, the parser would generate the tree as an XML
file, for ease of handling. But that's optional.

The idea is to allow writing simple tools that check
or modify declarations and function calls to add some
safety checks.

Does anything like this exist?

Check the project Transformers at http://transformers.lrde.epita.fr
(the site will be updated in few days)

They do exactly what you need, and free...

--
Johan


[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]


Back to top
Ira Baxter
Guest





PostPosted: Sat Nov 05, 2005 12:36 pm    Post subject: Re: C++ to XML parser - does one exist? Reply with quote

"Johan" <Johan.Oudinet (AT) gmail (DOT) com> wrote

Quote:
"John Nagle" <n... (AT) animats (DOT) com> wrote in message

news:aj86f.17908$6e1.13627 (AT) newssvr14 (DOT) news.prodigy.com...

I'm looking for a tool to simplify program manipulation.
I need something that parses C++ into a tree format,
INCLUDING the comments and line breaks, and which can
also turn that tree format back into source text.
The parse tree must identify the syntatic elements of C++,
with function calls and type declarations correctly parsed.

Ideally, the parser would generate the tree as an XML
file, for ease of handling. But that's optional.

The idea is to allow writing simple tools that check
or modify declarations and function calls to add some
safety checks.

Does anything like this exist?

Check the project Transformers at http://transformers.lrde.epita.fr
(the site will be updated in few days)

They do exactly what you need, and free...

If what you want to do is get a syntax tree, perhaps.
That isn't really very useful.

If you want to actualy *transform* the application in
any interesting way (e.g., the tasks outlined above),
you need full name and type resolution, because
the transforms will be conditional on the types
of entities they transform.

-- IDB



[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]


Back to top
S7Solutions
Guest





PostPosted: Thu Nov 17, 2005 8:01 am    Post subject: Re: C++ to XML parser - does one exist? Reply with quote

There is a tool which is now made freeware called eXactML which should
do the required work. It was developed by Bristol [www.bristol.com] -
if it's not there please do get in touch and I will help you out.
Infact we @ S7 [www.s7solutions.com] had helped few clients to parse
C++ onto XML

Manju
*** CUSTOMER comes FIRST, come what may ********

Manjunath M
S7 Software Solutions Pvt. Ltd.
#83 Railway Parallel Road, Kumara Park West
Bangalore - 560020, India
Telephone: +91-80-51526777
Fax: +91-80-2334135

2936 173rd CT NE
Redmond, WA 98052, USA
Telephone: (425) 867 1457
Fax: (425) 883 2597
Toll Free: 1-888-224-6174

Yahoo messenger ID: s7softwaresolutions
MSN messenger ID: [email]manjum_s7 (AT) hotmail (DOT) com[/email]
Skype ID: s7softwaresolutions

http://www.s7solutions.com

"Redefining cross-platform porting & migration"

************************************************


[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ Language (Moderated) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.