18 Code Generation For Programs Translate The Following Program Int Result Int Fibo 2840630
18. Code generation for programs. Translate the following program:
intresult;?intfibo(intn) {
intresult;?if(nreturn-1;switch(n) {
case0 :return0;break;?case1 :return1;break;?default:returnfibo(n-1)+fibo(n-2);}
}?intmain() {
intn;?n?5;?result? fibo(n);return0;
}
19. C MAinterpreters.?Implement an interpreter for the C-Machine in the programming language of your choice.
• Choose a suitable data type for instructions. Take into account that some instructions have arguments, but some have not.?
• Implement the datastructuresCandS.?
• Test your interpreter with the factorial function and the main function:?
intmain() { returnfac(9);}?