search
Log In
0 votes
52 views
Give an SDD to translate infix expressions with $+$ and $\ast$ into equivalent expressions without redundant parentheses. For example, since both operators associate from the left, and $\ast$ takes precedence over  $+, ((a\ast(b+c))\ast(d))$ translates into $a\ast(b + c)\ast d$.
in Compiler Design 52 views

Please log in or register to answer this question.

Related questions

0 votes
0 answers
1
47 views
Give an SDD to differentiate expressions such as $x\ast(3\ast x + x\ast x)$ involving the operators $+$ and $\ast,$ the variable $x$, and constants. Assume that no simplification occurs, so that, for example, $3\ast x$ will be translated into $3\ast 1+0\ast x$.
asked Sep 6, 2019 in Compiler Design Lakshman Patel RJIT 47 views
0 votes
0 answers
2
125 views
Below is a grammar for expressions involving operator $+$ and integer or floating-point operands. Floating-point numbers are distinguished by having a decimal point. $E\rightarrow E+T\mid T$ $T\rightarrow num.num\mid num$ Give an SDD to determine the type ... SDD of $(a)$ to translate expressions into postfix notation.Use the unary operator intToFloat to turn an integer into an equivalent float.
asked Sep 6, 2019 in Compiler Design Lakshman Patel RJIT 125 views
1 vote
1 answer
3
112 views
The following SDT computes the value of a string of $0's$ and $1's$ interpreted as a positive, binary integer. $B\rightarrow B_{1}0\:\{B.val=2\times B_{1}.val\}\mid B_{1}1\:\{B.val=2\times B_{1}.val+1\}\mid 1 \:\{B.val=1\}$ Rewrite this SDT so the underlying grammar is not left recursive, and yet the same value of $B.val$ is computed for the entire input string.
asked Sep 6, 2019 in Compiler Design Lakshman Patel RJIT 112 views
0 votes
2 answers
4
625 views
Suppose that we have a production $A\rightarrow BCD$. Each of the four nonterminals $A, B, C,$ and $D$ have two attributes: $s$ is a synthesized attribute, and $i$ is an inherited attribute. For each of the sets of rules below, tell whether the rules are consistent with an S-attributed definition the rules are consistent with ... $A.s=B.s+D.s$ $A.s=D.i,B.i=A.s+C.s,C.i=B.s,$ and $D.i=B.i+C.i.$
asked Sep 6, 2019 in Compiler Design Lakshman Patel RJIT 625 views
...