Related articles |
---|
LL vs LR, no jihad initiation, but... parrt@ecn.purdue.edu (1992-05-11) |
Operator precedence and Recursive Descent stt@inmet.com (1992-05-22) |
Re: Operator precedence and Recursive Descent graham@maths.su.oz.au (1992-05-23) |
Re: Operator precedence and Recursive Descent man@labrea.zko.dec.com (1992-05-26) |
Newsgroups: | comp.compilers |
From: | man@labrea.zko.dec.com (Richard Man) |
Keywords: | LL(1), parse |
Organization: | Digital Equipment Corporation |
References: | 92-05-059 92-05-130 |
Date: | Tue, 26 May 1992 15:43:16 GMT |
graham@maths.su.oz.au (Graham Matthews) writes:
> I once wrote a one routine expression parser. ... I had a table of
> operator precedences. The routine built a parse tree by re-ordering the
> parse tree if the just seen operator was of higher precedence than (I
> think) the root of the existing parse tree.
The Whitesmiths C compilers use something very similar. The original
routine was originally coded in Asm (I think) back in the 70's. Sort of as
"how compact I can write this routine" kind of contest. The C version of
the tree rewriting routine is only about 6 lines or so, a conditional
recursive call embedded in a for loop. Many times I have wished for
comments though ;-).
--
- Richard F. Man (man@labrea.zko.dec.com)
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.