Re: look for LR(k) grammar

Tom <txchen@gmail.com>
Thu, 18 Dec 2008 20:27:05 -0800 (PST)

          From comp.compilers

Related articles
look for LR(k) grammar txchen@gmail.com (Tom) (2008-12-15)
Re: look for LR(k) grammar felipeangriman@gmail.com (Felipe Angriman) (2008-12-15)
Re: look for LR(k) grammar pjj@cs.man.ac.uk (Pete Jinks) (2008-12-17)
Re: look for LR(k) grammar txchen@gmail.com (Tom) (2008-12-18)
Re: look for LR(k) grammar cfc@shell01.TheWorld.com (Chris F Clark) (2008-12-20)
Re: look for LR(k) grammar txchen@gmail.com (Tom) (2009-01-15)
| List of all articles for this month |

From: Tom <txchen@gmail.com>
Newsgroups: comp.compilers
Date: Thu, 18 Dec 2008 20:27:05 -0800 (PST)
Organization: Compilers Central
References: 08-12-086 08-12-087
Keywords: parse, LR(1)
Posted-Date: 19 Dec 2008 05:32:43 EST

Yes I think this is a LR(2) grammar.


It is similar to a pattern of LR(k) grammars that I know:


S : a A D a ;
S : b A D b ;
S : a B D b ;
S : b B D a ;


A : a ;
B : a ;
D : c^k ;


Here c^k means the concatenation of k letters 'c'.
This is a LR(k+1) grammar, depending on the value of k.


I'm looking for LR(k) grammars that are a little more complicated in
the following way:


There is an approach to solve the reduce/reduce conflict in a LR(1)
parsing machine by splitting the states involved, for example,
discussed in D. Spector (81,88) or D. Pager (77, lane-tracing). For
both grammars above, there are only 2 states involved: the state a
that contains the conflict, and one of its immediate parent state b
that leads to the conflict in a. I'm hoping to get LR(k) grammars that
contains more levels of states involved, not just 2 levels as
discussed here.


Thanks,
Tom


On Dec 15, 1:49 am, "Felipe Angriman" <felipeangri...@gmail.com>
wrote:
> On Mon, Dec 15, 2008 at 8:17 AM, Tom <txc...@gmail.com> wrote:
> > I'm looking for LR(k) grammars where k > 1.
>
> S : B a b
> S : C a c
> B : 1
> C : 1
>
> I think that will do for k = 2. (I haven't tested it)


Post a followup to this message

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