Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Generate the First and Follow sets for the grammar below. The empty sting epsilon is denoted with the e symbol. SABCDEAaBbCcDdEe Rules to find First

image text in transcribedimage text in transcribed

Generate the First and Follow sets for the grammar below. The empty sting epsilon is denoted with the e symbol. SABCDEAaBbCcDdEe 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()={} 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) {} to FIRST (A) IV. If AA1A2 Ak B 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) {} to FIRST(A) V. If AA1A2Ak is a grammar rule and FIRST(A1) and FIRST(A2) and FIRST(Ak), then add to FIRST(A) We use the following 5 rules for calculating FOLLOW sets for non-terminals I. add $ to FOLLOW(S) (remember $ is used to denote end of file) II. If AB is a grammar rule, and B is a non-terminal, add FOLLOW (A) to FOLLOW (B) III. If ABA1A2Ak is a grammar rule, and B is a non-terminal, and FIRST(A1) and FIRST(A2).... and FIRST(Ak), then add FOLLOW(A) to FOLLOW(B) IV. If ABA1A2 Ak is a grammar rule, and B is non-terminal add FIRST (A1){} to FOLLOW(B) V. If ABA1A2AiAi+1 Ak is a grammar rule, and B is non-terminal and FIRST(A1 ) and FIRST(A2).... and FIRST(Ak), then add FIRST (Ai+1){} to FOLLOW(B)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Administration The Complete Guide To Dba Practices And Procedures

Authors: Craig S. Mullins

2nd Edition

0321822943, 978-0321822949

More Books

Students also viewed these Databases questions

Question

4. How does the worker do the job?

Answered: 1 week ago