Question: 2. This question is about code generation. The first two parts make reference to the following program fragment in a Java-like language: class MyInt {



2. This question is about code generation. The first two parts make reference to the following program fragment in a Java-like language: class MyInt { private int n; public My Int (int i) { n=j; } public int f (int x) { n=n+1; return n*x; } public MyInt g (int x) { int j x+n; MyInt r = new MyInt()); return r; } } (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. iii. 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
