The Gateway to Computer Science Excellence
+1 vote
21 views

 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 Veteran (52.9k points) | 21 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

by Active (5k points)
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
50,666 questions
56,157 answers
193,767 comments
93,746 users