Adding basic error checking.
authormario
Tue, 23 Oct 2007 10:35:58 +0200
changeset 69 41cb5b80416e
parent 68 b0a43002dcac
child 70 e1f0ebd2d9ec
Adding basic error checking.
absyntax/absyntax.cc
absyntax/absyntax.def
absyntax/absyntax.hh
absyntax/visitor.cc
absyntax/visitor.hh
stage4/generate_cc/generate_cc.cc
stage4/generate_cc/generate_cc_il.cc
--- a/absyntax/absyntax.cc	Tue Oct 23 10:33:09 2007 +0200
+++ b/absyntax/absyntax.cc	Tue Oct 23 10:35:58 2007 +0200
@@ -43,16 +43,23 @@
 
 /* The base class of all symbols */
 symbol_c::symbol_c(void) {
-  lineno = 0;
-}
-
-symbol_c::symbol_c(long lineno) {
-  this->lineno = lineno;
-}
-
-
-
-token_c::token_c(const char *value) {
+  this->first_line   = 0;
+  this->first_column = 0;
+  this->last_line    = 0;
+  this->last_column  = 0;
+}
+
+symbol_c::symbol_c(int first_line, int first_column, int last_line, int last_column) {
+  this->first_line   = first_line;
+  this->first_column = first_column;
+  this->last_line    = last_line;
+  this->last_column  = last_column;
+}
+
+
+
+token_c::token_c(const char *value, int fl, int fc, int ll, int lc)
+  :symbol_c(fl, fc, ll, lc) {
   this->value = value;
 //  printf("New token: %s\n", value);
 }
@@ -62,12 +69,14 @@
 
 
 
