3 3 votes Consider the following grammars: $Z \rightarrow TZ'$ $Z' \rightarrow ^* TZ' \mid \epsilon$ $T \rightarrow YT'$ $T ' \rightarrow ^*YT ' \mid \epsilon$ $Y \rightarrow (Z) \mid id$ Which of the following is First(Z)? $\{T, ) \}$ $\{(, id \}$ $\{ ), \$ \}$ None of the above Compiler Design tbb-cd-1 compiler-design parsing grammar + – Bikram 569 views answer comment Share Follow Print 0 reply Please log in or register to add a comment.
Best answer 1 1 vote $$\begin{array}{|l|l|l|l|} \hline & \textbf{First} & \textbf{Follow} \\ \hline Z\rightarrow TZ' & \{(,id\} & \{\$,)\} \\ \hline Z'\rightarrow \ast TZ' \mid \epsilon & \{\ast,\epsilon\} & \{\$,)\} \\ \hline T\rightarrow YT'& \{(,id\} & \{\ast,$,)\} \\ \hline T'\rightarrow \ast YT' \mid \epsilon & \{\ast,\epsilon\} & \{\ast,$,)\} \\ \hline Y\rightarrow (Z) \mid id & \{(,id\} & \{\ast,\$,)\} \\ \hline \end{array}$$ So, the correct answer is $(B)$. Reference: http://www.cs.nuim.ie/~jpower/Courses/Previous/parsing/node48.html https://sites.tufts.edu/comp181/2013/10/05/first-and-follow-sets/ https://www.jambe.co.nz/UNI/FirstAndFollowSets.html https://drive.google.com/open?id=1UOH5Tbrr5HTPaWyDFtlRz60tq03XfoIO Lakshman Bhaiya answered Aug 23, 2019 • selected Aug 23, 2019 by Bikram Lakshman Bhaiya comment Share Follow 0 reply Please log in or register to add a comment.
–1 –1 vote B is Correct. Ravijha answered Jun 24, 2019 • edited Aug 23, 2019 by Lakshman Bhaiya Ravijha comment Share Follow 0 reply Please log in or register to add a comment.