Re: KEYWORDS AND WHILE



On Wed, 07 Jun 2006 03:58:31 -0700, robin <robin_v@xxxxxxxxxxx> wrote:

"Tom Linden" <tom@xxxxxxxxxx> wrote in message
news:op.tam7g4y0zgicya@xxxxxxxxxxxx
On Sun, 04 Jun 2006 14:47:40 -0700, robin <robin_v@xxxxxxxxxxx> wrote:

"Tom LINDEN" <tom@xxxxxxxxxx> wrote in message
news:op.tajj53qrlvpiaf@xxxxxxxxxxxx
On Fri, 02 Jun 2006 15:42:13 -0700, James J. Weinkam <jjw@xxxxxxxxx> wrote:

|> Peter Flass wrote:
|>> James J. Weinkam wrote:

|>>> Having reserved words stands in the way of language evolution. The
|>>> "price" one pays for not having reserved words is essentially
|>>> syntactic. In the case of PL/I, the required use of apparently
|>>> redundant parentheses and the fact that procedures are "nouns" rather
|>>> than "verbs" are perhaps the most obvious syntactic idiosyncracies
|>> This last sounds like an interesting point, but I don't understand
|>> what you're saying. Care to expound?

|> I don't recall the reference anymore, but many years ago I saw an
|> article that showed that language design features such as requiring
|> things like the expression after WHILE to be in parentheses, using CALL
|> procname(...) instead of just procname(...), and so on reduced the
|> number of conflicts in the grammar and also simplified the lexical
|> analysis of languages where language keywords were not reserved.

|> In fact, for instance, without that rule,

|> do while(a)=b; ... end; is ambiguous -- you can't tell whether while(a)
|> is the index variable of while is a keyword and (a)=b is an expression,
|> so at least that particular instance seems to be necessary.

|Maybe another exmple with valid syntax might better illustrate what you
|were driving at.

He illustrated (hypothesised) the case where parentheses were not required.
In this case, it is ambiguous. You can't tell whether WHILE is a keyword
or a variable (assuming that you have an array called WHILE).

Well, if it were a keyword then it is syntactically malformed, at least by
ANSI rules.

But it's impossible to tell whether it's being used as a keyword
or as an array.


I am not certain that this example is worthy of further analysis, but if
it is intended as a keyword, then it is a syntax error, if not then the
array is undefined. Either way it is "bad"code and the compiler will issue
a diagnostic as I have previously posted.
.



Relevant Pages

  • Re: KEYWORDS AND WHILE
    ... Care to expound? ... |> analysis of languages where language keywords were not reserved. ... You can't tell whether WHILE is a keyword ... or a variable (assuming that you have an array called WHILE). ...
    (comp.lang.pl1)
  • Re: program that compiles in C but not in C++?
    ... > This requires no diagnostic in either language. ... According to Stroustrup, the name used for the above array... ... is a keyword in C++. ...
    (alt.comp.lang.learn.c-cpp)
  • Re: Unsigned Indexing (was: some other sad story)
    ... [snipped lengthy discussion about whether the presence of an "unsafe" ... >> verifiably type safe from running. ... >> track of which programming language was used to write each piece ... > features including the unsafe keyword. ...
    (comp.programming)
  • Re: Lisp for the C21
    ... This has nothing to do with keyword arguments as such. ... Because it is a standardized way of doing and thus has language support (which ... It would not be difficult to add keyword arguments to an object system ... implemented in Scheme via macros. ...
    (comp.lang.functional)
  • Re: Working on new language
    ... I'll make sure to put some warts in the language:) ... syntax to me is misguided. ... So apart from the "so" keyword mentioned below I require ... It would be possible to separate arguments with commas, but the opens ...
    (comp.lang.misc)