|LL vs LR, no jihad initiation, but... email@example.com (1992-05-11)|
|Operator precedence and Recursive Descent firstname.lastname@example.org (1992-05-22)|
|Re: Operator precedence and Recursive Descent email@example.com (1992-05-23)|
|Re: Operator precedence and Recursive Descent firstname.lastname@example.org (1992-05-26)|
|From:||email@example.com (Richard Man)|
|Organization:||Digital Equipment Corporation|
|Date:||Tue, 26 May 1992 15:43:16 GMT|
firstname.lastname@example.org (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 (email@example.com)
Return to the
Search the comp.compilers archives again.