-list_c::list_c(void) {
+list_c::list_c(int fl, int fc, int ll, int lc)
+  :symbol_c(fl, fc, ll, lc) {
   n = 0;
   elements = NULL;
 }
 
-list_c::list_c(symbol_c *elem) {
+list_c::list_c(symbol_c *elem, int fl, int fc, int ll, int lc)
+  :symbol_c(fl, fc, ll, lc) {
   n = 0;
   elements = NULL;
   add_element(elem);
@@ -81,37 +90,95 @@
   if (elements == NULL)
     ABORT("Out of memory");
   elements[n - 1] = elem;
-}
-
+ 
+  if (elem == NULL)
+    return;
+
+  /* adjust the location parameters, taking into account the new element. */
+  if ((first_line == elem->first_line) &&
+      (first_column > elem->first_column)) {
+    first_column = elem->first_column;
+  }
+  if (first_line > elem->first_line) {
+    first_line = elem->first_line;
+    first_column = elem->first_column;
+  }
+  if ((last_line == elem->last_line) &&
+      (last_column < elem->last_column)) {
+    last_column = elem->last_column;
+  }
+  if (last_line < elem->last_line) {
+    last_line = elem->last_line;
+    last_column = elem->last_column;
+  }
+}
 
 
 
 
 #define SYM_LIST(class_name_c)							\
+class_name_c::class_name_c(int fl, int fc, int ll, int lc)			\
+			:list_c(fl, fc, ll, lc) {}				\
+class_name_c::class_name_c(symbol_c *elem, int fl, int fc, int ll, int lc)	\
+			:list_c(elem, fl, fc, ll, lc) {}			\
 void *class_name_c::accept(visitor_c &visitor) {return visitor.visit(this);}
 
 #define SYM_TOKEN(class_name_c)							\
-class_name_c::class_name_c(const char *value): token_c(value) {}			\
-void *class_name_c::accept(visitor_c &visitor) {return visitor.visit(this);}
-
-#define SYM_REF0(class_name_c)			\
-void *class_name_c::accept(visitor_c &visitor) {return visitor.visit(this);}
-
-
-#define SYM_REF2(class_name_c, ref1, ref2)	\
-class_name_c::class_name_c(symbol_c *ref1,	\
-			   symbol_c *ref2) {	\
-  this->ref1 = ref1;				\
-  this->ref2 = ref2;				\
-}						\
-void *class_name_c::accept(visitor_c &visitor) {return visitor.visit(this);}
-
-
-#define SYM_REF4(class_name_c, ref1, ref2, ref3, ref4)	\
+class_name_c::class_name_c(const char *value, int fl, int fc, int ll, int lc)	\
+			:token_c(value, fl, fc, ll, lc) {}			\
+void *class_name_c::accept(visitor_c &visitor) {return visitor.visit(this);}
+
+#define SYM_REF0(class_name_c)					\
+class_name_c::class_name_c(int fl, int fc,			\
+			   int ll, int lc			\
+			  ): symbol_c(fl, fc, ll, lc) {}	\
+void *class_name_c::accept(visitor_c &visitor) {return visitor.visit(this);}
+
+
+#define SYM_REF1(class_name_c, ref1)			\
+class_name_c::class_name_c(symbol_c *ref1,		\
+			   int fl, int fc,		\
+			   int ll, int lc		\
+			  ): symbol_c(fl, fc, ll, lc) {	\
+  this->ref1 = ref1;					\
+}							\
+void *class_name_c::accept(visitor_c &visitor) {return visitor.visit(this);}
+
+
+#define SYM_REF2(class_name_c, ref1, ref2)		\
+class_name_c::class_name_c(symbol_c *ref1,		\
+			   symbol_c *ref2,		\
+			   int fl, int fc,		\
+			   int ll, int lc		\
+			  ): symbol_c(fl, fc, ll, lc) {	\
+  this->ref1 = ref1;					\
+  this->ref2 = ref2;					\
+}							\
+void *class_name_c::accept(visitor_c &visitor) {return visitor.visit(this);}
+
+
+#define SYM_REF3(class_name_c, ref1, ref2, ref3)	\
 class_name_c::class_name_c(symbol_c *ref1,		\
 			   symbol_c *ref2,		\
 			   symbol_c *ref3,		\
-			   symbol_c *ref4) {		\
+			   int fl, int fc,		\
+			   int ll, int lc		\
+			  ): symbol_c(fl, fc, ll, lc) {	\
+  this->ref1 = ref1;					\
+  this->ref2 = ref2;					\
+  this->ref3 = ref3;					\
+}							\
+void *class_name_c::accept(visitor_c &visitor) {return visitor.visit(this);}
+
+
+#define SYM_REF4(class_name_c, ref1, ref2, ref3, ref4)	\
+class_name_c::class_name_c(symbol_c *ref1,		\
+			   symbol_c *ref2,		\
+			   symbol_c *ref3,		\
+			   symbol_c *ref4,		\
+			   int fl, int fc,		\
+			   int ll, int lc		\
+			  ): symbol_c(fl, fc, ll, lc) {	\
   this->ref1 = ref1;					\
   this->ref2 = ref2;					\
   this->ref3 = ref3;					\
@@ -120,20 +187,42 @@
 void *class_name_c::accept(visitor_c &visitor) {return visitor.visit(this);}
 
 
+#define SYM_REF5(class_name_c, ref1, ref2, ref3, ref4, ref5)		\
+class_name_c::class_name_c(symbol_c *ref1,				\
+			   symbol_c *ref2,				\
+			   symbol_c *ref3,				\
+			   symbol_c *ref4,				\
+			   symbol_c *ref5,				\
+			   int fl, int fc,				\
+			   int ll, int lc				\
+			  ): symbol_c(fl, fc, ll, lc) {			\
+  this->ref1 = ref1;							\
+  this->ref2 = ref2;							\
+  this->ref3 = ref3;							\
+  this->ref4 = ref4;							\
+  this->ref5 = ref5;							\
+}									\
+void *class_name_c::accept(visitor_c &visitor) {return visitor.visit(this);}
+
+
+
 #define SYM_REF6(class_name_c, ref1, ref2, ref3, ref4, ref5, ref6)	\
 class_name_c::class_name_c(symbol_c *ref1,				\
 			   symbol_c *ref2,				\
 			   symbol_c *ref3,				\
 			   symbol_c *ref4,				\
 			   symbol_c *ref5,				\
-			   symbol_c *ref6) {				\
-  this->ref1 = ref1;						\
-  this->ref2 = ref2;						\
-  this->ref3 = ref3;						\
-  this->ref4 = ref4;						\
-  this->ref5 = ref5;						\
-  this->ref6 = ref6;						\
-}								\
+			   symbol_c *ref6,				\
+			   int fl, int fc,				\
+			   int ll, int lc				\
+			  ): symbol_c(fl, fc, ll, lc) {			\
+  this->ref1 = ref1;							\
+  this->ref2 = ref2;							\
+  this->ref3 = ref3;							\
+  this->ref4 = ref4;							\
+  this->ref5 = ref5;							\
+  this->ref6 = ref6;							\
+}									\
 void *class_name_c::accept(visitor_c &visitor) {return visitor.visit(this);}
 
 
@@ -147,8 +236,11 @@
 #undef SYM_TOKEN
 #undef SYM_TOKEN
 #undef SYM_REF0
+#undef SYM_REF1
 #undef SYM_REF2
+#undef SYM_REF3
 #undef SYM_REF4
+#undef SYM_REF5
 #undef SYM_REF6
 
 
--- a/absyntax/absyntax.def	Tue Oct 23 10:33:09 2007 +0200
+++ b/absyntax/absyntax.def	Tue Oct 23 10:35:58 2007 +0200
@@ -115,16 +115,16 @@
 SYM_REF2(hours_c, hours, minutes)
 SYM_REF2(minutes_c, minutes, seconds)
 SYM_REF2(seconds_c, seconds, milliseconds)
-SYM_REF2(milliseconds_c, milliseconds, unused)
+SYM_REF1(milliseconds_c, milliseconds)
 
 
 /************************************/
 /* B 1.2.3.2 - Time of day and Date */
 /************************************/
-SYM_REF2(time_of_day_c, daytime, unused)
-SYM_REF4(daytime_c, day_hour, day_minute, day_second, unused)
-SYM_REF2(date_c, date_literal, unused)
-SYM_REF4(date_literal_c, year, month, day, unused)
+SYM_REF1(time_of_day_c, daytime)
+SYM_REF3(daytime_c, day_hour, day_minute, day_second)
+SYM_REF1(date_c, date_literal)
+SYM_REF3(date_literal_c, year, month, day)
 SYM_REF2(date_and_time_c, date_literal, daytime)
 
 
@@ -167,7 +167,7 @@
 /* B 1.3.3 - Derived data types */
 /********************************/
 /*  TYPE type_declaration_list END_TYPE */
-SYM_REF2(data_type_declaration_c, type_declaration_list, unused)
+SYM_REF1(data_type_declaration_c, type_declaration_list)
 
 /* helper symbol for data_type_declaration */
 SYM_LIST(type_declaration_list_c)
@@ -320,7 +320,7 @@
 /*********************/
 /* B 1.4 - Variables */
 /*********************/
-SYM_REF2(symbolic_variable_c, var_name, unused)
+SYM_REF1(symbolic_variable_c, var_name)
 
 /********************************************/
 /* B.1.4.1   Directly Represented Variables */
@@ -381,7 +381,7 @@
 
 /* fb_name_list ':' function_block_type_name ASSIGN structure_initialization */
 /* structure_initialization -> may be NULL ! */
-SYM_REF4(fb_name_decl_c, fb_name_list, function_block_type_name, structure_initialization, unused)
+SYM_REF3(fb_name_decl_c, fb_name_list, function_block_type_name, structure_initialization)
 
 /* fb_name_list ',' fb_name */
 SYM_LIST(fb_name_list_c)
@@ -391,7 +391,7 @@
 SYM_REF2(output_declarations_c, option, var_init_decl_list)
 
 /*  VAR_IN_OUT var_declaration_list END_VAR */
-SYM_REF2(input_output_declarations_c, var_declaration_list, unused)
+SYM_REF1(input_output_declarations_c, var_declaration_list)
 
 /* helper symbol for input_output_declarations */
 /* var_declaration_list var_declaration ';' */
@@ -408,7 +408,7 @@
 SYM_REF2(var_declarations_c, option, var_init_decl_list)
 
 /*  VAR RETAIN var_init_decl_list END_VAR */
-SYM_REF2(retentive_var_declarations_c, var_init_decl_list, unused)
+SYM_REF1(retentive_var_declarations_c, var_init_decl_list)
 
 /*  VAR [CONSTANT|RETAIN|NON_RETAIN] located_var_decl_list END_VAR */
 /* option -> may be NULL ! */
@@ -420,7 +420,7 @@
 
 /*  [variable_name] location ':' located_var_spec_init */
 /* variable_name -> may be NULL ! */
-SYM_REF4(located_var_decl_c, variable_name, location, located_var_spec_init, unused)
+SYM_REF3(located_var_decl_c, variable_name, location, located_var_spec_init)
 
 /*| VAR_EXTERNAL [CONSTANT] external_declaration_list END_VAR */
 /* option -> may be NULL ! */
@@ -449,7 +449,7 @@
 SYM_REF2(global_var_spec_c, global_var_name, location)
 
 /*  AT direct_variable */
-SYM_REF2(location_c, direct_variable, unused)
+SYM_REF1(location_c, direct_variable)
 
 /*| global_var_list ',' global_var_name */
 SYM_LIST(global_var_list_c)
@@ -479,7 +479,7 @@
 SYM_LIST(incompl_located_var_decl_list_c)
 
 /*  variable_name incompl_location ':' var_spec */
-SYM_REF4(incompl_located_var_decl_c, variable_name, incompl_location, var_spec, unused)
+SYM_REF3(incompl_located_var_decl_c, variable_name, incompl_location, var_spec)
 
 /*  AT incompl_location_token */
 SYM_TOKEN(incompl_location_c)
@@ -519,7 +519,7 @@
 /* B 1.5.2 - Function Blocks */
 /*****************************/
 /*  FUNCTION_BLOCK derived_function_block_name io_OR_other_var_declarations function_block_body END_FUNCTION_BLOCK */
-SYM_REF4(function_block_declaration_c, fblock_name, var_declarations, fblock_body, unused)
+SYM_REF3(function_block_declaration_c, fblock_name, var_declarations, fblock_body)
 
 /* intermediate helper symbol for function_declaration */
 /*  { io_var_declarations | other_var_declarations }   */
@@ -528,20 +528,20 @@
  */
 
 /*  VAR_TEMP temp_var_decl_list END_VAR */
-SYM_REF2(temp_var_decls_c, var_decl_list, unused)
+SYM_REF1(temp_var_decls_c, var_decl_list)
 
 /* intermediate helper symbol for temp_var_decls */
 SYM_LIST(temp_var_decls_list_c)
 
 /*  VAR NON_RETAIN var_init_decl_list END_VAR */
-SYM_REF2(non_retentive_var_decls_c, var_decl_list, unused)
+SYM_REF1(non_retentive_var_decls_c, var_decl_list)
 
 
 /**********************/
 /* B 1.5.3 - Programs */
 /**********************/
 /*  PROGRAM program_type_name program_var_declarations_list function_block_body END_PROGRAM */
-SYM_REF4(program_declaration_c, program_type_name, var_declarations, function_block_body, unused)
+SYM_REF3(program_declaration_c, program_type_name, var_declarations, function_block_body)
 
 /* intermediate helper symbol for program_declaration_c */
 /*  { io_var_declarations | other_var_declarations }   */
@@ -563,7 +563,7 @@
 
 SYM_LIST(action_association_list_c)
 SYM_REF2(step_c, step_name, action_association_list)
-SYM_REF4(action_association_c, action_name, action_qualifier, indicator_name_list, unused)
+SYM_REF3(action_association_c, action_name, action_qualifier, indicator_name_list)
 
 SYM_TOKEN(qualifier_c)
 SYM_TOKEN(timed_qualifier_c)
@@ -592,7 +592,7 @@
    optional_instance_specific_initializations
 END_CONFIGURATION
 */
-SYM_REF6(configuration_declaration_c, configuration_name, global_var_declarations, resource_declarations, access_declarations, instance_specific_initializations, unused)
+SYM_REF5(configuration_declaration_c, configuration_name, global_var_declarations, resource_declarations, access_declarations, instance_specific_initializations)
 
 /* helper symbol for configuration_declaration */
 SYM_LIST(resource_declaration_list_c)
@@ -621,7 +621,7 @@
 SYM_LIST(any_fb_name_list_c)
 
 /*  [resource_name '.'] global_var_name ['.' structure_element_name] */
-SYM_REF4(global_var_reference_c, resource_name, global_var_name, structure_element_name, unused)
+SYM_REF3(global_var_reference_c, resource_name, global_var_name, structure_element_name)
 
 /*  prev_declared_program_name '.' symbolic_variable */
 SYM_REF2(program_output_reference_c, program_name, symbolic_variable)
@@ -630,10 +630,10 @@
 SYM_REF2(task_configuration_c, task_name, task_initialization)
 
 /*  '(' [SINGLE ASSIGN data_source ','] [INTERVAL ASSIGN data_source ','] PRIORITY ASSIGN integer ')' */
-SYM_REF4(task_initialization_c, single_data_source, interval_data_source, priority_data_source, unused)
+SYM_REF3(task_initialization_c, single_data_source, interval_data_source, priority_data_source)
 
 /*  PROGRAM [RETAIN | NON_RETAIN] program_name [WITH task_name] ':' program_type_name ['(' prog_conf_elements ')'] */
-SYM_REF6(program_configuration_c, retain_option, program_name, task_name, program_type_name, prog_conf_elements, unused)
+SYM_REF5(program_configuration_c, retain_option, program_name, task_name, program_type_name, prog_conf_elements)
 
 /* prog_conf_elements ',' prog_conf_element */
 SYM_LIST(prog_conf_elements_c)
@@ -648,7 +648,7 @@
 SYM_REF2(prog_cnxn_sendto_c, symbolic_variable, data_sink)
 
 /* VAR_CONFIG instance_specific_init_list END_VAR */
-SYM_REF2(instance_specific_initializations_c, instance_specific_init_list, unused)
+SYM_REF1(instance_specific_initializations_c, instance_specific_init_list)
 
 /* helper symbol for instance_specific_initializations */
 SYM_LIST(instance_specific_init_list_c)
@@ -685,7 +685,7 @@
 
 
 /* | il_expr_operator '(' [il_operand] eol_list [simple_instr_list] ')' */
-SYM_REF4(il_expression_c, il_expr_operator, il_operand, simple_instr_list, unused)
+SYM_REF3(il_expression_c, il_expr_operator, il_operand, simple_instr_list)
 
 /*  il_jump_operator label */
 SYM_REF2(il_jump_operation_c, il_jump_operator, label)
@@ -714,7 +714,7 @@
 /*  il_assign_operator il_operand
  * | il_assign_operator '(' eol_list simple_instr_list ')'
  */
-SYM_REF4(il_param_assignment_c, il_assign_operator, il_operand, simple_instr_list, unused)
+SYM_REF3(il_param_assignment_c, il_assign_operator, il_operand, simple_instr_list)
 
 /*  il_assign_out_operator variable */
 SYM_REF2(il_param_out_assignment_c, il_assign_out_operator, variable)
@@ -792,8 +792,8 @@
 SYM_REF2(div_expression_c, l_exp, r_exp)
 SYM_REF2(mod_expression_c, l_exp, r_exp)
 SYM_REF2(power_expression_c, l_exp, r_exp)
-SYM_REF2(neg_expression_c, exp, unused)
-SYM_REF2(not_expression_c, exp, unused)
+SYM_REF1(neg_expression_c, exp)
+SYM_REF1(not_expression_c, exp)
 
 SYM_REF2(function_invocation_c, function_name, parameter_assignment_list)
 
@@ -828,7 +828,7 @@
 SYM_REF2(input_variable_param_assignment_c, variable_name, expression)
 
 /* [NOT] variable_name '=>' variable */
-SYM_REF4(output_variable_param_assignment_c, not_param, variable_name, variable, unused)
+SYM_REF3(output_variable_param_assignment_c, not_param, variable_name, variable)
 
 /* helper CLASS for output_variable_param_assignment */
 SYM_REF0(not_paramassign_c)
@@ -848,7 +848,7 @@
 SYM_REF2(elseif_statement_c, expression, statement_list)
 
 /* CASE expression OF case_element_list ELSE statement_list END_CASE */
-SYM_REF4(case_statement_c, expression, case_element_list, statement_list, unused)
+SYM_REF3(case_statement_c, expression, case_element_list, statement_list)
 
 /* helper symbol for case_statement */
 SYM_LIST(case_element_list_c)
@@ -863,7 +863,7 @@
 /* B 3.2.4 Iteration Statements */
 /********************************/
 /*  FOR control_variable ASSIGN expression TO expression [BY expression] DO statement_list END_FOR */
-SYM_REF6(for_statement_c, control_variable, beg_expression, end_expression, by_expression, statement_list, unused)
+SYM_REF5(for_statement_c, control_variable, beg_expression, end_expression, by_expression, statement_list)
 
 /*  WHILE expression DO statement_list END_WHILE */
 SYM_REF2(while_statement_c, expression, statement_list)
--- a/absyntax/absyntax.hh	Tue Oct 23 10:33:09 2007 +0200
+++ b/absyntax/absyntax.hh	Tue Oct 23 10:35:58 2007 +0200
@@ -51,7 +51,6 @@
 
 
 class symbol_c; // forward declaration
-//extern symbol_c *tree_root;
 
 
 
@@ -62,12 +61,19 @@
     /*
      * Line number for the purposes of error checking
      */
-    long lineno;
+    int first_line;
+    int first_column;
+    int last_line;
+    int last_column;
 
   public:
     /* default constructor */
     symbol_c(void);
-    symbol_c(long lineno);
+    symbol_c(int fl     /* first_line   */, 
+             int fc     /* first_column */,
+             int ll = 0 /* last_line    */,
+             int lc = 0 /* last_column  */
+            );
 
     /* default destructor */
     /* must be virtual so compiler does not complain... */ 
@@ -83,7 +89,7 @@
     const char *value;
 
   public:
-    token_c(const char *value);
+    token_c(const char *value, int fl = 0, int fc = 0, int ll = 0, int lc = 0);
 };
 
 
