GATE CSE
First time here? Checkout the FAQ!
x
+2 votes
82 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 Boss (7.3k points)   | 82 views

1 Answer

+5 votes
Best answer

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

answered by Veteran (17.1k 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 Feb 2017
  1. Arjun

    5386 Points

  2. Bikram

    4230 Points

  3. Habibkhan

    3952 Points

  4. Aboveallplayer

    3086 Points

  5. Debashish Deka

    2564 Points

  6. sriv_shubham

    2318 Points

  7. Smriti012

    2240 Points

  8. Arnabi

    2008 Points

  9. mcjoshi

    1696 Points

  10. sh!va

    1684 Points

Monthly Topper: Rs. 500 gift card

20,863 questions
26,022 answers
59,696 comments
22,133 users