Question: Rules to find First and Follow sets: We use the following 5 rules for calculating FIRST sets for terminals and non-terminals and epsilon 1. FIRST

 Rules to find First and Follow sets: We use the following5 rules for calculating FIRST sets for terminals and non-terminals and epsilon

Rules to find First and Follow sets: We use the following 5 rules for calculating FIRST sets for terminals and non-terminals and epsilon 1. FIRST (E)=() II. FIRST (a)=( a) for every terminal a III. If AB is a grammar rule, where B is a terminal or non-terminal, then add FIRST (B){E} to FIRST (A) IV. If AA1A2AKB is a grammar rule, where B is a terminal or non-terminal and FIRST(A1) and FIRST(A2).... and FIRST(Ak), then add FIRST (B)(E) to FIRST (A) V. If AA1A2AK is a grammar rule and FIRST(A11) and FIRST(A2). and FIRST(AK), then add E to FIRST (A) We use the following 5 rules for calculating FOLLOW sets for non-terminals 1. add S to FOLLOW(S) (remember S is used to denote end of file) 11. If AB is a grammar rule, and B is a non-terminal, add FOLLOW(A) to FOLLOW(B) III. If ABA1A2 Ak is a grammar rule, and B is a non-terminal, and FIRST(A1) and EFIRST(A2) and EFIRST(Ak), then add FOLLOW (A) to FOLLOW FO) If ABA1A2... Ak is a grammar rule, and B is non-terminal add FIRST (A1){E) to FOLLOW(B) fBA1A2.AiAl+1Ak is a grammar rule, and B is non-terminal and EFIRST(A1) and EFIRST(A2).... and EFIRST(AK), then d FIRST (Ai+1){E} to FOLLOW (B) Generate the First and Follow sets for the grammar below. The empty sting epsilon is denoted with the esymbol. SABCDEAa/Bb/CcDd/Ee/

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!