GATE CSE
First time here? Checkout the FAQ!
x
+2 votes
109 views

here it is given bottom up parsing still action is given in middle so output should be GAAAAT??? Is it true that in syntax tree tanslation bottom up and top down gives same answer???

asked in Compiler Design by Veteran (10.6k points)   | 109 views

1 Answer

+6 votes
Best answer

bottom up evaluation.it will be TAAAAG..i have missed one A to write...
..

answered by Veteran (17.6k points)  
selected by
It means in top down S---> p {"A"} P kind of production after "P" is encountered the only semantic action done right???? What if,     S-->{"A"}pP type of production is there??

And also S--->pP{"A"} production in bottom up.
sry i didnt see the comment
here actually these are L attributes SDTs so technically we should do top to down then left to right parsing...but since exclusively it is given that u have to bottom up..i have done this way.. if u go top down here answer would be GAAAAT here
i was having a doubt that even in bottom up we beigin from lead node that is leftmost so me must begin from p right???
no in bottom up we perform SDT only when there is a reduction..like first reduction is r->P then
SP->Q..so on...because we have to do reverse of rmd..so go till bottom then make building upwards
Thanks @sudsho. Well expalined.


Top Users Jul 2017
  1. Bikram

    3782 Points

  2. manu00x

    2464 Points

  3. Debashish Deka

    1832 Points

  4. joshi_nitish

    1494 Points

  5. Arnab Bhadra

    1096 Points

  6. Arjun

    1054 Points

  7. Hemant Parihar

    1050 Points

  8. Shubhanshu

    972 Points

  9. Ahwan

    876 Points

  10. akash.dinkar12

    642 Points


23,953 questions
30,895 answers
70,108 comments
29,272 users