@@ -94,8 +100,8 @@
     symbol_c **elements;
 
   public:
-    list_c(void);
-    list_c(symbol_c *elem);
+    list_c(int fl = 0, int fc = 0, int ll = 0, int lc = 0);
+    list_c(symbol_c *elem, int fl = 0, int fc = 0, int ll = 0, int lc = 0);
      /* insert a new element */
     virtual void add_element(symbol_c *elem);
 };
@@ -103,37 +109,71 @@
 
 
 
-#define SYM_LIST(class_name_c)			\
-class class_name_c:	public list_c {		\
-  public:					\
-    virtual void *accept(visitor_c &visitor);	\
-};
-
-
-#define SYM_TOKEN(class_name_c)			\
-class class_name_c: 	public token_c {	\
-  public:					\
-    class_name_c(const char *value);			\
-    virtual void *accept(visitor_c &visitor);	\
+#define SYM_LIST(class_name_c)								\
+class class_name_c:	public list_c {							\
+  public:										\
+    class_name_c(int fl = 0, int fc = 0, int ll = 0, int lc = 0);			\
+    class_name_c(symbol_c *elem, int fl = 0, int fc = 0, int ll = 0, int lc = 0);	\
+    virtual void *accept(visitor_c &visitor);						\
+};
+
+
+#define SYM_TOKEN(class_name_c)								\
+class class_name_c: 	public token_c {						\
+  public:										\
+    class_name_c(const char *value, int fl = 0, int fc = 0, int ll = 0, int lc = 0);	\
+    virtual void *accept(visitor_c &visitor);						\
 };
 
 
 #define SYM_REF0(class_name_c)			\
 class class_name_c: public symbol_c {		\
   public:					\
+    class_name_c(int fl = 0, int fc = 0, 	\
+		 int ll = 0, int lc = 0);	\
     virtual void *accept(visitor_c &visitor);	\
 };
 
 
-#define SYM_REF2(class_name_c, ref1, ref2)	\
-class class_name_c: public symbol_c {		\
-  public:					\
-    symbol_c *ref1;				\
-    symbol_c *ref2;				\
-  public:					\
-    class_name_c(symbol_c *ref1,		\
-		 symbol_c *ref2 = NULL);	\
-    virtual void *accept(visitor_c &visitor);	\
+#define SYM_REF1(class_name_c, ref1)			\
+class class_name_c: public symbol_c {			\
+  public:						\
+    symbol_c *ref1;					\
+  public:						\
+    class_name_c(symbol_c *ref1,			\
+		 int fl = 0, int fc = 0, 		\
+		 int ll = 0, int lc = 0);		\
+    virtual void *accept(visitor_c &visitor);		\
+};
+
+
+#define SYM_REF2(class_name_c, ref1, ref2)		\
+class class_name_c: public symbol_c {			\
+  public:						\
+    symbol_c *ref1;					\
+    symbol_c *ref2;					\
+  public:						\
+    class_name_c(symbol_c *ref1,			\
+		 symbol_c *ref2 = NULL,			\
+		 int fl = 0, int fc = 0, 		\
+		 int ll = 0, int lc = 0);		\
+    virtual void *accept(visitor_c &visitor);		\
+};
+
+
+#define SYM_REF3(class_name_c, ref1, ref2, ref3)	\
+class class_name_c: public symbol_c {			\
+  public:						\
+    symbol_c *ref1;					\
+    symbol_c *ref2;					\
+    symbol_c *ref3;					\
+  public:						\
+    class_name_c(symbol_c *ref1,			\
+		 symbol_c *ref2,			\
+		 symbol_c *ref3,			\
+		 int fl = 0, int fc = 0, 		\
+		 int ll = 0, int lc = 0);		\
+    virtual void *accept(visitor_c &visitor);		\
 };
 
 
@@ -148,8 +188,30 @@
     class_name_c(symbol_c *ref1,			\
 		 symbol_c *ref2,			\
 		 symbol_c *ref3,			\
-		 symbol_c *ref4 = NULL);		\
-    virtual void *accept(visitor_c &visitor);		\
+		 symbol_c *ref4 = NULL,			\
+		 int fl = 0, int fc = 0, 		\
+		 int ll = 0, int lc = 0);		\
+    virtual void *accept(visitor_c &visitor);		\
+};
+
+
+#define SYM_REF5(class_name_c, ref1, ref2, ref3, ref4, ref5)		\
+class class_name_c: public symbol_c {					\
+  public:								\
+    symbol_c *ref1;							\
+    symbol_c *ref2;							\
+    symbol_c *ref3;							\
+    symbol_c *ref4;							\
+    symbol_c *ref5;							\
+  public:								\
+    class_name_c(symbol_c *ref1,					\
+		 symbol_c *ref2,					\
+		 symbol_c *ref3,					\
+		 symbol_c *ref4,					\
+		 symbol_c *ref5,					\
+		 int fl = 0, int fc = 0, 				\
+		 int ll = 0, int lc = 0);				\
+    virtual void *accept(visitor_c &visitor);				\
 };
 
 
