Similar questions 2 more →
Semantic Analysis & Type Checking

Answer & solution
Answer: Literal output ab+cd+. (final dot is emitted); root multiplication with two parenthesized addition subtrees. (no official key was published)
The root production is E→E*E. Its left E derives (E), whose inner E derives E+E with identifier leaves a and b. Its right E derives (E), whose inner E derives E+E with identifier leaves c and d. Thus a textual description of the full parse tree is E(E('(',E(E(id a),'+',E(id b)),')'), '*', E('(',E(E(id c),'+',E(id d)),')')). Parentheses are terminal children of their E→(E) nodes, not emitted characters.
Actions run on reduction, after the right-hand-side subexpressions have been recognized. Reducing id a prints a, reducing id b prints b, and reducing their addition prints +. The parenthesized left operand therefore emits a b +. The E→(E) reduction emits nothing. Similarly the right operand emits c d +. Only after both operand E nodes exist can the root multiplication reduce and print the dot specified by its action.
The literal complete output is a b + c d + ., or ab+cd+. when concatenated without separators. The final dot is an emitted multiplication token, not sentence punctuation. It is postfix notation: each operation follows its operands. As a check, a postfix evaluator pushes a and b, combines them by +, pushes c and d, combines them by +, then multiplies the two resulting values. The grammar is ambiguous in general for unparenthesized mixed operators, but these explicit parentheses fix the intended tree for this particular sentence. Conventional postfix ab+cd+* expresses the same multiplication, but it is not the exact string emitted by the printed SDTS and must not replace it silently.