0

I am a little confused regarding the lookaheads computation for LALR(1) parsers.

In the book "Parsing Techniques - A Practical Guide" they state that propagating lookaheads (+ spontaneous generated lookaheads) is equivalent to calculating the FOLLOW() for variables. So why LALR(1) parser (according to the Dragon book) uses the propagate/spontaneous technique at all, if it could do with FIRST() and FOLLOW(), which are simple and straightforward to compute?

If this is not the case, what is the difference between the two techniques?

ilomambo
  • 8,290
  • 12
  • 57
  • 106

1 Answers1

0

Found a very good explanation at Design and Construction of Compilers
In a nutshell, the lookahead set in LALR(1) is only a subset of FOLLOW(). And it is computed by the propagate technique.

ilomambo
  • 8,290
  • 12
  • 57
  • 106