3,599 views
18 votes
18 votes

Consider the syntax-directed translation schema (SDTS) shown below:

  • $E\rightarrow E + E$ {print “+”}
  • $E\rightarrow E * E$ {print “.”}
  • $E\rightarrow id$ {print id.name}
  • $E\rightarrow (E)$

An LR-parser executes the actions associated with the productions immediately after a reduction by the corresponding production. Draw the parse tree and write the translation for the sentence.

$(a+b)*(c+d)$, using SDTS given above.

2 Answers

Best answer
28 votes
28 votes

$\mathbf{ab+cd+.}$

edited by

Related questions

7.9k
views
5 answers
34 votes
Kathleen asked Oct 9, 2014
7,882 views
Let $G$ be a context-free grammar where $G=(\{S, A, B, C\}, \{a, b, d\}, P, S)$ with the productions in $P$ given below.$S \rightarrow ABAC$A \ ... A unit production is of the form $x \rightarrow y$, and $x$ and $y$ are non terminals).
3.9k
views
2 answers
8 votes
Kathleen asked Oct 9, 2014
3,893 views
Which of the following macros can put a macro assembler into an infinite loop?.MACRO M1, X .IF EQ, X ;if X=0 then M1 X + 1 .ENDC .IF NE, X ;if X ≠ O then .WORD ... X .WORD X + 1 .ENDC .ENDM(ii) only(i) onlyboth (i) and (ii)None of the above
5.7k
views
1 answers
28 votes
Kathleen asked Oct 9, 2014
5,695 views
The grammar whose productions are$\langle\text{stmt}\rangle \to\text{ if id then } \langle\text{stmt}\rangle$\langle\text{stmt}\rangle\to\text{ if id then } \langle\ ... ) the sentenceif a then if b then c:= d else c:= fhas two parse trees
13.1k
views
2 answers
39 votes
Kathleen asked Oct 9, 2014
13,088 views
The pass numbers for each of the following activitiesobject code generationliterals added to literal tablelisting printedaddress resolution of local symbols that occur in a two pass assemblerrespectively are ... $1, 2, 2, 2$