Re: LALR(1) differences to LR(1)

branco.medeiros@gmail.com
8 Nov 2005 23:35:52 -0500

          From comp.compilers

Related articles
LALR(1) differences to LR(1) aegis@scientist.com (aegis) (2005-11-01)
Re: LALR(1) differences to LR(1) haberg@math.su.se (2005-11-01)
Re: LALR(1) differences to LR(1) branco.medeiros@gmail.com (2005-11-08)
Re: LALR(1) differences to LR(1) parsersinc@earthlink.net (SLK Parsers) (2005-11-12)
| List of all articles for this month |
From: branco.medeiros@gmail.com
Newsgroups: comp.compilers
Date: 8 Nov 2005 23:35:52 -0500
Organization: http://groups.google.com
References: 05-11-001
Keywords: LALR
Posted-Date: 08 Nov 2005 23:35:52 EST

aegis asked:
<snip>
> Also, what is
> considered a follow set in contrast with a lookahead set?
<snip>


From my very limited understanding, the follow set is the set of
tokens that may follow a given production step (that is, an "Item", in
LR terms), while the lookahead set is the set of tokens that is used
by a parser to decide which alternative production to take at a given
point in parsing time.


The lookahead set is built in terms of the follow set of the Item being
evaluated, but may (contrary to follow sets, it seems to me) include
the follow sets of additional items, according to the level of
lookahead specified.


In other words, one token of lookahead would require the parser to
consider just the immediate follow set of the Item being parsed. Two
tokens of lookahead would require the parser to consider also the
follow sets of all the items that contributed to the current follow
set, and so on.


Regards,


Branco.



Post a followup to this message

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