@@ -168,7 +230,9 @@
 		 symbol_c *ref3,					\
 		 symbol_c *ref4,					\
 		 symbol_c *ref5,					\
-		 symbol_c *ref6 = NULL);		\
+		 symbol_c *ref6 = NULL,					\
+		 int fl = 0, int fc = 0, 				\
+		 int ll = 0, int lc = 0);				\
     virtual void *accept(visitor_c &visitor);				\
 };
 
@@ -180,8 +244,11 @@
 #undef SYM_LIST
 #undef SYM_TOKEN
 #undef SYM_REF0
+#undef SYM_REF1
 #undef SYM_REF2
+#undef SYM_REF3
 #undef SYM_REF4
+#undef SYM_REF5
 #undef SYM_REF6
 
 
--- a/absyntax/visitor.cc	Tue Oct 23 10:33:09 2007 +0200
+++ b/absyntax/visitor.cc	Tue Oct 23 10:35:58 2007 +0200
@@ -72,12 +72,21 @@
 #define SYM_REF0(class_name_c)	\
   void *null_visitor_c::visit(class_name_c *symbol) {return NULL;}
 
+#define SYM_REF1(class_name_c, ref1)	\
+  void *null_visitor_c::visit(class_name_c *symbol) {return NULL;}
+
 #define SYM_REF2(class_name_c, ref1, ref2)	\
   void *null_visitor_c::visit(class_name_c *symbol) {return NULL;}
 
