Re: LL(1) parser table

Sean Case <gsc@zip.com.au>
7 Jan 2002 01:14:25 -0500

          From comp.compilers

Related articles
LL(1) parser table hyperarien@yahoo.com (2002-01-05)
Re: LL(1) parser table gsc@zip.com.au (Sean Case) (2002-01-07)
Re: LL(1) parser table dr_feriozi@prodigy.net (SLK Parsing) (2002-01-13)
Re: LL(1) parser table kaarthik@cisco.com (Kaarthik) (2002-01-13)
Re: LL(1) parser table kaarthik@cisco.com (Kaarthik) (2002-01-13)
Re: LL(1) parser table hyperarien@yahoo.com (2002-01-14)
| List of all articles for this month |

From: Sean Case <gsc@zip.com.au>
Newsgroups: comp.compilers
Date: 7 Jan 2002 01:14:25 -0500
Organization: Marginal
References: 02-01-026
Keywords: LL(1), parse
Posted-Date: 07 Jan 2002 01:14:25 EST

>, hyperarien@yahoo.com (lee) wrote:


> I am trying construct a LL1 parser table for the following grammar.


I have some questions about your grammar.


> S -> E
> E -> ++E | E++ | E-E | E/E | id


> where symbols have usual meanings.


1. Why no support for parentheses? (Try adding them - I think that
      it might make things clearer.)


> However in the final table this grammar seems to be ambiguous. I
> actually first transformed the above into this disambiguous form.


> S -> E
> E -> E-T | T
> T -> T/F | F
> F -> F++ | G
> G -> ++E | id


2. What is it about G that gives rise to a different kind of rule
      from those for T and F?


3. Suppose that you reversed the priority of prefix- and postfix-++
      (which I think you might have backwards anyway, but I'm not in a
      C frame of mind right now) -- what would be different about your
      transformed grammar?


Sean Case


--
Sean Case gsc@zip.com.au


Code is an illusion. Only assertions are real.


Post a followup to this message

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