4.2 LL(1) Parser Driver

Top-down parsing proceeds by expanding productions, beginning with the start symbol. The grammar must be LL(1)

In order to define LL(1), we need two preliminary definitions: FIRST and FOLLOW. FIRST is defined for a sentential form; FOLLOW is defined for a nonterminal.

That is, FOLLOW(A) is the set of terminals that can appear to the right of A in a sentential form.

A grammar is LL(1) if and only if given any two productions A , A ,

(a) FIRST () FIRST( ) = , and

(b) If one of or derives ,