The Gateway to Computer Science Excellence
+1 vote

 For the SDD(SYNTAX-DIRECTED DEFINITIONS ) of Fig. $5.1$, 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.$ 
in Compiler Design by | 2.5k views

1 Answer

0 votes

Here all the attributes are synthesized attributes. The attribute value of digit is provided by lexical analyzer since it is a terminal

1. (3+4)∗(5+6)n

Parse Tree

Annotated Parse Tree

2. 1∗2∗3∗(4+5)n

Synthesized attributes are used in conjunction with bottom up parsers to pass info up the tree

3. (9+8∗(7+6)+5)∗4n

edited by

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
52,345 questions
60,514 answers
95,364 users