Question: 18. Code generation for programs. Translate the following program: int result; int fibo (int n) { int result; if (n < 0) return 1; switch
18. Code generation for programs. Translate the following program: int result; int fibo (int n) { int result; if (n < 0) return 1; switch (n) { case0 : return 0; break; case1 : return 1; break; default : return fibo (n 1) +fibo (n 2); } } int main() { int n; n 5; result fibo (n); return 0; }
19. CMA interpreters. 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 data structures C and S. Test your interpreter with the factorial function and the main function: int main() { return fac(9); }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
