views:

17

answers:

1

What are FIRST and FOLLOW sets?What are they used for in parsing? Are they used for top-down or bottom-up parsers ?

Can anyone explain me FIRST and FOLLOW SETS for the following set of grammar rules:

> E := E+T | T
> 
> T := T*V | T
> 
> V := <id>
A: 

Wikipedia is your friend. See discussion of LL parsers and first/follow sets.

Fundamentally they are used as the basic for parser construction, e.g., as part of parser generators. You can also use them to reason about properties of grammars, but most people don't have much of a need to do this.

Ira Baxter