Re: How to parse keywords that can be used as identifiers?

ph@anweald.exnet.co.uk (Patrick Herring)
24 Aug 1996 21:30:54 -0400

          From comp.compilers

Related articles
How to parse keywords that can be used as identifiers? mark@research.techforce.nl (Mark Thiehatten) (1996-08-19)
Re: How to parse keywords that can be used as identifiers? anton@a0.complang.tuwien.ac.at (1996-08-20)
Re: How to parse keywords that can be used as identifiers? kanze@lts.sel.alcatel.de (1996-08-20)
Re: How to parse keywords that can be used as identifiers? leichter@smarts.com (Jerry Leichter) (1996-08-21)
Re: How to parse keywords that can be used as identifiers? ph@anweald.exnet.co.uk (1996-08-24)
Re: How to parse keywords that can be used as identifiers? grosch@cocolab.sub.com (1996-08-24)
Re: How to parse keywords that can be used as identifiers? dlmoore@ix.netcom.com (David L Moore) (1996-08-24)
Re: How to parse keywords that can be used as identifiers? itz@rahul.net (1996-08-24)
Re: How to parse keywords that can be used as identifiers? peter@bj-ig.de (Peter Brueckner) (1996-08-27)
Re: How to parse keywords that can be used as identifiers? stefan.monnier@lia.di.epfl.ch (Stefan Monnier) (1996-08-27)
Re: How to parse keywords that can be used as identifiers? fjh@mundook.cs.mu.OZ.AU (1996-08-27)
[3 later articles]
| List of all articles for this month |

From: ph@anweald.exnet.co.uk (Patrick Herring)
Newsgroups: comp.compilers
Date: 24 Aug 1996 21:30:54 -0400
Organization: Anweald Systems
References: 96-08-058
Keywords: parse

Mark writes:
> I am working on a parser for a language that allows keywords to
> be used as identifiers. This causes all kinds of problems.
> I would like to know if somebody has already solved this problem,
> and, of course, how.
>
> Ps.
>
> I am using flex and bison to build the parser.


The Rexx language has this. It really is just a question of returning symbol
tokens and deciding in the parser (or extending the lexer with context). It
helps to know when a clause starts so as to force a keyword recognition ie to
force the rest of the line to be in error. Some sub-keywords are reserved in
context eg 'while' in 'do while' etc. There's a Rexx implementation at
ftp://flipper.pvv.unit.no/pub/rexx, called Regina, that uses Lex & Yacc. The
Rexx language home page is www.rexx.hursley.ibm.com, I think, off which is a
tutorial page(s).


Yours, Patrick
_____________________________________________________________________________


Patrick Herring, Primrose Hill, London, UK
I tend to eat my UUCP feed once a day, so replies can take two days
--


Post a followup to this message

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