Re: problems with identifiers and keywords...

glen herrmannsfeldt <gah@ugcs.caltech.edu>
6 Nov 2004 15:04:07 -0500

          From comp.compilers

Related articles
problems with identifiers and keywords... micha-1@fantasymail.de (Micha) (2004-10-21)
Re: problems with identifiers and keywords... cfc@shell01.TheWorld.com (Chris F Clark) (2004-10-23)
Re: problems with identifiers and keywords... gah@ugcs.caltech.edu (glen herrmannsfeldt) (2004-10-24)
Re: problems with identifiers and keywords... clint@0lsen.net (Clint Olsen) (2004-10-25)
Re: problems with identifiers and keywords... cfc@shell01.TheWorld.com (Chris F Clark) (2004-11-02)
Re: problems with identifiers and keywords... gah@ugcs.caltech.edu (glen herrmannsfeldt) (2004-11-06)
Re: problems with identifiers and keywords... wclodius@lanl.gov (2004-11-06)
Re: problems with identifiers and keywords... wyrmwif@tsoft.org (SM Ryan) (2004-11-07)
Re: problems with identifiers and keywords... vbdis@aol.com (2004-11-07)
Re: problems with identifiers and keywords... cfc@shell01.TheWorld.com (Chris F Clark) (2004-11-14)
Re: problems with identifiers and keywords... genew@mail.ocis.net (Gene Wirchenko) (2004-11-14)
Re: problems with identifiers and keywords... gah@ugcs.caltech.edu (glen herrmannsfeldt) (2004-11-17)
[16 later articles]
| List of all articles for this month |
From: glen herrmannsfeldt <gah@ugcs.caltech.edu>
Newsgroups: comp.compilers
Date: 6 Nov 2004 15:04:07 -0500
Organization: Comcast Online
References: 04-10-148 04-10-170 04-10-174 04-11-008
Keywords: lex, design
Posted-Date: 06 Nov 2004 15:04:07 EST

Chris F Clark wrote:


(snip)


> PL/I's keywords are probably not parseable by any reasonable
> grammatic method, which is why I started with *may not* be. Sadly,
> it is not just "old" languages like Fortran and PL/I that have the
> problem.


(snip)


> The point is that for language design, if you want to allow keywrods
> as identifiers (and there are good reasons for that), then make
> certain that your keywords can only appear (as keywords) in
> unambiguous contexts.


(snip)


Well, I hope I didn't snip too much.


A question one could ask is: should a language be designed to be easy
for compilers or easy for people. Unless I am writing the compiler, I
would say it should be easy for people.


I am not quite sure about Fortran, but it seems no reserved words was
intentional in PL/I. PL/I has a lot of keywords, and adopted some
features from COBOL, a language known to have a very large list of
reserved words, many of which could be convenient to use as
identifiers. One goal of PL/I was that you shouldn't have to learn
the whole language to use it, and so you also shouldn't have to learn
the keywords for parts you don't use.


I would presume that any language would make it unambiguous, but it
may not be all that far from ambiguous.


Another problem is that many compilers aren't good at giving a
meaningful diagnostic when a keyword is used as an identifier.


-- glen


Post a followup to this message

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