From: | SM Ryan <wyrmwif@tsoft.org> |
Newsgroups: | comp.compilers |
Date: | 24 Jun 2005 14:11:59 -0400 |
Organization: | Quick STOP Groceries |
References: | 05-06-119 |
Keywords: | LR(1), parse, LALR |
Posted-Date: | 24 Jun 2005 14:11:59 EDT |
vtsikoza@yahoo.com (Vit) wrote:
# By the way, yet Aho and Ullman notice that any LR(k>0) language is in
# fact LR(1). (The dumb conversion only produces too many artificial
# production rules).
More accurately, any deterministic language has an LR(1) grammar. But
there is no algorithm to convert any LR(k), k>1, grammar to an LR(1)
grammar. LR(2) grammars show up for things like labels and some ways
of doing declarations when you have "id op" and then choose to reduce
or shift based on what follows op.
LALR grammars are sensitive to null productions where LR(k) skips over
the empty space without a problem. That's significant for yacc where
you can insert semantics before the reduce: put the semantics before
enough left symbols have been shifted to identify the productions and
LALR fails to build the parser.
--
SM Ryan http://www.rawbw.com/~wyrmwif/
Raining down sulphur is like an endurance trial, man. Genocide is the
most exhausting activity one can engage in. Next to soccer.
Return to the
comp.compilers page.
Search the
comp.compilers archives again.