












































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!













































2
If A → α and A → β both
FIRST( α) ∩ FIRST( β) = ∅
4
FIRST( α) ∩ FIRST( β) = ∅
5
What about ε-productions?
⇒They complicate the
definition of LL(1)
7
If A → α and A → β and
ε ∈ FIRST( α) , then we need
to ensure that FIRST( β) is
disjoint from FOLLOW( α),
8
FOLLOW( α)
is the set of all words in the grammar that can legally appear after an α.
10
FIRST and FOLLOW
X
11
Define FIRST +( α) as
FIRST( α) ∪ FOLLOW( α), if
ε ∈ FIRST( α)
FIRST( α), otherwise
13
14
16
A → β 1 | β 2 | β 3 ,
FIRST+( α)∩FIRST +( β) = ∅
17
/* find an A */
if(token ∈ FIRST( β 1 )) find a β 1 and return true
else if(token ∈ FIRST( β 2 )) find a β 2 and return true
if(token ∈ FIRST( β 3 )) find a β 3 and return true
else error and return false
19
/* find an A */
if(token ∈ FIRST( β 1 )) find a β 1 and return true
else if(token ∈ FIRST( β 2 )) find a β 2 and return true
if(token ∈ FIRST( β 3 )) find a β 3 and return true
else error and return false
20
/* find an A */
if(token ∈ FIRST( β 1 )) find a β 1 and return true
else if(token ∈ FIRST( β 2 )) find a β 2 and return true
if(token ∈ FIRST( β 3 )) find a β 3 and return true
else error and return false