11. Briefly explain how parse tree and the set of production rules help in language translation (At the semantic analysis phase) [3 marks]

12. Use the following SDT to convert an infix expression (9*3+2) to it post-fix equivalent. Production E → E + T /T T → T * F /F F → num Semantic rules {print(“+”)} {} {print (“*”)} {} {print (num.lval)} [5 marks]

13. Briefly explain the relevance of DAG and TAC at the Intermediate code generation phase . Give an example of DAG(Directed Acyclic Graph) with its equivalent TAC(Three-Address Code). [6 marks]

14. Parser table is very important in predictive parsing; construct a parser table for the following CFG: S →ACB | CbB | Ba A → da | BC B → g |ε C → h | ε [10 mark



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *