edited by
744 views
2 votes
2 votes

Consider the $SDTS$ for the ambiguous grammar

$E \rightarrow E + E$        $out ("1 + 2 ")$

$E \rightarrow E ^{*} E$         $out ("2 ^{*} 3")$

$E \rightarrow num$          $out (num.val)$

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 _______.

EDIT: Here's the explanation given..

edited by

1 Answer

4 votes
4 votes

The Grammar is ambiguous  .How can we assume a SR parser for ambiguous  Grammar .I don't think this question is Right. No Parse can parse the ambiguous  Grammar Except Operator Precedence Parse ( it can parse only some of the ambiguous  Grammar Not All )  as far as i  Know.

Answer : No Answer

Related questions