# Ullman (Compiler Design) Edition 2 Exercise 5.1 Question 3 (Page No. 310)

1 vote
151 views

For the SDD(SYNTAX-DIRECTED DEFINITIONS ) of Fig. $5.4$, give annotated parse trees for the following expressions:

1. $(3+4)\ast(5+6)n.$
2. $1\ast2\ast3\ast(4+5)n.$
3. $(9+8\ast(7+6)+5)\ast 4n.$

## Related questions

1
211 views
Extend the SDD of Fig. $5.4$ to handle expressions as in Fig. $5.1$.
1 vote
For the SDD(SYNTAX-DIRECTED DEFINITIONS ) of Fig. $5.1$, give annotated parse trees for the following expressions: $(3+4)\ast(5+6)n.$ $1\ast2\ast3\ast(4+5)n.$ $(9+8\ast(7+6)+5)\ast 4n.$
Construct a syntax-directed translation scheme that translates arithmetic expressions from infix notation into prefix notation in which an operator appears before its operands; e.g., $-xy$ is the prefix notation for $x - y$. Give annotated parse trees for the inputs $9-5+2$ and $9-5*2$.
This grammar generates binary numbers with a "decimal" point: $S\rightarrow L.L\mid L$ $L\rightarrow LB\mid B$ $B\rightarrow 0\mid 1$ Design an S-attributed SDD to compute $S.val$, the decimal-number value of an input string. For example, the translation of string $101.101$ should be the decimal number $5.625$.