stage1_2/iec.y
changeset 74 85af9521bf63
parent 73 0e623bbdee95
child 75 0e381bdb8888
equal deleted inserted replaced
73:0e623bbdee95 74:85af9521bf63
   208 /*****************************/
   208 /*****************************/
   209 /* A token used to identify the very end of the input file
   209 /* A token used to identify the very end of the input file
   210  * after all includes have already been processed.
   210  * after all includes have already been processed.
   211  *
   211  *
   212  * Flex automatically returns the token with value 0
   212  * Flex automatically returns the token with value 0
   213  * at the end of the file. We therefore specify
   213  * at the end of the file. We therefore specify here
   214  * a token with that exact same value here.
   214  * a token with that exact same value here, so we can use it
       
   215  * to detect the very end of the input files.
   215  */
   216  */
   216 %token END_OF_INPUT 0
   217 %token END_OF_INPUT 0
   217 
   218 
   218 /* A bogus token that, in principle, flex MUST NEVER generate */
   219 /* A bogus token that, in principle, flex MUST NEVER generate */
   219 /* USE 1:
   220 /* USE 1:
   910 %type  <leaf>	program_name
   911 %type  <leaf>	program_name
   911 // %type  <leaf>	direction
   912 // %type  <leaf>	direction
   912 %type  <leaf>	task_configuration
   913 %type  <leaf>	task_configuration
   913 %type  <leaf>	task_name
   914 %type  <leaf>	task_name
   914 %type  <leaf>	task_initialization
   915 %type  <leaf>	task_initialization
       
   916 // 3 helper symbols for task_initialization
       
   917 %type  <leaf>	task_initialization_single 	
       
   918 %type  <leaf>	task_initialization_interval	
       
   919 %type  <leaf>	task_initialization_priority	
       
   920 
   915 %type  <leaf>	data_source
   921 %type  <leaf>	data_source
   916 %type  <leaf>	program_configuration
   922 %type  <leaf>	program_configuration
   917 // helper symbol for program_configuration
   923 // helper symbol for program_configuration
   918 %type  <leaf>	optional_task_name
   924 %type  <leaf>	optional_task_name
   919 // helper symbol for program_configuration
   925 // helper symbol for program_configuration
  4138  *       If in the future our interpretation of the spec. turns out to be incorrect,
  4144  *       If in the future our interpretation of the spec. turns out to be incorrect,
  4139  *       the definition of task_name may have to be changed!
  4145  *       the definition of task_name may have to be changed!
  4140  */
  4146  */
  4141 task_name: any_identifier;
  4147 task_name: any_identifier;
  4142 
  4148 
       
  4149 
  4143 task_initialization:
  4150 task_initialization:
  4144 //  '(' [SINGLE ASSIGN data_source ','] [INTERVAL ASSIGN data_source ','] PRIORITY ASSIGN integer ')' //
  4151 //  '(' [SINGLE ASSIGN data_source ','] [INTERVAL ASSIGN data_source ','] PRIORITY ASSIGN integer ')' //
  4145   '(' PRIORITY ASSIGN integer ')'
  4152   '(' task_initialization_single task_initialization_interval task_initialization_priority ')'
  4146 	{$$ = new task_initialization_c(NULL, NULL, $4, locloc(@$));}
  4153 	{$$ = new task_initialization_c($2, $3, $4, locloc(@$));}
  4147 | '(' SINGLE ASSIGN data_source ','   PRIORITY ASSIGN integer ')'
  4154 ;
  4148 	{$$ = new task_initialization_c($4, NULL, $8, locloc(@$));}
  4155 
  4149 | '(' INTERVAL ASSIGN data_source ',' PRIORITY ASSIGN integer ')'
  4156 
  4150 	{$$ = new task_initialization_c(NULL, $4, $8, locloc(@$));}
  4157 task_initialization_single:
  4151 | '(' SINGLE ASSIGN data_source ',' INTERVAL ASSIGN data_source ',' PRIORITY ASSIGN integer ')'
  4158 // [SINGLE ASSIGN data_source ',']
  4152 	{$$ = new task_initialization_c($4, $8, $12, locloc(@$));}
  4159   /* empty */
  4153 ;
  4160 	{$$ = NULL;}
       
  4161 | {cmd_goto_task_init_state();} SINGLE ASSIGN {cmd_pop_state();} data_source ','
       
  4162 	{$$ = $5;}
       
  4163 ;
       
  4164 
       
  4165 
       
  4166 task_initialization_interval:
       
  4167 // [INTERVAL ASSIGN data_source ','] 
       
  4168   /* empty */
       
  4169 	{$$ = NULL;}
       
  4170 | {cmd_goto_task_init_state();} INTERVAL ASSIGN {cmd_pop_state();} data_source ','
       
  4171 	{$$ = $5;}
       
  4172 ;
       
  4173 
       
  4174 
       
  4175 task_initialization_priority:
       
  4176 // PRIORITY ASSIGN integer
       
  4177 {cmd_goto_task_init_state();} PRIORITY ASSIGN {cmd_pop_state();} integer
       
  4178 	{$$ = $5;}
       
  4179 ;
       
  4180 
       
  4181 
       
  4182 /*
       
  4183 task_initialization:
       
  4184 //  '(' [SINGLE ASSIGN data_source ','] [INTERVAL ASSIGN data_source ','] PRIORITY ASSIGN integer ')' //
       
  4185   '(' {cmd_goto_task_init_state();} PRIORITY ASSIGN {cmd_pop_state();} integer ')'
       
  4186 	{$$ = new task_initialization_c(NULL, NULL, $6, locloc(@$));}
       
  4187 | '(' {cmd_goto_task_init_state();} SINGLE ASSIGN {cmd_pop_state();} data_source ','
       
  4188                                     PRIORITY ASSIGN integer ')'
       
  4189 	{$$ = new task_initialization_c($6, NULL, $10, locloc(@$));}
       
  4190 | '(' {cmd_goto_task_init_state();} INTERVAL ASSIGN {cmd_pop_state();} data_source ',' PRIORITY ASSIGN integer ')'
       
  4191 	{$$ = new task_initialization_c(NULL, $6, $10, locloc(@$));}
       
  4192 | '(' {cmd_goto_task_init_state();} SINGLE ASSIGN {cmd_pop_state();} data_source ',' INTERVAL ASSIGN data_source ',' PRIORITY ASSIGN integer ')'
       
  4193 	{$$ = new task_initialization_c($6, $10, $14, locloc(@$));}
       
  4194 ;
       
  4195 */
       
  4196 
  4154 
  4197 
  4155 data_source:
  4198 data_source:
  4156   constant
  4199   constant
  4157 | global_var_reference
  4200 | global_var_reference
  4158 | program_output_reference
  4201 | program_output_reference