 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Tom Guest
|
Posted: Sat Jan 17, 2004 1:26 am Post subject: C++ parser... |
|
|
Hi,
A C++ compiler sure manages to parse the C++ language but I wonder if there
is a free and simple to use C++ parser (which does not need to handle the
full grammar or check the syntax of the C++ language) that is able to
extract the major C++ artifacts like classes, functions etc.
Thanks in advance!
/Tom
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Jack Klein Guest
|
Posted: Sat Jan 17, 2004 11:04 am Post subject: Re: C++ parser... |
|
|
On 16 Jan 2004 20:26:39 -0500, "Tom" <someone (AT) microsoft (DOT) com> wrote in
comp.lang.c++.moderated:
| Quote: | Hi,
A C++ compiler sure manages to parse the C++ language but I wonder if there
is a free and simple to use C++ parser (which does not need to handle the
full grammar or check the syntax of the C++ language) that is able to
extract the major C++ artifacts like classes, functions etc.
Thanks in advance!
/Tom
|
That sort of depends on what subset of the full grammar you want, I
suppose.
First there are open source compilers, such as GNU. If what you
really want it automatic generation of documentation, see
http://www.doxygen.org. Even if it does not do exactly what you want,
you might be able to use it for parsing and add your own program for
post processing to get exactly what you want.
--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~ajo/docs/FAQ-acllc.html
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Philipp Janda Guest
|
Posted: Sat Jan 17, 2004 11:04 am Post subject: Re: C++ parser... |
|
|
Tom schrieb:
Hi!
| Quote: |
A C++ compiler sure manages to parse the C++ language but I wonder if there
is a free and simple to use C++ parser (which does not need to handle the
full grammar or check the syntax of the C++ language) that is able to
extract the major C++ artifacts like classes, functions etc.
|
You could try gcc-xml.
http://www.gccxml.org/
| Quote: |
Thanks in advance!
/Tom
|
Philipp
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Thomas Tutone Guest
|
Posted: Sat Jan 17, 2004 11:06 am Post subject: Re: C++ parser... |
|
|
"Tom" <someone (AT) microsoft (DOT) com> wrote:
| Quote: | A C++ compiler sure manages to parse the C++ language but I wonder if
there
is a free and simple to use C++ parser (which does not need to handle the
full grammar or check the syntax of the C++ language) that is able to
extract the major C++ artifacts like classes, functions etc.
|
Not sure that it fits the bill, but you might check out Section 37.11 of the
FAQ:
http://www.parashift.com/c++-faq-lite/compiler-dependencies.html#faq-37.11
Best regards,
Tom
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Ivan Vecerina Guest
|
Posted: Sat Jan 17, 2004 11:08 am Post subject: Re: C++ parser... |
|
|
"Tom" <someone (AT) microsoft (DOT) com> wrote
Hi Tom,
| Quote: | A C++ compiler sure manages to parse the C++ language but I wonder if
there
is a free and simple to use C++ parser (which does not need to handle the
full grammar or check the syntax of the C++ language) that is able to
extract the major C++ artifacts like classes, functions etc.
A problem is that C++ does not have a 'context free' grammar. |
Consider (typical example of the "most vexing parse"):
a b(c);
This can be either a variable definition:
int myVar( EOF_or_any_predefined_constant );
or the (forward) declaration of a function:
int myFunction( int_or_any_predefined_type );
One also has to take care of preprocessor macros...
Other than in free compilers, you will also find code parsers in
tools such as the excellent doxygen ([url]www.doxygen.org)[/url], written
by Dimitri van Heesch (and supported quite well).
You could also let doxygen generate an xml-based description
of the code, which might contain all the information you need.
Commercial parsing solutions also exist...
Regards,
Ivan
--
http://ivan.vecerina.com/contact/?subject=NG_POST <- e-mail contact form
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Thomas Maeder Guest
|
Posted: Sat Jan 17, 2004 11:30 pm Post subject: Re: C++ parser... |
|
|
"Tom" <someone (AT) microsoft (DOT) com> writes:
| Quote: | A C++ compiler sure manages to parse the C++ language but I wonder if there
is a free and simple to use C++ parser (which does not need to handle the
full grammar or check the syntax of the C++ language) that is able to
extract the major C++ artifacts like classes, functions etc.
|
Consider GCC_XML (http://www.gccxml.org/HTML/Index.html)
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Mirek Fidler Guest
|
Posted: Sat Jan 17, 2004 11:31 pm Post subject: Re: C++ parser... |
|
|
| Quote: | A C++ compiler sure manages to parse the C++ language but I wonder if
there
is a free and simple to use C++ parser (which does not need to handle
the
full grammar or check the syntax of the C++ language) that is able to
extract the major C++ artifacts like classes, functions etc.
|
As a part of U++ development system, there is a simplified C++ parser
intended for class browser:
www.ntllib.org/upp
after installation, go to uppsrc: ide project, parser is contained in
docpp package. Far from perfect, OTOH only 1500 lines long...
Mirek
[ 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
|
Posted: Mon Jan 19, 2004 7:35 am Post subject: Re: C++ parser... |
|
|
Jack Klein <jackklein (AT) spamcop (DOT) net> writes:
| Quote: | On 16 Jan 2004 20:26:39 -0500, "Tom" <someone (AT) microsoft (DOT) com> wrote in
comp.lang.c++.moderated:
Hi,
A C++ compiler sure manages to parse the C++ language but I wonder if there
is a free and simple to use C++ parser (which does not need to handle the
full grammar or check the syntax of the C++ language) that is able to
extract the major C++ artifacts like classes, functions etc.
Thanks in advance!
/Tom
That sort of depends on what subset of the full grammar you want, I
suppose.
First there are open source compilers, such as GNU. If what you
really want it automatic generation of documentation, see
http://www.doxygen.org. Even if it does not do exactly what you want,
you might be able to use it for parsing and add your own program for
post processing to get exactly what you want.
|
Also http://synopsis.sf.net, which actually does contain a real
parser.
--
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 |
|
 |
Grzegorz Jakacki Guest
|
Posted: Mon Jan 19, 2004 7:39 am Post subject: Re: C++ parser... |
|
|
"Tom" <someone (AT) microsoft (DOT) com> wrote
| Quote: | Hi,
A C++ compiler sure manages to parse the C++ language but I wonder if there
is a free and simple to use C++ parser (which does not need to handle the
full grammar or check the syntax of the C++ language) that is able to
extract the major C++ artifacts like classes, functions etc.
Thanks in advance!
/Tom
|
See http://opencxx.sourceforge.net
Regards
Grzegorz
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
v Guest
|
Posted: Mon Jan 19, 2004 5:39 pm Post subject: Re: C++ parser... |
|
|
hi,
pccts (Purdue Compiler Construction Tool Set ) used to have one before they
switched
their code base to java. I have played around with it several years ago,
cant remember
anything about it though.
vlado
"Tom" <someone (AT) microsoft (DOT) com> schrieb im Newsbeitrag
news:jsQNb.2773$zm5.1578 (AT) nntpserver (DOT) swip.net...
| Quote: | Hi,
A C++ compiler sure manages to parse the C++ language but I wonder if
there
is a free and simple to use C++ parser (which does not need to handle the
full grammar or check the syntax of the C++ language) that is able to
extract the major C++ artifacts like classes, functions etc.
|
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Philipp Bachmann Guest
|
Posted: Tue Jan 20, 2004 11:08 am Post subject: Re: C++ parser... |
|
|
The "PUMA" library which is the base of "Aspect C++" <http://www.aspectc.org/> has to be capable of
parsing large parts of C++. Maybe this helps you.
Cheers,
Philipp.
"Tom" <someone (AT) microsoft (DOT) com> wrote
| Quote: | Hi,
A C++ compiler sure manages to parse the C++ language but I wonder if there
is a free and simple to use C++ parser (which does not need to handle the
full grammar or check the syntax of the C++ language) that is able to
extract the major C++ artifacts like classes, functions etc.
Thanks in advance!
/Tom
|
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
|
|
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
|
|