Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 8

First And Follow Set

Compiler Construction
What is First And Follow Set in Complier
construction
In compiler construction, specifically in the context of parsing, First and Follow
sets are used to analyze the structure of a formal grammar. These sets help in the
construction of predictive parsers and are essential for implementing top-down
parsing techniques.
FIRST SET:
• The First set of a non-terminal in a grammar represents the set of terminals
that can be the first symbol of a string derived from that non-terminal.
• The process of computing the First sets involves examining the production
rules of the grammar and considering the possible combinations of terminals
and non-terminals.
To be Contd…..
FOLLOW SET:
• It is used to guide the parser when to expand a non-terminal during parsing.

• The process of computing the Follow sets involves examining the production
rules and considering the possible strings that can follow a non-terminal.
Rules For First And Follow Set:
EXAMPLE#01:
EXAMPLE#02
References:
• https://youtu.be/L9iAmoEcGIE?si=RINxCanOCErj7TPf

• https://youtu.be/DqdK8SKpajM?si=OM1YPk5nRDCP49ZG
THANK YOU

You might also like