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
Return to the
comp.compilers page.
Search the
comp.compilers archives again.