LR(0) and Lookaheads

"Will" <>
4 Nov 2001 23:54:14 -0500

          From comp.compilers

Related articles
LR(0) and Lookaheads (Will) (2001-11-04)
Re: LR(0) and Lookaheads (Thant Tessman) (2001-11-08)
Re: LR(0) and Lookaheads (J.H.Jongejan) (2001-11-08)
| List of all articles for this month |

From: "Will" <>
Newsgroups: comp.compilers
Date: 4 Nov 2001 23:54:14 -0500
Organization: Excite@Home - The Leader in Broadband
Keywords: parse, LR(1)
Posted-Date: 04 Nov 2001 23:54:14 EST

The new dragon book gives an algorithm for constructing parsing tables
for LR(1) grammars. The '1' is suppose to be 1 lookahead. If you can
construct such an LR(1) parsing table without conflicts for a given
grammar, then the grammar is LR(1) grammar.

Is lookahead and the current input symbol the same thing?

I had thought that LR(0) was just another way of saying SLR(1) because
in constructing SLR(1) grammars, LR(0) items are used. However I am
wrong. As a matter of fact, LR(0) grammars are "smaller" than SLR(1)
grammars. So how do I test a grammar to see if it is LR(0) grammar
(i.e. where in the new dragon is this explained ... how do you
construct a LR(0) parsing table)? Also the '0' in LR(0) grammars means
0 lookahead? That does not make sense, unless I am not understanding
what lookahead means. If you don't look at any input symbols, how are
you suppose to parse the input string?

Thanks in advance.

Post a followup to this message

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