stage4/generate_cc/generate_cc_il.cc
changeset 17 38754701ac41
parent 16 e8b99f896416
child 32 289256ec66f1
equal deleted inserted replaced
16:e8b99f896416 17:38754701ac41
   317       generate_cc_tempvardecl_c generate_cc_tempvardecl(&s4o);
   317       generate_cc_tempvardecl_c generate_cc_tempvardecl(&s4o);
   318       generate_cc_tempvardecl.generate(il, &temp_var_name_factory);
   318       generate_cc_tempvardecl.generate(il, &temp_var_name_factory);
   319       il->accept(*this);
   319       il->accept(*this);
   320     }
   320     }
   321 
   321 
       
   322     /* Declare the backup to the default variable, that will store the result
       
   323      * of the IL operations executed inside a parenthesis...
       
   324      */
       
   325     void declare_backup_variable(void) {
       
   326       s4o.print(s4o.indent_spaces);
       
   327       s4o.print(IL_DEFVAR_T);
       
   328       s4o.print(" ");
       
   329       print_backup_variable();
       
   330       s4o.print(";\n");
       
   331     }
       
   332     
       
   333     void print_backup_variable(void) {
       
   334       this->default_variable_back_name.accept(*this);
       
   335     }
       
   336 
   322   private:
   337   private:
   323     /* A helper function... */
   338     /* A helper function... */
   324     /*
   339     /*
   325     bool is_bool_type(symbol_c *type_symbol) {
   340     bool is_bool_type(symbol_c *type_symbol) {
   326       return (NULL != dynamic_cast<bool_type_name_c *>(type_symbol));
   341       return (NULL != dynamic_cast<bool_type_name_c *>(type_symbol));
   456 /* please see the comment before the RET_operator_c visitor for details... */
   471 /* please see the comment before the RET_operator_c visitor for details... */
   457 #define END_LABEL VAR_LEADER "end"
   472 #define END_LABEL VAR_LEADER "end"
   458 
   473 
   459 /*| instruction_list il_instruction */
   474 /*| instruction_list il_instruction */
   460 void *visit(instruction_list_c *symbol) {
   475 void *visit(instruction_list_c *symbol) {
       
   476   
   461   /* Declare the backup to the default variable, that will store the result
   477   /* Declare the backup to the default variable, that will store the result
   462    * of the IL operations executed inside a parenthesis...
   478    * of the IL operations executed inside a parenthesis...
   463    */
   479    */
   464   s4o.print(s4o.indent_spaces);
   480   declare_backup_variable();
   465   s4o.print(IL_DEFVAR_T);
   481   
   466   s4o.print(" ");
       
   467   this->default_variable_back_name.accept(*this);
       
   468   s4o.print(";\n");
       
   469 
       
   470   /* Declare the default variable, that will store the result of the IL operations... */
   482   /* Declare the default variable, that will store the result of the IL operations... */
   471   s4o.print(s4o.indent_spaces);
   483   s4o.print(s4o.indent_spaces);
   472   s4o.print(IL_DEFVAR_T);
   484   s4o.print(IL_DEFVAR_T);
   473   s4o.print(" ");
   485   s4o.print(" ");
   474   this->default_variable_name.accept(*this);
   486   this->default_variable_name.accept(*this);