1/* 2 * -*- tcl -*- 3 * Parsing Expression Grammar 'TEMPLATE'. 4 * Generated for unknown, from file 'TEST' 5 */ 6 7/* 8 * Declaring the parse functions 9 */ 10 11<<attributes>> void <<ns>>sym_AddOp (<<STATE>> <<state>>); 12<<attributes>> void <<ns>>sym_Digit (<<STATE>> <<state>>); 13<<attributes>> void <<ns>>sequence_10 (<<STATE>> <<state>>); 14<<attributes>> void <<ns>>sequence_15 (<<STATE>> <<state>>); 15<<attributes>> void <<ns>>kleene_17 (<<STATE>> <<state>>); 16<<attributes>> void <<ns>>sequence_19 (<<STATE>> <<state>>); 17<<attributes>> void <<ns>>choice_21 (<<STATE>> <<state>>); 18<<attributes>> void <<ns>>sym_Expression (<<STATE>> <<state>>); 19<<attributes>> void <<ns>>sequence_27 (<<STATE>> <<state>>); 20<<attributes>> void <<ns>>kleene_29 (<<STATE>> <<state>>); 21<<attributes>> void <<ns>>sequence_31 (<<STATE>> <<state>>); 22<<attributes>> void <<ns>>sym_Factor (<<STATE>> <<state>>); 23<<attributes>> void <<ns>>sym_Function (<<STATE>> <<state>>); 24<<attributes>> void <<ns>>sym_MulOp (<<STATE>> <<state>>); 25<<attributes>> void <<ns>>optional_39 (<<STATE>> <<state>>); 26<<attributes>> void <<ns>>poskleene_42 (<<STATE>> <<state>>); 27<<attributes>> void <<ns>>sequence_44 (<<STATE>> <<state>>); 28<<attributes>> void <<ns>>sym_Number (<<STATE>> <<state>>); 29<<attributes>> void <<ns>>sym_Sign (<<STATE>> <<state>>); 30<<attributes>> void <<ns>>sequence_52 (<<STATE>> <<state>>); 31<<attributes>> void <<ns>>sym_Sinus (<<STATE>> <<state>>); 32<<attributes>> void <<ns>>sym_Term (<<STATE>> <<state>>); 33 34/* 35 * Precomputed table of strings (symbols, error messages, etc.). 36 */ 37 38static char const* <<string-table>> [26] = { 39 /* 0 = */ "cl '-+'", 40 /* 1 = */ "n AddOp", 41 /* 2 = */ "AddOp", 42 /* 3 = */ "cl '0123456789'", 43 /* 4 = */ "n Digit", 44 /* 5 = */ "Digit", 45 /* 6 = */ "t \50", 46 /* 7 = */ "t \51", 47 /* 8 = */ "n Expression", 48 /* 9 = */ "Expression", 49 /* 10 = */ "n Factor", 50 /* 11 = */ "Factor", 51 /* 12 = */ "n Function", 52 /* 13 = */ "Function", 53 /* 14 = */ "cl '*/'", 54 /* 15 = */ "n MulOp", 55 /* 16 = */ "MulOp", 56 /* 17 = */ "n Number", 57 /* 18 = */ "Number", 58 /* 19 = */ "n Sign", 59 /* 20 = */ "Sign", 60 /* 21 = */ "str 'sin\50'", 61 /* 22 = */ "n Sinus", 62 /* 23 = */ "Sinus", 63 /* 24 = */ "n Term", 64 /* 25 = */ "Term" 65}; 66 67/* 68 * Grammar Start Expression 69 */ 70 71<<attributes>> void <<ns>><<main>> (<<STATE>> <<state>>) { <<prelude>> 72 <<self>> <<ns>>sym_Expression (<<state>>); 73 return; 74} 75 76/* 77 * value Symbol 'AddOp' 78 */ 79 80<<attributes>> void <<ns>>sym_AddOp (<<STATE>> <<state>>) { <<prelude>> 81 /* 82 * [-+] 83 */ 84 85 if (rde_param_i_symbol_start (<<state>>, 2)) return ; 86 rde_param_i_next_class (<<state>>, "-+", 0); 87 rde_param_i_symbol_done_leaf (<<state>>, 2, 1); 88 return; 89} 90 91/* 92 * value Symbol 'Digit' 93 */ 94 95<<attributes>> void <<ns>>sym_Digit (<<STATE>> <<state>>) { <<prelude>> 96 /* 97 * [0123456789] 98 */ 99 100 if (rde_param_i_symbol_start (<<state>>, 5)) return ; 101 rde_param_i_next_class (<<state>>, "0123456789", 3); 102 rde_param_i_symbol_done_leaf (<<state>>, 5, 4); 103 return; 104} 105 106/* 107 * value Symbol 'Expression' 108 */ 109 110<<attributes>> void <<ns>>sym_Expression (<<STATE>> <<state>>) { <<prelude>> 111 /* 112 * / 113 * (Function) 114 * x 115 * '\(' 116 * (Expression) 117 * '\)' 118 * x 119 * (Factor) 120 * * 121 * x 122 * (MulOp) 123 * (Factor) 124 */ 125 126 if (rde_param_i_symbol_start_d (<<state>>, 9)) return ; 127 <<self>> <<ns>>choice_21 (<<state>>); 128 rde_param_i_symbol_done_d_reduce (<<state>>, 9, 8); 129 return; 130} 131 132<<attributes>> void <<ns>>choice_21 (<<STATE>> <<state>>) { <<prelude>> 133 /* 134 * / 135 * (Function) 136 * x 137 * '\(' 138 * (Expression) 139 * '\)' 140 * x 141 * (Factor) 142 * * 143 * x 144 * (MulOp) 145 * (Factor) 146 */ 147 148 rde_param_i_state_push_value (<<state>>); 149 <<self>> <<ns>>sym_Function (<<state>>); 150 if (rde_param_i_bra_value2value(<<state>>)) return; 151 <<self>> <<ns>>sequence_10 (<<state>>); 152 if (rde_param_i_bra_value2value(<<state>>)) return; 153 <<self>> <<ns>>sequence_19 (<<state>>); 154 rde_param_i_state_merge_value (<<state>>); 155 return; 156} 157 158<<attributes>> void <<ns>>sequence_10 (<<STATE>> <<state>>) { <<prelude>> 159 /* 160 * x 161 * '\(' 162 * (Expression) 163 * '\)' 164 */ 165 166 rde_param_i_state_push_void (<<state>>); 167 rde_param_i_next_char (<<state>>, "\50", 6); 168 if (rde_param_i_seq_void2value(<<state>>)) return; 169 <<self>> <<ns>>sym_Expression (<<state>>); 170 if (rde_param_i_seq_value2value(<<state>>)) return; 171 rde_param_i_next_char (<<state>>, "\51", 7); 172 rde_param_i_state_merge_value (<<state>>); 173 return; 174} 175 176<<attributes>> void <<ns>>sequence_19 (<<STATE>> <<state>>) { <<prelude>> 177 /* 178 * x 179 * (Factor) 180 * * 181 * x 182 * (MulOp) 183 * (Factor) 184 */ 185 186 rde_param_i_state_push_value (<<state>>); 187 <<self>> <<ns>>sym_Factor (<<state>>); 188 if (rde_param_i_seq_value2value(<<state>>)) return; 189 <<self>> <<ns>>kleene_17 (<<state>>); 190 rde_param_i_state_merge_value (<<state>>); 191 return; 192} 193 194<<attributes>> void <<ns>>kleene_17 (<<STATE>> <<state>>) { <<prelude>> 195 /* 196 * * 197 * x 198 * (MulOp) 199 * (Factor) 200 */ 201 202 while (1) { 203 rde_param_i_state_push_2 (<<state>>); 204 <<self>> <<ns>>sequence_15 (<<state>>); 205 if (rde_param_i_kleene_close(<<state>>)) return; 206 } 207 return; 208} 209 210<<attributes>> void <<ns>>sequence_15 (<<STATE>> <<state>>) { <<prelude>> 211 /* 212 * x 213 * (MulOp) 214 * (Factor) 215 */ 216 217 rde_param_i_state_push_value (<<state>>); 218 <<self>> <<ns>>sym_MulOp (<<state>>); 219 if (rde_param_i_seq_value2value(<<state>>)) return; 220 <<self>> <<ns>>sym_Factor (<<state>>); 221 rde_param_i_state_merge_value (<<state>>); 222 return; 223} 224 225/* 226 * value Symbol 'Factor' 227 */ 228 229<<attributes>> void <<ns>>sym_Factor (<<STATE>> <<state>>) { <<prelude>> 230 /* 231 * x 232 * (Term) 233 * * 234 * x 235 * (AddOp) 236 * (Term) 237 */ 238 239 if (rde_param_i_symbol_start_d (<<state>>, 11)) return ; 240 <<self>> <<ns>>sequence_31 (<<state>>); 241 rde_param_i_symbol_done_d_reduce (<<state>>, 11, 10); 242 return; 243} 244 245<<attributes>> void <<ns>>sequence_31 (<<STATE>> <<state>>) { <<prelude>> 246 /* 247 * x 248 * (Term) 249 * * 250 * x 251 * (AddOp) 252 * (Term) 253 */ 254 255 rde_param_i_state_push_value (<<state>>); 256 <<self>> <<ns>>sym_Term (<<state>>); 257 if (rde_param_i_seq_value2value(<<state>>)) return; 258 <<self>> <<ns>>kleene_29 (<<state>>); 259 rde_param_i_state_merge_value (<<state>>); 260 return; 261} 262 263<<attributes>> void <<ns>>kleene_29 (<<STATE>> <<state>>) { <<prelude>> 264 /* 265 * * 266 * x 267 * (AddOp) 268 * (Term) 269 */ 270 271 while (1) { 272 rde_param_i_state_push_2 (<<state>>); 273 <<self>> <<ns>>sequence_27 (<<state>>); 274 if (rde_param_i_kleene_close(<<state>>)) return; 275 } 276 return; 277} 278 279<<attributes>> void <<ns>>sequence_27 (<<STATE>> <<state>>) { <<prelude>> 280 /* 281 * x 282 * (AddOp) 283 * (Term) 284 */ 285 286 rde_param_i_state_push_value (<<state>>); 287 <<self>> <<ns>>sym_AddOp (<<state>>); 288 if (rde_param_i_seq_value2value(<<state>>)) return; 289 <<self>> <<ns>>sym_Term (<<state>>); 290 rde_param_i_state_merge_value (<<state>>); 291 return; 292} 293 294/* 295 * value Symbol 'Function' 296 */ 297 298<<attributes>> void <<ns>>sym_Function (<<STATE>> <<state>>) { <<prelude>> 299 /* 300 * (Sinus) 301 */ 302 303 if (rde_param_i_symbol_start_d (<<state>>, 13)) return ; 304 <<self>> <<ns>>sym_Sinus (<<state>>); 305 rde_param_i_symbol_done_d_reduce (<<state>>, 13, 12); 306 return; 307} 308 309/* 310 * value Symbol 'MulOp' 311 */ 312 313<<attributes>> void <<ns>>sym_MulOp (<<STATE>> <<state>>) { <<prelude>> 314 /* 315 * [*/] 316 */ 317 318 if (rde_param_i_symbol_start (<<state>>, 16)) return ; 319 rde_param_i_next_class (<<state>>, "*/", 14); 320 rde_param_i_symbol_done_leaf (<<state>>, 16, 15); 321 return; 322} 323 324/* 325 * value Symbol 'Number' 326 */ 327 328<<attributes>> void <<ns>>sym_Number (<<STATE>> <<state>>) { <<prelude>> 329 /* 330 * x 331 * ? 332 * (Sign) 333 * + 334 * (Digit) 335 */ 336 337 if (rde_param_i_symbol_start_d (<<state>>, 18)) return ; 338 <<self>> <<ns>>sequence_44 (<<state>>); 339 rde_param_i_symbol_done_d_reduce (<<state>>, 18, 17); 340 return; 341} 342 343<<attributes>> void <<ns>>sequence_44 (<<STATE>> <<state>>) { <<prelude>> 344 /* 345 * x 346 * ? 347 * (Sign) 348 * + 349 * (Digit) 350 */ 351 352 rde_param_i_state_push_value (<<state>>); 353 <<self>> <<ns>>optional_39 (<<state>>); 354 if (rde_param_i_seq_value2value(<<state>>)) return; 355 <<self>> <<ns>>poskleene_42 (<<state>>); 356 rde_param_i_state_merge_value (<<state>>); 357 return; 358} 359 360<<attributes>> void <<ns>>optional_39 (<<STATE>> <<state>>) { <<prelude>> 361 /* 362 * ? 363 * (Sign) 364 */ 365 366 rde_param_i_state_push_2 (<<state>>); 367 <<self>> <<ns>>sym_Sign (<<state>>); 368 rde_param_i_state_merge_ok (<<state>>); 369 return; 370} 371 372<<attributes>> void <<ns>>poskleene_42 (<<STATE>> <<state>>) { <<prelude>> 373 /* 374 * + 375 * (Digit) 376 */ 377 378 rde_param_i_loc_push (<<state>>); 379 <<self>> <<ns>>sym_Digit (<<state>>); 380 if (rde_param_i_kleene_abort(<<state>>)) return; 381 while (1) { 382 rde_param_i_state_push_2 (<<state>>); 383 <<self>> <<ns>>sym_Digit (<<state>>); 384 if (rde_param_i_kleene_close(<<state>>)) return; 385 } 386 return; 387} 388 389/* 390 * value Symbol 'Sign' 391 */ 392 393<<attributes>> void <<ns>>sym_Sign (<<STATE>> <<state>>) { <<prelude>> 394 /* 395 * [-+] 396 */ 397 398 if (rde_param_i_symbol_start (<<state>>, 20)) return ; 399 rde_param_i_next_class (<<state>>, "-+", 0); 400 rde_param_i_symbol_done_leaf (<<state>>, 20, 19); 401 return; 402} 403 404/* 405 * value Symbol 'Sinus' 406 */ 407 408<<attributes>> void <<ns>>sym_Sinus (<<STATE>> <<state>>) { <<prelude>> 409 /* 410 * x 411 * "sin\(" 412 * (Expression) 413 * '\)' 414 */ 415 416 if (rde_param_i_symbol_start_d (<<state>>, 23)) return ; 417 <<self>> <<ns>>sequence_52 (<<state>>); 418 rde_param_i_symbol_done_d_reduce (<<state>>, 23, 22); 419 return; 420} 421 422<<attributes>> void <<ns>>sequence_52 (<<STATE>> <<state>>) { <<prelude>> 423 /* 424 * x 425 * "sin\(" 426 * (Expression) 427 * '\)' 428 */ 429 430 rde_param_i_state_push_void (<<state>>); 431 rde_param_i_next_str (<<state>>, "sin\50", 21); 432 if (rde_param_i_seq_void2value(<<state>>)) return; 433 <<self>> <<ns>>sym_Expression (<<state>>); 434 if (rde_param_i_seq_value2value(<<state>>)) return; 435 rde_param_i_next_char (<<state>>, "\51", 7); 436 rde_param_i_state_merge_value (<<state>>); 437 return; 438} 439 440/* 441 * value Symbol 'Term' 442 */ 443 444<<attributes>> void <<ns>>sym_Term (<<STATE>> <<state>>) { <<prelude>> 445 /* 446 * (Number) 447 */ 448 449 if (rde_param_i_symbol_start_d (<<state>>, 25)) return ; 450 <<self>> <<ns>>sym_Number (<<state>>); 451 rde_param_i_symbol_done_d_reduce (<<state>>, 25, 24); 452 return; 453} 454 455/* 456 */ 457