0 0 votes Write semantic rules for the grammar below to compute the Boolean attribute A. evenx, which is true iff the sentence parsed has an even number of $x$ 's. \[ \begin{array}{cl} A \rightarrow \mathrm{xA}_{1} y & \{?\} \\ \mid \mathrm{z} & \text { \{A.n = 0; A.evenx }=\text { true; }\} \end{array} \] A.evenx $=$ ! ( $\mathrm{A}_{1}$.evenx $)$; A.n $=\mathrm{A}_{1} \cdot \mathrm{n}+1$; A.evenx $=(\mathrm{A} . \mathrm{n} \% 2==0)$; Both (A) \& (B) None Compiler Design syntax-directed-translation compiler-design test-series + – sidlewis 1.1k views answer comment Share Follow Print See all 5 Comments 5 5 Comments reply Show 2 previous comments MiNiPanda commented Sep 2, 2018 reply Follow flag Do you have the solution? 0 0 replyShare srestha commented Sep 3, 2018 reply Follow flag @MiniPanda can u explain? 0 0 replyShare anonymous commented Oct 8, 2018 reply Follow flag answer is going to be only B just because when the value of A.n is supposed to be 2 or any even time then we are very sure that we have make use of first production. 0 0 replyShare Please log in or register to add a comment.