edited by
2,336 views
1 1 vote

Given solution:

After reducing two 1's of expression to E, E*E should be reduced not the 3rd 1. So final output will be 112*311+2 instead of the given output. Please check.

Consider the SDTS for the ambiguous grammar
\[
\begin{array}{ll}
\mathrm{E} \rightarrow \mathrm{E}+\mathrm{E} & \text { out(" } \left.1+2^{\prime \prime}\right) \\
\mathrm{E} \rightarrow \mathrm{E} * \mathrm{E} & \text { out("2*3") } \\
\mathrm{E} \rightarrow \text { num } & \text { out(num. val) }
\end{array}
\]

Assume a shift reduce parser. The output is treated as an arithmetic expression in C \& evaluated. The input is $1 * 1+1$.

The value obtained is $\qquad$ .

$1112 * 31+2=34474$

1 Answer

1 1 vote
Position:
Show:

Related questions

2 2 votes
1 1 answer
910
910 views
Purple asked Jan 27, 2016
910 views
In the above grammar,1. how to determine the precedence of the operator?2. If there is shift and reduce conflict, in who's favor to resolve?3. Why are we not reducing E >...
0 0 votes
1 1 answer
577
577 views
Sourabh Kumar asked Jan 14, 2016
577 views
Perform a shift - reduce parser of the input aaa $+a^{*}+$ according to the grammar?\[\mathrm{A} \rightarrow \mathrm{AA}+\left|\mathrm{AA}^{*}\right| \mathrm{a}\]Show the...
0 0 votes
1 1 answer
1.2k
1.2k views
Souvik33 asked Dec 11, 2022
1,167 views
Consider the following statements regarding the “Parsing Table” of a shift reduce parser, for any given grammarNo. of states/ size of parse table is same for all Shift-Re...
0 0 votes
2 answers 2 answers
3.7k
3.7k views
sripo asked Nov 1, 2018
3,709 views
S→(XS→E]S→E)X→E)X→E]E→ϵIs this grammar CLR(1)? The answer says it is but I find a shift reduce conflict for E- epsilon with lookup symbols ),]