in Compiler Design retagged
1,037 views
1 vote
1 vote
Either L attribute or S attributed .

What kind of SDT it is  ?

S --->E#   Out('#')

E ---> E+E   Out('+')

E --->T

T ---> T#F   Out('*)

T ---> F

F ---> (E)

F ---> a   Out ('a')

For the sentence a+a+a

What will be the final Output of it ?
in Compiler Design retagged
1.0k views

2 Answers

0 votes
0 votes

It is S attributed as the attributes are depending on their child

Let me know if anything is wrong

4 Comments

@sekhar parse tree as per order of presedence....
1
1
@shekhar yes as the tree is evaluated from all it's children , so it is a S attributed ,

+ is left associative, So, if the parse tree is evaluate from left to right it will be more accurate
1
1
if the string is in the form of a+a+a then we have to evaluate by using left associativity but u made this as right associativity i think thats why u got a diff ans

i got ans as    aa+a+#
0
0
0 votes
0 votes
S attribute....aaa++# ...every S attribute is L attribute ...but every L need not be S.

Related questions