GATE CSE
First time here? Checkout the FAQ!
x
+2 votes
98 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.5k points)   | 98 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.2k 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 May 2017
  1. akash.dinkar12

    3338 Points

  2. pawan kumarln

    2108 Points

  3. Bikram

    1922 Points

  4. sh!va

    1682 Points

  5. Arjun

    1614 Points

  6. Devshree Dubey

    1272 Points

  7. Debashish Deka

    1208 Points

  8. Angkit

    1056 Points

  9. LeenSharma

    1018 Points

  10. Arnab Bhadra

    812 Points

Monthly Topper: Rs. 500 gift card
Top Users 2017 May 22 - 28
  1. Bikram

    1008 Points

  2. pawan kumarln

    734 Points

  3. Arnab Bhadra

    726 Points

  4. Arjun

    342 Points

  5. bharti

    328 Points


22,893 questions
29,196 answers
65,302 comments
27,695 users