Path: utzoo!utgpu!water!watmath!clyde!bellcore!tness7!killer!pollux!dalsqnt!rpp386!jfh
From: jfh@rpp386.UUCP (John F. Haugh II)
Newsgroups: comp.lang.c
Subject: Re: Unnecessary parenthesis
Message-ID: <3863@rpp386.UUCP>
Date: 12 Jul 88 05:17:05 GMT
References: <326@marob.MASA.COM> <175@lakart.UUCP> <1988Jul10.201845.27751@utzoo.uucp>
Reply-To: jfh@rpp386.UUCP (The Beach Bum)
Organization: Big "D" Home for Wayward Hackers
Lines: 31

In article <1988Jul10.201845.27751@utzoo.uucp> henry@utzoo.uucp (Henry Spencer) writes:
>> ... this is a weakness of RD parsers: the amount of
>> work incurred by unnecessary parentheses is quite considerable, especially
>> in a language such as C, with 15 levels of operator precedence....
>
>Well, yes, *if* you implement the RD parser straight from the grammar and
>do no optimization.  One can do better, at the price of greater complexity,
>by explicitly looking for the simple cases.

one of the major strengths of r-d parsers is you can code the parser
straight from the grammar.  performing the transformations from left to
right recursion should be fairly automatic and is the only really
worthwhile (ease of coding, speed and complexity tradeoffs being
considered) optimization i can see.

the geneal case of trying to reduce the recursion present in the parser
would seem to require a potentially arbitrary amount of look ahead, or
as a minimum, the same amount of lookahead as the length of the shortest
sentence the parser is trying to recognize.  clarifications, henry?

>Anyone who buys Wisconsin cheese is  |  Henry Spencer @ U of Toronto Zoology
>a traitor to mankind.  --Pournelle   | {ihnp4,decvax,uunet!mnetor}!utzoo!henry

and what the hell does this mean???

- john.
-- 
John F. Haugh II                 +--------- Cute Chocolate Quote ---------
HASA, "S" Division               | "USENET should not be confused with
UUCP:   killer!rpp386!jfh        |  something that matters, like CHOCOLATE"
DOMAIN: jfh@rpp386.uucp          |             -- with my apologizes