296 views
1 1 vote
Consider the following Syntax-Directed Translation (SDT) scheme with the grammar rules and actions provided below:

$$
\begin{aligned}
& S \rightarrow S_1 \# T\left\{S . \mathrm{val}=S_1 . \mathrm{val}-T . \mathrm{val}\right\} \\
& S \rightarrow T\{S . \mathrm{val}=T . \mathrm{val}\} \\
& T \rightarrow T_1 \% i d\left\{T . \mathrm{val}=T_1 . \mathrm{val} \times i d . \mathrm{val}\right\} \\
& T \rightarrow i d\{T . \mathrm{val}=i d . \mathrm{val}\}
\end{aligned}
$$

What is the value of $S.\mathrm{val}$ for the input expression$: 10 \# 2 \% 3 \# 4$?

2 Answers

Answer:
Position:
Show:

Related questions

2 2 votes
3 3 answers
373
373 views
GO Classes asked Jan 27
373 views
Consider the following lexical specification for a scanner:$\mathrm{KEYWORD\_IF: \verb|if|}$ $\mathrm{ID: [a-z][0-9]*}$ $\mathrm{NUM: [0-9]+}$ The scanner follows the Lon...
0 0 votes
1 1 answer
344
344 views
GO Classes asked Jan 27
344 views
Consider the following sequence of three-address code (TAC) instructions:1. i = 1 2. j = 1 3. t1 = 5 * i 4. t2 = t1 + j 5. a[t2] = 0 6. j = j + 1 7. if j <= 5 goto (3) 8....
2 2 votes
2 2 answers
337
337 views
GO Classes asked Jan 27
337 views
Consider the following grammar $G$ with start symbol $S$ :$$\begin{aligned}& S \rightarrow L=R \\& S \rightarrow R \\& L \rightarrow * R \\& L \rightarrow i d . \\& R \ri...
0 0 votes
1 1 answer
307
307 views
GO Classes asked Jan 27
307 views
Consider the following basic block of Three-Address Code:1. a = 1 2. b = a + 1 3. c = a + b 4. a = c + b 5. return aA variable is live at a point if its current value wil...