+#define SYM_REF3(class_name_c, ref1, ref2, ref3)	\
+  void *null_visitor_c::visit(class_name_c *symbol) {return NULL;}
+
 #define SYM_REF4(class_name_c, ref1, ref2, ref3, ref4)	\
   void *null_visitor_c::visit(class_name_c *symbol) {return NULL;}
 
+#define SYM_REF5(class_name_c, ref1, ref2, ref3, ref4, ref5)	\
+  void *null_visitor_c::visit(class_name_c *symbol) {return NULL;}
+
 #define SYM_REF6(class_name_c, ref1, ref2, ref3, ref4, ref5, ref6)	\
   void *null_visitor_c::visit(class_name_c *symbol) {return NULL;}
 
@@ -90,8 +99,11 @@
 #undef SYM_LIST
 #undef SYM_TOKEN
 #undef SYM_REF0
+#undef SYM_REF1
 #undef SYM_REF2
+#undef SYM_REF3
 #undef SYM_REF4
+#undef SYM_REF5
 #undef SYM_REF6
 
 
@@ -123,6 +135,12 @@
 #define SYM_REF0(class_name_c)	\
   void *iterator_visitor_c::visit(class_name_c *symbol) {return NULL;}
 
+#define SYM_REF1(class_name_c, ref1)			\
+void *iterator_visitor_c::visit(class_name_c *symbol) {	\
+  if (symbol->ref1!=NULL) symbol->ref1->accept(*this);	\
+  return NULL;						\
+}
+
 #define SYM_REF2(class_name_c, ref1, ref2)		\
 void *iterator_visitor_c::visit(class_name_c *symbol) {	\
   if (symbol->ref1!=NULL) symbol->ref1->accept(*this);	\
@@ -130,6 +148,14 @@
   return NULL;						\
 }
 
