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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started