Re: language twiddling, was Infinite look ahead required by C++?

glen herrmannsfeldt <gah@ugcs.caltech.edu>
Wed, 3 Mar 2010 07:41:20 +0000 (UTC)

          From comp.compilers

Related articles
Infinite look ahead required by C++? ng2010@att.invalid (ng2010) (2010-02-05)
Re: Infinite look ahead required by C++? sh006d3592@blueyonder.co.uk (Stephen Horne) (2010-02-09)
Re: Infinite look ahead required by C++? ng2010@att.net (ng2010) (2010-02-23)
Re: Infinite look ahead required by C++? cfc@shell01.TheWorld.com (Chris F Clark) (2010-02-27)
Re: Infinite look ahead required by C++? bartc@freeuk.com (bartc) (2010-02-28)
Re: language twiddling, was Infinite look ahead required by C++? cfc@shell01.TheWorld.com (Chris F Clark) (2010-03-01)
Re: language twiddling, was Infinite look ahead required by C++? gah@ugcs.caltech.edu (glen herrmannsfeldt) (2010-03-03)
Re: language twiddling, was Infinite look ahead required by C++? bobduff@shell01.TheWorld.com (Robert A Duff) (2010-03-05)
Re: language twiddling, was Infinite look ahead required by C++? bobduff@shell01.TheWorld.com (Robert A Duff) (2010-03-05)
Re: language twiddling, was Infinite look ahead required by C++? cfc@shell01.TheWorld.com (Chris F Clark) (2010-03-07)
Re: language twiddling, was Infinite look ahead required by C++? bartc@freeuk.com (bartc) (2010-03-08)
Re: language twiddling, was Infinite look ahead required by C++? cfc@shell01.TheWorld.com (Chris F Clark) (2010-03-10)
Re: language twiddling, was Infinite look ahead required by C++? bobduff@shell01.TheWorld.com (Robert A Duff) (2010-03-12)
[5 later articles]
| List of all articles for this month |

From: glen herrmannsfeldt <gah@ugcs.caltech.edu>
Newsgroups: comp.compilers
Date: Wed, 3 Mar 2010 07:41:20 +0000 (UTC)
Organization: California Institute of Technology, Pasadena
References: 10-02-024 10-02-039 10-02-086 10-02-088 10-03-003 10-03-005
Keywords: design, C
Posted-Date: 05 Mar 2010 10:55:26 EST

Chris F Clark <cfc@shell01.theworld.com> wrote:
(snip)


> The basic idea of reserved word (i.e. a keyword you can't use for
> anything else) specifying a declaration followed by a list of
> identifiers being declared is a sound one and is used in the
> languages leading upto C.


Which languages were leading up to C?


Two languages which had some of the features that went into C,
and that were reasonably used at the time, were Fortran and PL/I.
[C was mostly based on BCPL. See http://cm.bell-labs.com/cm/cs/who/dmr/chist.html
-John]


While many PL/I features were modified considerably before
being used in C, a few, such as the form of comments, stayed
pretty much the same.


Both Fortran and PL/I have no reserved words. I am not so sure
about Fortran, but it seems to have been intentional for PL/I.
A large list of reserved words (reference COBOL) means that
programmers have to know those words, even if they don't need
those features. C has a relatively small list if you don't
include names reserved for the library, but they are still there.


Also, the use of reserved words complicates adding new features
to the language later. Adding new reserved words can make old
valid programs invalid.


(snip)


> The reason I recommended the person consider Pascal is that it has
> all those problems solved and solved simply. C is not a
> particularly easy language to parse. If you go trying to extend C,
> it is very easy to make the language completely unparseable. A few
> tiny bandaids on C don't resolve those issues.


As far as I know, a lot of work went into each extension of Fortran to
make sure that no ambiguities crept in, and, except for a few specific
exceptions, older programs would still be valid.


In most cases, reserved words are reserved to make it easier for the
compiler, not for the programmer.


I have seen C compilers that refused a variable named new. (That is,
C/C++ compilers in C mode.)


-- glen



Post a followup to this message

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