stage1_2/iec.y
changeset 89 5b2ec5c057fa
parent 88 dab799d3d4a6
child 90 dc6df1511570
equal deleted inserted replaced
88:dab799d3d4a6 89:5b2ec5c057fa
   173     list_c	*list;
   173     list_c	*list;
   174     char 	*ID;	/* token value */
   174     char 	*ID;	/* token value */
   175     struct {
   175     struct {
   176       symbol_c	*first;
   176       symbol_c	*first;
   177       symbol_c	*second;
   177       symbol_c	*second;
   178       symbol_c	*third;
       
   179       symbol_c	*fourth;
       
   180     } tmp_symbol; /* used as a temorary reference to symbols by:
   178     } tmp_symbol; /* used as a temorary reference to symbols by:
   181                                      il_simple_operator_clash_il_operand
   179                                      il_simple_operator_clash_il_operand
   182                                      transaction_tmp
       
   183                                      action_tmp
       
   184                              */
   180                              */
   185 }
   181 }
   186 
   182 
   187 /*
   183 /*
   188  TODO: DO we need to define a destructor do free
   184  TODO: DO we need to define a destructor do free
  4374  *         | il_simple_operator
  4370  *         | il_simple_operator
  4375  *       already contains the 'NOT' operator, as well as all the
  4371  *       already contains the 'NOT' operator, as well as all the
  4376  *       expression operators ('MOD', 'AND', etc...), all of which
  4372  *       expression operators ('MOD', 'AND', etc...), all of which
  4377  *       may also be a function name! This means that these operators/functions,
  4373  *       may also be a function name! This means that these operators/functions,
  4378  *       without any operands, could be reduced to either an operator or a
  4374  *       without any operands, could be reduced to either an operator or a
  4379  *       function call. I (Mario) have chosen to reduce it to an operator.
  4375  *       function call. 
  4380  *
  4376  *
       
  4377  *       I (Mario) have chosen to reduce it to an operator.
  4381  *       In order to do this, we must remove from the syntax that defines
  4378  *       In order to do this, we must remove from the syntax that defines
  4382  *       function calls all the functions whose names clash with the IL operators.
  4379  *       function calls all the functions whose names clash with the IL operators.
  4383  *
  4380  *
  4384  *       The line
  4381  *       The line
  4385  *         | function_name
  4382  *         | function_name
  4395  *       already contains the 'NOT', 'MOD', etc. operators, followed by a single il_operand.
  4392  *       already contains the 'NOT', 'MOD', etc. operators, followed by a single il_operand.
  4396  *       However, this same code (MOD x) may also be reduced to a function call to the MOD
  4393  *       However, this same code (MOD x) may also be reduced to a function call to the MOD
  4397  *       function. This means that (MOD, AND,...) could be interpret as a function name
  4394  *       function. This means that (MOD, AND,...) could be interpret as a function name
  4398  *       or as an IL operator! This would lead us to a reduce/reduce conflict!
  4395  *       or as an IL operator! This would lead us to a reduce/reduce conflict!
  4399  *
  4396  *
       
  4397  *       I (Mario) have chosen to reduce it to an operand, rather than a function call.
  4400  *       In order to do this, we must remove from the syntax that defines
  4398  *       In order to do this, we must remove from the syntax that defines
  4401  *       function calls all the functions whose names clash with the IL operators.
  4399  *       function calls all the functions whose names clash with the IL operators.
  4402  *
       
  4403  *       I (Mario) have chosen to reduce it to an operand, rather than a function call.
       
  4404  *
  4400  *
  4405  *       The line
  4401  *       The line
  4406  *         | function_name il_operand_list
  4402  *         | function_name il_operand_list
  4407  *       has been replaced with the line
  4403  *       has been replaced with the line
  4408  *         | function_name_no_clashes il_operand_list
  4404  *         | function_name_no_clashes il_operand_list
  4554   il_expr_operator_clash '(' eol_list
  4550   il_expr_operator_clash '(' eol_list
  4555 	{$$ = $1;}
  4551 	{$$ = $1;}
  4556 ;
  4552 ;
  4557 
  4553 
  4558 
  4554 
  4559 /* NOTE: We use enumerated_value_without_identifier instead of enumerated_value
       
  4560  *       in order to remove a reduce/reduce conflict between reducing an
       
  4561  *       identifier to a variable or an enumerated_value.
       
  4562  */
       
  4563 il_operand:
  4555 il_operand:
  4564   variable
  4556   variable
  4565 //| enumerated_value_without_identifier
       
  4566 | enumerated_value
  4557 | enumerated_value
  4567 | constant
  4558 | constant
  4568 ;
  4559 ;
  4569 
  4560 
  4570 
  4561