keywords not reserved, any guidelines ??

James Kanze <>
Fri, 12 Nov 1993 12:05:25 GMT

          From comp.compilers

Related articles
keywords not reserved, any guidelines ?? (Ann Roddy) (1993-11-11)
keywords not reserved, any guidelines ?? (James Kanze) (1993-11-12)
| List of all articles for this month |

Newsgroups: comp.compilers
From: James Kanze <>
Keywords: parse
Organization: Compilers Central
References: 93-11-074
Date: Fri, 12 Nov 1993 12:05:25 GMT

|> I am looking for any guidelines, papers, or books that cover the lexical
|> problems associated with languages such as Fortran, PLEX, and PL/I, ie.
|> languages which do not have keywords as reserved words, thus the lookahead
|> of such parsers is large.

|> I have studied a few methods for specific Fortran parsers, but I would
|> like to know if anything significant has been written on this area ?? Most
|> books I've read seem to gloss over the topic .

I wrote a paper on this about four or five years ago, which appeared in
SIGPLAN Notices. I'm afraid I don't have the references handy at work.

Basically, the idea was to have the scanner return the keyword, and modify
the error handling (in my case, in yacc) to ask for a different token when
it couldn't shift. The parse only went into its error states when it
couldn't get a different token.

Of course, this is worthless for Fortran, but it does handle most of the
cases where the user is allowed to have a user symbol with the same
spelling as a keyword. I've used the technique extensively where the
language has had to cope with externally defined names (such as file
names, or symbols in a program being debugged).
James Kanze email:
GABI Software, Sarl., 8 rue du Faisan, F-67000 Strasbourg, France

Post a followup to this message

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