Re: Recursive descent and left recursion

fjh@murlibobo.cs.mu.OZ.AU (Fergus Henderson)
16 Jan 1997 20:09:01 -0500

          From comp.compilers

Related articles
Recursive descent and left recursion mfinney@lynchburg.net (1997-01-14)
Re: Recursive descent and left recursion fjh@mundook.cs.mu.OZ.AU (1997-01-15)
Re: Recursive descent and left recursion hogan@rintintin.Colorado.EDU (1997-01-15)
Re: Recursive descent and left recursion dlmoore@ix.netcom.com (David L Moore) (1997-01-16)
Re: Recursive descent and left recursion cfc@world.std.com (1997-01-16)
Re: Recursive descent and left recursion fjh@murlibobo.cs.mu.OZ.AU (1997-01-16)
Re: Recursive descent and left recursion cfc@world.std.com (1997-01-17)
Re: Recursive descent and left recursion will@ccs.neu.edu (William D Clinger) (1997-01-17)
Re: Recursive descent and left recursion cfc@world.std.com (Chris F Clark) (1997-01-21)
Re: Recursive descent and left recursion schoebel@eicheinformatik.uni-stuttgart.de (1997-01-25)
| List of all articles for this month |

From: fjh@murlibobo.cs.mu.OZ.AU (Fergus Henderson)
Newsgroups: comp.compilers
Date: 16 Jan 1997 20:09:01 -0500
Organization: Comp Sci, University of Melbourne
References: 97-01-099 97-01-126
Keywords: parse, LL(1), LR(1)

mfinney@lynchburg.net wrote:
>> I have noticed the occassional post here, as well as assertions in
>> various texts, that left recursion is not usable with recursive
>> descent (and LR parsers in general).
                                  ^^
cfc@world.std.com (Chris F Clark) writes:
>I thought certainly someone else would catch this mis-impression, but
>since no one has mentioned it. LR parsers allow left-recursion as
>well as right recursion and any other recursion. It is LL parsers
>which don't like left recursion. In fact, that is the main reason for
>using LR (or LALR) parsing over LL.


All true... but now you go on to add a mis-impression of your own,
because you confuse LR parsing with operator precedence parsing:


>You can write your expression
>grammars "naturally" with out inventing extra non-terminals to handle
>precedence levels.


Yes, but only if your LR parsing tool/technique allows operator
precedence grammars -- and you can do that with LL parsing too, if you
have an LL parsing tool/technique that supports operator precedence
grammars. Certainly it's not that hard to write an operator
precedence recursive descent parser.


Perhaps you meant "... without having to left-factor your grammar"?


--
Fergus Henderson <fjh@cs.mu.oz.au>
WWW: <http://www.cs.mu.oz.au/~fjh>
PGP: finger fjh@128.250.37.3
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.