GATE CSE
First time here? Checkout the FAQ!
x
+1 vote
123 views
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 ?
asked in Compiler Design by Veteran (41.5k points)  
retagged | 123 views

1 Answer

0 votes

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

Let me know if anything is wrong

answered by Veteran (13.7k points)  
where u get this question ??
Actually just by lookig at the SDT I dont know how to check whether it is L attributed or S attributed..Unless we have some Semantic rules with it .and i think it should be very imp to know what kind of SDT it is .otherwise we will make some mistake in evatuation process.mainly in case og ambiguous grammar like

E ---> E+ E

E --->E*E

E ---> id

if someone says evaluate it for like 1+1*1 then which way to do it . I don't know
we need to consider unambiguous grammar for sdt if not we need to change it to unambiguous I think
@sekhar parse tree as per order of presedence....
@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


Top Users Apr 2017
  1. akash.dinkar12

    3660 Points

  2. Divya Bharti

    2580 Points

  3. Deepthi_ts

    2040 Points

  4. rude

    1966 Points

  5. Tesla!

    1768 Points

  6. Debashish Deka

    1614 Points

  7. Shubham Sharma 2

    1610 Points

  8. Prashant.

    1492 Points

  9. Arjun

    1472 Points

  10. Arunav Khare

    1464 Points

Monthly Topper: Rs. 500 gift card

22,088 questions
28,063 answers
63,298 comments
24,173 users