2 votes 2 votes 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??? Compiler Design compiler-design syntax-directed-translation test-series + – Rahul Jain25 asked Dec 26, 2016 retagged Jul 18, 2022 by makhdoom ghaya Rahul Jain25 1.2k views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
Best answer 6 votes 6 votes bottom up evaluation.it will be TAAAAG..i have missed one A to write... .. sudsho answered Dec 27, 2016 selected Dec 30, 2016 by Rahul Jain25 sudsho comment Share Follow See all 6 Comments See all 6 6 Comments reply Rahul Jain25 commented Dec 28, 2016 reply Follow Share 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. 0 votes 0 votes sudsho commented Dec 30, 2016 reply Follow Share 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 1 votes 1 votes Rahul Jain25 commented Dec 30, 2016 reply Follow Share 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??? 0 votes 0 votes sudsho commented Dec 30, 2016 reply Follow Share 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 1 votes 1 votes Rahul Jain25 commented Dec 30, 2016 reply Follow Share Thanks @sudsho. Well expalined. 1 votes 1 votes reena_kandari commented Sep 19, 2017 reply Follow Share @Bikram sir, in page 1 of this pdf,it is mentioned that: General rule: The actions are viewed as "dummy" terminals embedded in the parse tree. They are executed in the order of a preorder traversal of the tree. Thus, the result of the SDT is the same whether parsing is top-down, bottom-up, or something else. In what sense they are saying that the result of SDT is same during both TDP and BUP.In this question also we can see TD and BU implementation are giving different results. 1 votes 1 votes Please log in or register to add a comment.