+#define SYM_REF3(class_name_c, ref1, ref2, ref3)	\
+void *iterator_visitor_c::visit(class_name_c *symbol) {	\
+  if (symbol->ref1) symbol->ref1->accept(*this);	\
+  if (symbol->ref2) symbol->ref2->accept(*this);	\
+  if (symbol->ref3) symbol->ref3->accept(*this);	\
+  return NULL;						\
+}
+
 #define SYM_REF4(class_name_c, ref1, ref2, ref3, ref4)	\
 void *iterator_visitor_c::visit(class_name_c *symbol) {	\
   if (symbol->ref1) symbol->ref1->accept(*this);	\
@@ -139,6 +165,15 @@
   return NULL;						\
 }
 
+#define SYM_REF5(class_name_c, ref1, ref2, ref3, ref4, ref5)		\
+void *iterator_visitor_c::visit(class_name_c *symbol) {			\
+  if (symbol->ref1) symbol->ref1->accept(*this);			\
+  if (symbol->ref2) symbol->ref2->accept(*this);			\
+  if (symbol->ref3) symbol->ref3->accept(*this);			\
+  if (symbol->ref4) symbol->ref4->accept(*this);			\
+  if (symbol->ref5) symbol->ref5->accept(*this);			\
+  return NULL;								\
+}
 
 #define SYM_REF6(class_name_c, ref1, ref2, ref3, ref4, ref5, ref6)	\
 void *iterator_visitor_c::visit(class_name_c *symbol) {			\
@@ -160,8 +195,11 @@
 #undef SYM_LIST
 #undef SYM_TOKEN
 #undef SYM_REF0
+#undef SYM_REF1
 #undef SYM_REF2
+#undef SYM_REF3
 #undef SYM_REF4
+#undef SYM_REF5
 #undef SYM_REF6
 
 
@@ -199,6 +237,12 @@
 #define SYM_REF0(class_name_c)	\
   void *search_visitor_c::visit(class_name_c *symbol) {return NULL;}
 
+#define SYM_REF1(class_name_c, ref1)				\
+void *search_visitor_c::visit(class_name_c *symbol) {		\
+  if (symbol->ref1) return symbol->ref1->accept(*this);		\
+  return NULL;							\
+}
+
 #define SYM_REF2(class_name_c, ref1, ref2)			\
 void *search_visitor_c::visit(class_name_c *symbol) {		\
   void *res = NULL;						\
@@ -208,6 +252,17 @@
   return NULL;							\
 }
 
+#define SYM_REF3(class_name_c, ref1, ref2, ref3)		\
+void *search_visitor_c::visit(class_name_c *symbol) {		\
+  void *res = NULL;						\
+  if (symbol->ref1) res =  symbol->ref1->accept(*this);		\
+  if (res != NULL)  return res;					\
+  if (symbol->ref2) res =  symbol->ref2->accept(*this);		\
+  if (res != NULL)  return res;					\
+  if (symbol->ref3) return symbol->ref3->accept(*this);		\
+  return NULL;							\
+}
+
 #define SYM_REF4(class_name_c, ref1, ref2, ref3, ref4)		\
 void *search_visitor_c::visit(class_name_c *symbol) {		\
   void *res = NULL;						\
@@ -221,6 +276,20 @@
   return NULL;							\
 }
 
+#define SYM_REF5(class_name_c, ref1, ref2, ref3, ref4, ref5)		\
+void *search_visitor_c::visit(class_name_c *symbol) {			\
+  void *res = NULL;							\
+  if (symbol->ref1) res =  symbol->ref1->accept(*this);			\
+  if (res != NULL)  return res;						\
+  if (symbol->ref2) res =  symbol->ref2->accept(*this);			\
+  if (res != NULL)  return res;						\
+  if (symbol->ref3) res =  symbol->ref3->accept(*this);			\
+  if (res != NULL)  return res;						\
+  if (symbol->ref4) res =  symbol->ref4->accept(*this);			\
+  if (res != NULL)  return res;						\
+  if (symbol->ref5) return symbol->ref5->accept(*this);			\
+  return NULL;								\
+}
 
 #define SYM_REF6(class_name_c, ref1, ref2, ref3, ref4, ref5, ref6)	\
 void *search_visitor_c::visit(class_name_c *symbol) {			\
@@ -248,8 +317,11 @@
 #undef SYM_LIST
 #undef SYM_TOKEN
 #undef SYM_REF0
+#undef SYM_REF1
 #undef SYM_REF2
+#undef SYM_REF3
 #undef SYM_REF4
+#undef SYM_REF5
 #undef SYM_REF6
 
 
--- a/absyntax/visitor.hh	Tue Oct 23 10:33:09 2007 +0200
+++ b/absyntax/visitor.hh	Tue Oct 23 10:35:58 2007 +0200
@@ -80,12 +80,21 @@
 #define SYM_REF0(class_name_c)	\
   virtual void *visit(class_name_c *symbol) = 0;
 
+#define SYM_REF1(class_name_c, ref1)		\
+  virtual void *visit(class_name_c *symbol) = 0;
+
 #define SYM_REF2(class_name_c, ref1, ref2)	\
   virtual void *visit(class_name_c *symbol) = 0;
 
+#define SYM_REF3(class_name_c, ref1, ref2, ref3)	\
+  virtual void *visit(class_name_c *symbol) = 0;
+
 #define SYM_REF4(class_name_c, ref1, ref2, ref3, ref4)	\
   virtual void *visit(class_name_c *symbol) = 0;
 
+#define SYM_REF5(class_name_c, ref1, ref2, ref3, ref4, ref5)		\
+  virtual void *visit(class_name_c *symbol) = 0;
+
 #define SYM_REF6(class_name_c, ref1, ref2, ref3, ref4, ref5, ref6)	\
   virtual void *visit(class_name_c *symbol) = 0;
 
@@ -99,8 +108,11 @@
 #undef SYM_LIST
 #undef SYM_TOKEN
 #undef SYM_REF0
+#undef SYM_REF1
 #undef SYM_REF2
+#undef SYM_REF3
 #undef SYM_REF4
+#undef SYM_REF5
 #undef SYM_REF6
 
 
@@ -117,12 +129,21 @@
 #define SYM_REF0(class_name_c)	\
   virtual void *visit(class_name_c *symbol);
 
+#define SYM_REF1(class_name_c, ref1)		\
+  virtual void *visit(class_name_c *symbol);
+
 #define SYM_REF2(class_name_c, ref1, ref2)	\
   virtual void *visit(class_name_c *symbol);
 
+#define SYM_REF3(class_name_c, ref1, ref2, ref3)	\
+  virtual void *visit(class_name_c *symbol);
+
 #define SYM_REF4(class_name_c, ref1, ref2, ref3, ref4)	\
   virtual void *visit(class_name_c *symbol);
 
+#define SYM_REF5(class_name_c, ref1, ref2, ref3, ref4, ref5)		\
+  virtual void *visit(class_name_c *symbol);
+
 #define SYM_REF6(class_name_c, ref1, ref2, ref3, ref4, ref5, ref6)	\
   virtual void *visit(class_name_c *symbol);
 
@@ -164,8 +185,11 @@
 #undef SYM_LIST
 #undef SYM_TOKEN
 #undef SYM_REF0
+#undef SYM_REF1
 #undef SYM_REF2
+#undef SYM_REF3
 #undef SYM_REF4
+#undef SYM_REF5
 #undef SYM_REF6
 
 #endif /*  _VISITOR_HH */
--- a/stage4/generate_cc/generate_cc.cc	Tue Oct 23 10:33:09 2007 +0200
+++ b/stage4/generate_cc/generate_cc.cc	Tue Oct 23 10:35:58 2007 +0200
@@ -78,11 +78,11 @@
 dsymtable_c<function_declaration_c *, &null_symbol1> function_symtable;
 
 /* A symbol table with all globally declared functions block types... */
-function_block_declaration_c null_symbol2(NULL,NULL,NULL,NULL);
+function_block_declaration_c null_symbol2(NULL,NULL,NULL);
 symtable_c<function_block_declaration_c *, &null_symbol2> function_block_type_symtable;
 
 /* A symbol table with all globally declared program types... */
-program_declaration_c null_symbol3(NULL,NULL,NULL,NULL);
+program_declaration_c null_symbol3(NULL,NULL,NULL);
 symtable_c<program_declaration_c *, &null_symbol3> program_type_symtable;
 
 /* A symbol table with all user declared type definitions... */
--- a/stage4/generate_cc/generate_cc_il.cc	Tue Oct 23 10:33:09 2007 +0200
+++ b/stage4/generate_cc/generate_cc_il.cc	Tue Oct 23 10:35:58 2007 +0200
@@ -379,8 +379,8 @@
 
       identifier_c param(param_name);
 
-      //SYM_REF4(il_param_assignment_c, il_assign_operator, il_operand, simple_instr_list, unused)
-      il_param_assignment_c il_param_assignment(&param, &this->default_variable_name, NULL, NULL);
+      //SYM_REF3(il_param_assignment_c, il_assign_operator, il_operand, simple_instr_list)
+      il_param_assignment_c il_param_assignment(&param, &this->default_variable_name, NULL);
       // SYM_LIST(il_param_list_c)
       il_param_list_c il_param_list;
       il_param_list.add_element(&il_param_assignment);