|How to parse keywords that can be used as identifiers? firstname.lastname@example.org (Mark Thiehatten) (1996-08-19)|
|Re: How to parse keywords that may be used as identifiers email@example.com (Scott Stanchfield) (1996-08-19)|
|Re: How to parse keywords that may be used as identifiers firstname.lastname@example.org (1996-08-21)|
|Date:||21 Aug 1996 17:32:37 -0400|
|Organization:||.netkonect (customer account)|
|References:||<32184418.167E@research.techforce.nl> 96-08-058 96-08-061|
Scott Stanchfield <email@example.com> wrote:
>[How can I parse languages where keywords aren't reserved words?]
If you are going to use a parser generator then I don't know. I've
written a parser for PL/I that supports the no reserved words feature.
The parser is a hand-written recursive descent jobby.
The algorithm is in fact straightforward here it goes:
before you attempt to recognise the statement call
a func like this:
if (this_is_an_assigment() ) then
If it's NOT an assigment then the first token MUST be treated as a
keyword and we can parse that stmt.
If it IS an assignment then the first token MUST be an identifier
and the RHS MUST be an expression.
How do we tell if its an assignment ?
<assignment> ::= <reference> EQUALS <expression>
parsing a reference is a seperate thing altogether (it actually
That basically that.
Return to the
Search the comp.compilers archives again.