Question: (b) Explain how the compilation of methods and method invocation in object-oriented languages, can be reduced to the compilation of procedures and procedure calls. Your

(b) Explain how the compilation of methods and method invocation in object-oriented languages, can be reduced to the compilation of procedures and procedure calls. Your answer should suppose an approach involving method tables. i. Write pseudocode representing how My Int: :f would be realised as a procedure, and how an invocation a.f(x) would be realised as a procedure invocation for an object a of class MyInt. [6 marks] ii. Explain briefly how method bodies are stored in memory, and how these memory locations may be found at run-time in a method invocation. [10 marks] ii. Explain briefly what advantage there is to perform such a conversion, e.g., in a compiler accepting multiple source languages. [6 marks]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
