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

Robert A Duff <bobduff@shell01.TheWorld.com>
Fri, 16 Apr 2010 10:22:14 -0400

          From comp.compilers

Related articles
[9 earlier articles]
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)
Re: language twiddling, was Infinite look ahead required by C++? nevillednz@gmail.com (Neville Dempsey) (2010-03-14)
Re: language twiddling, was Infinite look ahead required by C++? genew@ocis.net (Gene Wirchenko) (2010-04-14)
Re: language twiddling, was Infinite look ahead required by C++? bobduff@shell01.TheWorld.com (Robert A Duff) (2010-04-16)
Re: language twiddling, was Infinite look ahead required by C++? genew@ocis.net (Gene Wirchenko) (2010-04-18)
Re: language twiddling, was Infinite look ahead required by C++? marcov@turtle.stack.nl (Marco van de Voort) (2010-04-19)
| List of all articles for this month |
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Newsgroups: comp.compilers
Date: Fri, 16 Apr 2010 10:22:14 -0400
Organization: The World Public Access UNIX, Brookline, MA
References: 10-02-024 10-02-039 10-02-086 10-02-088 10-03-003 10-03-005 10-03-007 10-03-012 10-04-039
Keywords: parse, design
Posted-Date: 18 Apr 2010 01:02:17 EDT

Gene Wirchenko <genew@ocis.net> writes:


> On Fri, 05 Mar 2010 18:07:17 -0500, Robert A Duff
> <bobduff@shell01.TheWorld.com> wrote:
>
>>glen herrmannsfeldt <gah@ugcs.caltech.edu> writes:
>>
>>> 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.
>>
>>Not really. A programmer doesn't need to memorize all the reserved
>>words. They can just write code, and fix it when the compiler
>>complains "you tried to declare a procedure whose name is a reserved
>>word".
>
> That will depend on the language. Microsoft's Visual FoxPro has
> reserved words. In practice, the tokeniser will not complain, ...


It is usually the parser that will complain about reserved words,
not the tokeniser. The tokeniser doesn't know whether you're
using a reserved word in a context where it's not allowed by
the language.


>...and there is only a problem if the reserved word has special
> meaning in the context.


Wow! I've never used Visual FoxPro, but I found this via google:


http://msdn.microsoft.com/en-us/library/xztfc506(VS.80).aspx


which says:


        "...When programming, avoid using reserved words as names for window,
        table, or field names. If you use a reserved word as a name, it
        might generate a syntax error."


"might"?! That's amazingly poor language design, unless there's some
documentation elsewhere that defines when they really are reserved.
To me, "reserved" ought to mean "you will get a compile time error if
you use these words in certain contexts".


It then goes on to list approximately 2500 "reserved words". So
programmers are expected to memorize thousands of words, and avoid
their use with little help from the compiler. That's just nuts!


- Bob



Post a followup to this message

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