Re: Recursive descent and left recursion

William D Clinger <will@ccs.neu.edu>
17 Jan 1997 23:27:03 -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: William D Clinger <will@ccs.neu.edu>
Newsgroups: comp.compilers
Date: 17 Jan 1997 23:27:03 -0500
Organization: Northeastern University
References: 97-01-099 97-01-126
Keywords: parse, LR(1)

cfc@world.std.com (Chris F Clark) wrote that LR parsing allows
you to
> ...write your expression
> grammars "naturally" with out inventing extra non-terminals to handle
> precedence levels. That is:
>
> expression : expression "+" expression
> | expression "*" expression


This grammar is not LR because it is ambiguous (assuming the
'expression' nonterminal is not altogether useless).


Some LR parser generators let you resolve the ambiguity by non-LR
means, but I don't see how that counts as an advantage of LR parsing.
As for cost, the non-LR techniques for specifying precedence aren't
free either.


Yes, it is true that LR parsers can handle left recursion or right
recursion.


No, it is not true that LR parsers save you from inventing extra
non-terminals to express levels of precedence.


Will
--


Post a followup to this message

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