stage3/visit_expression_type.cc
changeset 210 8387cac2aba6
parent 204 8ffa211b7f9a
child 258 d7d92b2f87e9
equal deleted inserted replaced
209:30cbae46190d 210:8387cac2aba6
    48                                   ((symbol1)->last_column  < (symbol2)->last_column)  ? (symbol2) :    \
    48                                   ((symbol1)->last_column  < (symbol2)->last_column)  ? (symbol2) :    \
    49                                   ((symbol1)->last_column  > (symbol2)->last_column)  ? (symbol1) :    \
    49                                   ((symbol1)->last_column  > (symbol2)->last_column)  ? (symbol1) :    \
    50                                   (symbol1))
    50                                   (symbol1))
    51 
    51 
    52 #define STAGE3_ERROR(symbol1, symbol2, msg) {                                          \
    52 #define STAGE3_ERROR(symbol1, symbol2, msg) {                                          \
    53     printf("semantic error between (%d:%d) and (%d:%d): %s\n",                         \
    53     /*printf("semantic error between (%d:%d) and (%d:%d): %s\n",                         \
    54            FIRST_(symbol1,symbol2)->first_line, FIRST_(symbol1,symbol2)->first_column, \
    54            FIRST_(symbol1,symbol2)->first_line, FIRST_(symbol1,symbol2)->first_column, \
    55            LAST_(symbol1,symbol2) ->last_line,  LAST_(symbol1,symbol2) ->last_column,  \
    55            LAST_(symbol1,symbol2) ->last_line,  LAST_(symbol1,symbol2) ->last_column,  \
    56            msg);                                                                       \
    56            msg);*/                                                                       \
    57     il_error = true;                                                                   \
    57     il_error = true;                                                                   \
    58   }
    58   }
    59 
    59 
    60 
    60 
    61 
    61 
    62 
    62 
    63 
    63 
    64 void *visit_expression_type_c::visit(program_declaration_c *symbol) {
    64 void *visit_expression_type_c::visit(program_declaration_c *symbol) {
    65   search_varfb_instance_type = new search_varfb_instance_type_c(symbol);
    65   search_varfb_instance_type = new search_varfb_instance_type_c(symbol);
    66   symbol->var_declarations->accept(*this);
    66   symbol->var_declarations->accept(*this);
    67   printf("checking semantics in body of program %s\n", ((token_c *)(symbol->program_type_name))->value);
    67   //printf("checking semantics in body of program %s\n", ((token_c *)(symbol->program_type_name))->value);
    68   il_parenthesis_level = 0;
    68   il_parenthesis_level = 0;
    69   il_error = false;
    69   il_error = false;
    70   il_default_variable_type = NULL;
    70   il_default_variable_type = NULL;
    71   symbol->function_block_body->accept(*this);
    71   symbol->function_block_body->accept(*this);
    72   il_default_variable_type = NULL;
    72   il_default_variable_type = NULL;
    75 }
    75 }
    76 
    76 
    77 void *visit_expression_type_c::visit(function_declaration_c *symbol) {
    77 void *visit_expression_type_c::visit(function_declaration_c *symbol) {
    78   search_varfb_instance_type = new search_varfb_instance_type_c(symbol);
    78   search_varfb_instance_type = new search_varfb_instance_type_c(symbol);
    79   symbol->var_declarations_list->accept(*this);
    79   symbol->var_declarations_list->accept(*this);
    80   printf("checking semantics in body of function %s\n", ((token_c *)(symbol->derived_function_name))->value);
    80   //printf("checking semantics in body of function %s\n", ((token_c *)(symbol->derived_function_name))->value);
    81   il_parenthesis_level = 0;
    81   il_parenthesis_level = 0;
    82   il_error = false;
    82   il_error = false;
    83   il_default_variable_type = NULL;
    83   il_default_variable_type = NULL;
    84   symbol->function_body->accept(*this);
    84   symbol->function_body->accept(*this);
    85   il_default_variable_type = NULL;
    85   il_default_variable_type = NULL;
    88 }
    88 }
    89 
    89 
    90 void *visit_expression_type_c::visit(function_block_declaration_c *symbol) {
    90 void *visit_expression_type_c::visit(function_block_declaration_c *symbol) {
    91   search_varfb_instance_type = new search_varfb_instance_type_c(symbol);
    91   search_varfb_instance_type = new search_varfb_instance_type_c(symbol);
    92   symbol->var_declarations->accept(*this);
    92   symbol->var_declarations->accept(*this);
    93   printf("checking semantics in body of FB %s\n", ((token_c *)(symbol->fblock_name))->value);
    93   //printf("checking semantics in body of FB %s\n", ((token_c *)(symbol->fblock_name))->value);
    94   il_parenthesis_level = 0;
    94   il_parenthesis_level = 0;
    95   il_error = false;
    95   il_error = false;
    96   il_default_variable_type = NULL;
    96   il_default_variable_type = NULL;
    97   symbol->fblock_body->accept(*this);
    97   symbol->fblock_body->accept(*this);
    98   il_default_variable_type = NULL;
    98   il_default_variable_type = NULL;