Esempio n. 1
0
        public void Accept(CIL_Program prog)
        {
            Text += PlantillaMIPS.StringLength + "\n" +
                    PlantillaMIPS.StringConcat + "\n" +
                    PlantillaMIPS.StringSubstring + "\n" +
                    PlantillaMIPS.InputString + "\n" +
                    PlantillaMIPS.Copy + "\n" +
                    PlantillaMIPS.ZeroException + "\n";

            prog.Types.Accept(this);
            prog.Data.Accept(this);
            prog.Code.Accept(this);

            Text += "\nmain:\n" +
                    "\t sw $zero, 0($sp) \n" +
                    "\t sw $ra, -4($sp) \n" +
                    "\t sw $fp, -8($sp) \n" +
                    "\t subu $sp, $sp, 12\n" +
                    "\t addu $fp, $sp, 12\n\n" +
                    "\t jal Main.constructor \n" +
                    "\t sw $v0, -12($fp) \n" +
                    "\t sw $v0, -12($sp) \n" +
                    "\t jal __init_Main \n" +
                    "\t sw $v0, -12($fp) \n" +
                    "\t sw $v0, -12($sp) \n" +
                    "\t jal main_Main \n" +
                    "\n\t lw $ra, -4($fp) \n" +
                    "\t lw $fp, -8($fp) \n" +
                    "\t addu $sp, $sp, " + 12 + "\n" +
                    "\t jr $ra \n\n";
        }
Esempio n. 2
0
 public void Accept(CIL_Program prog)
 {
     prog.Types.Accept(this);
     prog.Data.Accept(this);
     prog.Code.Accept(this);
 }