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