Re: Generating a simple hand-coded like recursive descent parser

Karsten Nyblad <148f3wg02@sneakemail.com>
19 Dec 2006 01:05:31 -0500

          From comp.compilers

Related articles
[28 earlier articles]
Re: Generating a simple hand-coded like recursive descent parser DrDiettrich1@aol.com (Hans-Peter Diettrich) (2006-12-16)
Re: Generating a simple hand-coded like recursive descent parser bobduff@shell01.TheWorld.com (Robert A Duff) (2006-12-17)
Re: Generating a simple hand-coded like recursive descent parser tommy.thorn@gmail.com (Tommy Thorn) (2006-12-19)
Re: Generating a simple hand-coded like recursive descent parser gneuner2@comcast.net (George Neuner) (2006-12-19)
Re: Generating a simple hand-coded like recursive descent parser chris.dollin@hp.com (Chris Dollin) (2006-12-19)
Re: Generating a simple hand-coded like recursive descent parser ajo@andrew.cmu.edu (Arthur J. O'Dwyer) (2006-12-19)
Re: Generating a simple hand-coded like recursive descent parser 148f3wg02@sneakemail.com (Karsten Nyblad) (2006-12-19)
Re: Generating a simple hand-coded like recursive descent parser ik@unicals.com (Ivan A. Kosarev) (2006-12-19)
Re: Generating a simple hand-coded like recursive descent parser boldyrev@cgitftp.uiggm.nsc.ru (Ivan Boldyrev) (2006-12-19)
Re: Generating a simple hand-coded like recursive descent parser DrDiettrich1@aol.com (Hans-Peter Diettrich) (2006-12-19)
Re: Generating a simple hand-coded like recursive descent parser walter@bytecraft.com (Walter Banks) (2006-12-19)
Re: Generating a simple hand-coded like recursive descent parser cfc@shell01.TheWorld.com (Chris F Clark) (2006-12-19)
Re: Generating a simple hand-coded like recursive descent parser bobduff@shell01.TheWorld.com (Robert A Duff) (2006-12-22)
[3 later articles]
| List of all articles for this month |
From: Karsten Nyblad <148f3wg02@sneakemail.com>
Newsgroups: comp.compilers
Date: 19 Dec 2006 01:05:31 -0500
Organization: Compilers Central
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
Keywords: C, parse
Posted-Date: 19 Dec 2006 01:05:30 EST

Robert A Duff asks if anybody has tried parsing C or C++ without using
a context sensitive grammar, and mentions that in Ada the grammar for
array indexing and function calls are similar.


In C you can write an expression (a)-b*c. If a is a type then(a)-b*c is
equivalent to ((a)-b)*c, but if a is a variable then (a)-b*c is
equivalent to (a)-(b*c). To put it an other way: In Ada you will want
a parse tree of the same structure independently of whether a subtree is
an array indexing or a function call. It is simply a question of
putting the right labels on the nodes. In C and C++ it is not enough to
put some other labels on some nodes. You will want to reorder the tree,
and that reordering will be so complex, that it is easier to use a
context sensitive grammar.


Karsten Nyblad
148f3wg02 at sneakemail dot com



Post a followup to this message

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