Re: parsing C and C++, Generating a simple hand-coded like

"Derek M. Jones" <derek@_NOSPAM_knosof.co.uk>
22 Dec 2006 11:07:57 -0500

          From comp.compilers

Related articles
[8 earlier articles]
Re: Generating a simple hand-coded like recursive descent parser cfc@shell01.TheWorld.com (Chris F Clark) (2006-12-19)
Re: parsing C and C++, Generating a simple hand-coded like gneuner2/@comcast.net (George Neuner) (2006-12-21)
Re: parsing C and C++, Generating a simple hand-coded like cfc@shell01.TheWorld.com (Chris F Clark) (2006-12-22)
Re: parsing C and C++, Generating a simple hand-coded like DrDiettrich1@aol.com (Hans-Peter Diettrich) (2006-12-22)
Re: parsing C and C++, Generating a simple hand-coded like derek@knosof.co.uk (Derek M. Jones) (2006-12-22)
Re: parsing C and C++, Generating a simple hand-coded like ik@unicals.com (Ivan A. Kosarev) (2006-12-22)
Re: parsing C and C++, Generating a simple hand-coded like derek@_NOSPAM_knosof.co.uk (Derek M. Jones) (2006-12-22)
Re: parsing C and C++, Generating a simple hand-coded like cfc@shell01.TheWorld.com (Chris F Clark) (2006-12-23)
Re: parsing C and C++, Generating a simple hand-coded like derek@knosof.co.uk (Derek M. Jones) (2006-12-24)
Re: parsing C and C++, Generating a simple hand-coded like cfc@shell01.TheWorld.com (Chris F Clark) (2006-12-24)
| List of all articles for this month |

From: "Derek M. Jones" <derek@_NOSPAM_knosof.co.uk>
Newsgroups: comp.compilers
Date: 22 Dec 2006 11:07:57 -0500
Organization: ntl Cablemodem News Service
References: 06-09-029 06-09-042 06-09-048 06-09-060 06-09-078 06-09-093 06-12-064 06-12-066 06-12-076 06-12-078 06-12-086 06-12-087
Keywords: C, parse, analysis
Posted-Date: 22 Dec 2006 11:07:57 EST

Ivan,


>> I know of at least one other tool vendor who fully parses C/C++ source
>> using syntax information only, before building a symbol table.
>
> Again, are there any practical benefits with this approach?


I cannot speak for why others have taken this approach, but
possibilities include:


        o gets a parser up and running quickly. This makes it possible
to see what kind of characteristics the source has and tune
subsequent processing appropriately (ie, in this situation people
are not interested in handling 100% of source 100% correctly).


        In my case I am interested in measuring source code usage and
so don't need a full semantic analysis of every construct.


        o improved error recovery. Syntax errors are often difficult
to recover from, ie there tend to be lots of cascading errors.
Semantic errors tend to be localized and easier to attach meaningful
messages to.


        In my case I often have to analyze source where I might not have any
information on where the headers that need to be included are located
(ie, include path information), or in some cases I might not even have
the headers :-(


        o it is possible to analyze fragments of code, eg single statements
or declarations (perhaps typed on the command line).


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.