Adding debug conditional printf()s in stage 3.
Printing semantic error info to stderr instead of stdout.
--- a/stage3/visit_expression_type.cc Thu Mar 31 10:45:34 2011 +0100
+++ b/stage3/visit_expression_type.cc Thu Mar 31 10:52:03 2011 +0100
@@ -50,21 +50,22 @@
(symbol1))
#define STAGE3_ERROR(symbol1, symbol2, msg) { \
- /*printf("semantic error between (%d:%d) and (%d:%d): %s\n", \
+ fprintf(stderr, "semantic error between (%d:%d) and (%d:%d): %s\n", \
FIRST_(symbol1,symbol2)->first_line, FIRST_(symbol1,symbol2)->first_column, \
LAST_(symbol1,symbol2) ->last_line, LAST_(symbol1,symbol2) ->last_column, \
- msg);*/ \
+ msg); \
il_error = true; \
}
-
+/* set to 1 to see debug info during execution */
+static int debug = 0;
void *visit_expression_type_c::visit(program_declaration_c *symbol) {
search_varfb_instance_type = new search_varfb_instance_type_c(symbol);
symbol->var_declarations->accept(*this);
- //printf("checking semantics in body of program %s\n", ((token_c *)(symbol->program_type_name))->value);
+ if (debug) printf("checking semantics in body of program %s\n", ((token_c *)(symbol->program_type_name))->value);
il_parenthesis_level = 0;
il_error = false;
il_default_variable_type = NULL;
@@ -78,7 +79,7 @@
void *visit_expression_type_c::visit(function_declaration_c *symbol) {
search_varfb_instance_type = new search_varfb_instance_type_c(symbol);
symbol->var_declarations_list->accept(*this);
- //printf("checking semantics in body of function %s\n", ((token_c *)(symbol->derived_function_name))->value);
+ if (debug) printf("checking semantics in body of function %s\n", ((token_c *)(symbol->derived_function_name))->value);
il_parenthesis_level = 0;
il_error = false;
il_default_variable_type = NULL;
@@ -92,7 +93,7 @@
void *visit_expression_type_c::visit(function_block_declaration_c *symbol) {
search_varfb_instance_type = new search_varfb_instance_type_c(symbol);
symbol->var_declarations->accept(*this);
- //printf("checking semantics in body of FB %s\n", ((token_c *)(symbol->fblock_name))->value);
+ if (debug) printf("checking semantics in body of FB %s\n", ((token_c *)(symbol->fblock_name))->value);
il_parenthesis_level = 0;
il_error = false;
il_default_variable_type = NULL;