retagged by
221 views
3 votes
3 votes

In the construction of $LL(1)$ parsing table for the following grammar $M[S,( ] \& M [W, \$]$ are respectively

  • $S \rightarrow XY$
  • $X \rightarrow (S) \mid \text{ int } W$
  • $Y\rightarrow +S \mid \epsilon$
  • $W \rightarrow ^*X \mid \epsilon$
  1. $X \rightarrow (S), \ W \rightarrow \epsilon$
  2. $S \rightarrow XY, \ W \rightarrow ^*x$
  3. $S \rightarrow XY,  \ W \rightarrow \epsilon$
  4. $S \rightarrow YX, \ W \rightarrow \epsilon$
retagged by

1 Answer

Best answer
2 votes
2 votes
$$\textbf{LL(1) Parsing Table} \\ \begin{array}{|l|l|l|l|} \hline  & ( & ) & \text{int} & + & \ast & \$  \\ \hline S & S\rightarrow XY & & S\rightarrow XY  \\ \hline X & X\rightarrow (S) & & X\rightarrow \text{int} \:W \\ \hline Y & & Y\rightarrow \epsilon & Y\rightarrow +S & & & Y\rightarrow \epsilon \\ \hline W & & W\rightarrow \epsilon & W\rightarrow \epsilon  & & W\rightarrow \ast X & W\rightarrow \epsilon  \\ \hline \end{array}$$
edited by
Answer:

Related questions

2 votes
2 votes
0 answers
1
Bikram asked Nov 25, 2016
444 views
$\textbf{goto}$ function of LR class of grammar is represented as:Deterministic Finite Automata transitionsNon-deterministic Finite Automata transitionsPDA transitionsPar...
3 votes
3 votes
1 answer
2
Bikram asked Nov 25, 2016
442 views
Consider the following grammar:$E \rightarrow E + T \mid T$$T \rightarrow T ^* F \mid F$$F \rightarrow (E) \mid id$What are the productions for E, T and F after convertin...
2 votes
2 votes
1 answer
3
Bikram asked Nov 25, 2016
299 views
Which one of the following statements is TRUE?SLR parser has more states than LALR parser.LALR parser has more states than Canonical LR.Canonical LR has fewer states than...
3 votes
3 votes
1 answer
4
Bikram asked Nov 25, 2016
977 views
Which one of the following can be handled by predictive parsers?Left recursionLeft factorsAmbiguityNon-determinism