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; |
76 } |
76 } |
77 |
77 |
78 void *visit_expression_type_c::visit(function_declaration_c *symbol) { |
78 void *visit_expression_type_c::visit(function_declaration_c *symbol) { |
79 search_varfb_instance_type = new search_varfb_instance_type_c(symbol); |
79 search_varfb_instance_type = new search_varfb_instance_type_c(symbol); |
80 symbol->var_declarations_list->accept(*this); |
80 symbol->var_declarations_list->accept(*this); |
81 printf("checking semantics in body of function %s\n", ((token_c *)(symbol->derived_function_name))->value); |
81 //printf("checking semantics in body of function %s\n", ((token_c *)(symbol->derived_function_name))->value); |
82 il_parenthesis_level = 0; |
82 il_parenthesis_level = 0; |
83 il_error = false; |
83 il_error = false; |
84 il_default_variable_type = NULL; |
84 il_default_variable_type = NULL; |
85 symbol->function_body->accept(*this); |
85 symbol->function_body->accept(*this); |
86 il_default_variable_type = NULL; |
86 il_default_variable_type = NULL; |
90 } |
90 } |
91 |
91 |
92 void *visit_expression_type_c::visit(function_block_declaration_c *symbol) { |
92 void *visit_expression_type_c::visit(function_block_declaration_c *symbol) { |
93 search_varfb_instance_type = new search_varfb_instance_type_c(symbol); |
93 search_varfb_instance_type = new search_varfb_instance_type_c(symbol); |
94 symbol->var_declarations->accept(*this); |
94 symbol->var_declarations->accept(*this); |
95 printf("checking semantics in body of FB %s\n", ((token_c *)(symbol->fblock_name))->value); |
95 //printf("checking semantics in body of FB %s\n", ((token_c *)(symbol->fblock_name))->value); |
96 il_parenthesis_level = 0; |
96 il_parenthesis_level = 0; |
97 il_error = false; |
97 il_error = false; |
98 il_default_variable_type = NULL; |
98 il_default_variable_type = NULL; |
99 symbol->fblock_body->accept(*this); |
99 symbol->fblock_body->accept(*this); |
100 il_default_variable_type = NULL; |
100 il_default_variable_type = NULL; |