in Compiler Design edited by
549 views
1 vote
1 vote

Please tell me - 

1) What is top down evaluation of Parse tree?

2) What is Bottom Up evaluation of Parse Tree

3) What is Depth First left to right evaluation of Parse tree?

Is 1 and 3 are equal? 

Please make a small tree and show how to traverse Top down and Bottom up?

Also, Explain how Top down and Bottom up Parser work is it same as Tree evaluation?

in Compiler Design edited by
by
549 views

1 Answer

3 votes
3 votes
Best answer

I don't have much idea about Depth first left to right parsing, but if you use stack for dfs and go from left to right in above case it gives same as top down parsing. I have done for one string and this is not the way to parse this string. Given is one way I followed for bot top down and bottom up.

Here reverse right most means you start from given string and map terminals one by one with variables from right side as shown by arrow.

selected by

2 Comments

Depth first and left to write works same as top down parser! So the above explanation is correct and 1 and 3 are same
3
3

@kirti_k thank you

1
1