import java.util.Stack;
public class Function2Traduit {
public static void main(String []args) {
int []memoire = new int[10000];
Stack<Integer> pileDAppel = new Stack<Integer>();
int instruction = 1;
while (true) {
System.err.println(">>>>>>Instruction à exécuter "+instruction);
switch (instruction) {
case 1:
System.out.println("Début");
instruction++; break;
case 2: // préparation de l'appel à f et de son retour
pileDAppel.push(instruction+1);
instruction = 7; break;
case 3:
System.out.println("Milieu");
instruction++; break;
case 4: // préparation de l'appel g et de son retour
pileDAppel.push(instruction+1);
instruction = 9; break;
case 5:
System.out.println("Fin");
instruction++; break;
case 6:
System.exit(0);
case 7: // début de f();
System.out.println("Je suis dans f()");
instruction++; break;
case 8: // revenir au point indiqué au moment de l'appel
// ce point est indiqué en sommet de la pile
instruction = pileDAppel.pop();
break;
case 9: // début de g();
System.out.println("Je suis dans g()");
instruction++; break;
case 10: // préparation de l'appel à f
pileDAppel.push(instruction+1);
instruction = 7; break;
case 11:
instruction = pileDAppel.pop(); break;
}
}
}
}