[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

LALR1 question



I don't think I understand what the difference between 0-tokens 
lookahead and 1-token lookahead is.

Take the notorious example:

le broda joi le brode
1  2     3   4

If "1-token lookahead" means that the decision about how to parse
word n can be made on the basis of knowing what word n+1 is, then
how come it won't work in this case? You get to word 3 & think
"selbri linkage or sumti linkage?", so you take a look at word 4,
see it's a sumti and so parse word 3 as sumti linkage.

What actually happens, apparently, is that when you hit word 3 
you're not allowed to see word 4. Can someone explain this to me,
please? That is, explain what lookahead is.

--And.