How to get this to an lalr(1) grammar?

Mark_Tarrabain@mindlink.bc.ca (Mark Tarrabain)
Mon, 22 Aug 1994 00:11:31 GMT

          From comp.compilers

Related articles
How to get this to an lalr(1) grammar? Mark_Tarrabain@mindlink.bc.ca (1994-08-22)
Re: How to get this to an lalr(1) grammar? jholland@world.std.com (1994-08-22)
Re: How to get this to an lalr(1) grammar? pjj@cs.man.ac.uk (1994-08-28)
How to get this to an lalr(1) grammar? mph@zdenka.demon.co.uk (1994-08-28)
Re: How to get this to an lalr(1) grammar? mickunas@mickunas.cs.uiuc.edu (1994-09-10)
Re: How to get this to an lalr(1) grammar? dekker@dutiag.twi.tudelft.nl (1994-09-14)
Re: How to get this to an lalr(1) grammar? mark@omnifest.uwm.edu (Mark Hopkins) (1994-10-09)
| List of all articles for this month |

Newsgroups: comp.compilers
From: Mark_Tarrabain@mindlink.bc.ca (Mark Tarrabain)
Keywords: parse, LALR, question
Organization: MIND LINK! - British Columbia, Canada
Date: Mon, 22 Aug 1994 00:11:31 GMT

    Hi. I've been trying to figure out how to make a certain grammar
lalr(1). Or at least create an equivalent lalr(1) grammar that parses the
same language. I'm not having much luck with it, so I thought I'd see if
anybody else could figure it out. Here's the grammar as it presently
exists (21 rules):


      s -> c
      s -> s t c


      c -> V n p


      a -> A
      a -> C o


      o -> /* empty */
      o -> A


      t -> T
      t -> D
      t -> a u


      u -> /* empty */
      u -> T


      n -> /* empty */
      n -> L b
      n -> q


      q -> N
      q -> q a N


      b -> /* empty */
      b -> B q


      p -> /* empty */
      p -> P N




    Capital letters denote terminals, lower case letters nonterminals. The
language and grammar are very evidently LR(2). If my understanding is
correct, it should be possible to simplify it to LR(1), perhaps even
LALR(1). I'd appreciate whatever help anybody could give.


    Thanks in advance
>> Mark
--


Post a followup to this message

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