| 1 | %{ |
| 2 | |
| 3 | /* Copyright (c) 1982 Regents of the University of California */ |
| 4 | |
| 5 | static char sccsid[] = "@(#)commands.y 1.8 %G%"; |
| 6 | |
| 7 | /* |
| 8 | * Yacc grammar for debugger commands. |
| 9 | */ |
| 10 | |
| 11 | #include "defs.h" |
| 12 | #include "symbols.h" |
| 13 | #include "operators.h" |
| 14 | #include "tree.h" |
| 15 | #include "process.h" |
| 16 | #include "source.h" |
| 17 | #include "scanner.h" |
| 18 | #include "names.h" |
| 19 | |
| 20 | private String curformat = "X"; |
| 21 | |
| 22 | %} |
| 23 | |
| 24 | %term |
| 25 | ALIAS AND ASSIGN AT CALL CATCH CONT DEBUG DELETE DIV DUMP |
| 26 | EDIT FILE FUNC GRIPE HELP IF IGNORE IN LIST MOD NEXT NEXTI NIL NOT OR |
| 27 | PRINT PSYM QUIT RUN SH SKIP SOURCE STATUS STEP STEPI |
| 28 | STOP STOPI TRACE TRACEI |
| 29 | USE WHATIS WHEN WHERE WHEREIS WHICH |
| 30 | |
| 31 | %term INT REAL NAME STRING |
| 32 | %term LFORMER RFORMER ABSTRACTION ARROW |
| 33 | |
| 34 | %right INT |
| 35 | %binary REDIRECT |
| 36 | %binary '<' '=' '>' '!' IN |
| 37 | %left '+' '-' OR |
| 38 | %left UNARYSIGN |
| 39 | %left '*' '/' DIV MOD AND |
| 40 | %left NOT '(' '[' '.' '^' ARROW |
| 41 | %left '\\' |
| 42 | |
| 43 | %union { |
| 44 | Name y_name; |
| 45 | Symbol y_sym; |
| 46 | Node y_node; |
| 47 | Integer y_int; |
| 48 | Operator y_op; |
| 49 | long y_long; |
| 50 | double y_real; |
| 51 | String y_string; |
| 52 | Boolean y_bool; |
| 53 | Cmdlist y_cmdlist; |
| 54 | }; |
| 55 | |
| 56 | %type <y_op> trace stop |
| 57 | %type <y_long> INT count |
| 58 | %type <y_real> REAL |
| 59 | %type <y_string> STRING redirectout filename opt_filename mode |
| 60 | %type <y_name> ALIAS AND ASSIGN AT CALL CATCH CONT DEBUG DELETE DIV DUMP |
| 61 | %type <y_name> EDIT FILE FUNC GRIPE HELP IF IGNORE IN LIST MOD |
| 62 | %type <y_name> NEXT NEXTI NIL NOT OR |
| 63 | %type <y_name> PRINT PSYM QUIT RUN SH SKIP SOURCE STATUS STEP STEPI |
| 64 | %type <y_name> STOP STOPI TRACE TRACEI |
| 65 | %type <y_name> USE WHATIS WHEN WHERE WHEREIS WHICH |
| 66 | %type <y_name> name NAME keyword |
| 67 | %type <y_node> symbol |
| 68 | %type <y_node> command rcommand cmd step what where examine |
| 69 | %type <y_node> event opt_exp_list opt_cond |
| 70 | %type <y_node> exp_list exp term boolean_exp constant address |
| 71 | %type <y_node> alias_command list_command line_number |
| 72 | %type <y_cmdlist> actions |
| 73 | |
| 74 | %% |
| 75 | |
| 76 | input: |
| 77 | input command_nl |
| 78 | | |
| 79 | /* empty */ |
| 80 | ; |
| 81 | command_nl: |
| 82 | command_line '\n' |
| 83 | | |
| 84 | command_line ';' |
| 85 | | |
| 86 | '\n' |
| 87 | ; |
| 88 | |
| 89 | command_line: |
| 90 | command |
| 91 | { |
| 92 | if ($1 != nil) { |
| 93 | if(debug_flag[2]) {dumptree(stderr,$1); fflush (stderr);} |
| 94 | eval($1); |
| 95 | } |
| 96 | } |
| 97 | | |
| 98 | rcommand redirectout |
| 99 | { |
| 100 | if ($1 != nil) { |
| 101 | if ($2 != nil) { |
| 102 | setout($2); |
| 103 | if(debug_flag[2]) {dumptree(stderr,$1); fflush (stderr);} |
| 104 | eval($1); |
| 105 | unsetout(); |
| 106 | } else { |
| 107 | if(debug_flag[2]) {dumptree(stderr,$1); fflush (stderr);} |
| 108 | eval($1); |
| 109 | } |
| 110 | } |
| 111 | } |
| 112 | ; |
| 113 | redirectout: |
| 114 | '>' shellmode NAME |
| 115 | { |
| 116 | $$ = ident($3); |
| 117 | } |
| 118 | | |
| 119 | /* empty */ |
| 120 | { |
| 121 | $$ = nil; |
| 122 | } |
| 123 | ; |
| 124 | |
| 125 | /* |
| 126 | * Non-redirectable commands. |
| 127 | */ |
| 128 | command: |
| 129 | alias_command |
| 130 | { |
| 131 | $$ = $1; |
| 132 | } |
| 133 | | |
| 134 | ASSIGN term '=' exp |
| 135 | { |
| 136 | $$ = build(O_ASSIGN, $2, $4); |
| 137 | } |
| 138 | | |
| 139 | CATCH INT |
| 140 | { |
| 141 | $$ = build(O_CATCH, $2); |
| 142 | } |
| 143 | | |
| 144 | CONT |
| 145 | { |
| 146 | $$ = build(O_CONT, (long) 0); |
| 147 | } |
| 148 | | |
| 149 | CONT INT |
| 150 | { |
| 151 | $$ = build(O_CONT, $2); |
| 152 | } |
| 153 | | |
| 154 | DELETE INT |
| 155 | { |
| 156 | $$ = build(O_DELETE, $2); |
| 157 | } |
| 158 | | |
| 159 | EDIT shellmode opt_filename |
| 160 | { |
| 161 | $$ = build(O_EDIT, $3); |
| 162 | } |
| 163 | | |
| 164 | FILE shellmode opt_filename |
| 165 | { |
| 166 | $$ = build(O_CHFILE, $3); |
| 167 | } |
| 168 | | |
| 169 | FUNC |
| 170 | { |
| 171 | $$ = build(O_FUNC, nil); |
| 172 | } |
| 173 | | |
| 174 | FUNC symbol |
| 175 | { |
| 176 | $$ = build(O_FUNC, $2); |
| 177 | } |
| 178 | | |
| 179 | GRIPE |
| 180 | { |
| 181 | $$ = build(O_GRIPE); |
| 182 | } |
| 183 | | |
| 184 | HELP |
| 185 | { |
| 186 | $$ = build(O_HELP); |
| 187 | } |
| 188 | | |
| 189 | IGNORE INT |
| 190 | { |
| 191 | $$ = build(O_IGNORE, $2); |
| 192 | } |
| 193 | | |
| 194 | list_command |
| 195 | { |
| 196 | $$ = $1; |
| 197 | } |
| 198 | | |
| 199 | PSYM term |
| 200 | { |
| 201 | $$ = build(O_PSYM, $2); |
| 202 | } |
| 203 | | |
| 204 | QUIT |
| 205 | { |
| 206 | if (not popinput()) { |
| 207 | quit(0); |
| 208 | } else { |
| 209 | $$ = nil; |
| 210 | } |
| 211 | } |
| 212 | | |
| 213 | runcommand |
| 214 | { |
| 215 | run(); |
| 216 | /* NOTREACHED */ |
| 217 | } |
| 218 | | |
| 219 | SH |
| 220 | { |
| 221 | shellline(); |
| 222 | $$ = nil; |
| 223 | } |
| 224 | | |
| 225 | SOURCE shellmode filename |
| 226 | { |
| 227 | $$ = build(O_SOURCE, $3); |
| 228 | } |
| 229 | | |
| 230 | step |
| 231 | { |
| 232 | $$ = $1; |
| 233 | } |
| 234 | | |
| 235 | stop where opt_cond |
| 236 | { |
| 237 | $$ = build($1, nil, $2, $3); |
| 238 | } |
| 239 | | |
| 240 | stop what opt_cond |
| 241 | { |
| 242 | $$ = build($1, $2, nil, $3); |
| 243 | } |
| 244 | | |
| 245 | stop IF boolean_exp |
| 246 | { |
| 247 | $$ = build($1, nil, nil, $3); |
| 248 | } |
| 249 | | |
| 250 | trace what where opt_cond |
| 251 | { |
| 252 | $$ = build($1, $2, $3, $4); |
| 253 | } |
| 254 | | |
| 255 | trace where opt_cond |
| 256 | { |
| 257 | $$ = build($1, nil, $2, $3); |
| 258 | } |
| 259 | | |
| 260 | trace what opt_cond |
| 261 | { |
| 262 | $$ = build($1, $2, nil, $3); |
| 263 | } |
| 264 | | |
| 265 | trace opt_cond |
| 266 | { |
| 267 | $$ = build($1, nil, nil, $2); |
| 268 | } |
| 269 | | |
| 270 | WHATIS term |
| 271 | { |
| 272 | $$ = build(O_WHATIS, $2); |
| 273 | } |
| 274 | | |
| 275 | WHEN event '{' actions '}' |
| 276 | { |
| 277 | $$ = build(O_ADDEVENT, $2, $4); |
| 278 | } |
| 279 | | |
| 280 | WHEREIS symbol |
| 281 | { |
| 282 | $$ = build(O_WHEREIS, $2); |
| 283 | } |
| 284 | | |
| 285 | WHICH symbol |
| 286 | { |
| 287 | $$ = build(O_WHICH, $2); |
| 288 | } |
| 289 | | |
| 290 | USE shellmode sourcepath |
| 291 | { |
| 292 | $$ = nil; |
| 293 | if (list_size(sourcepath) == 0) { |
| 294 | list_append(list_item("."), nil, sourcepath); |
| 295 | } |
| 296 | } |
| 297 | ; |
| 298 | runcommand: |
| 299 | run { arginit(); } arglist |
| 300 | | |
| 301 | run |
| 302 | ; |
| 303 | run: |
| 304 | RUN shellmode |
| 305 | { |
| 306 | fflush(stdout); |
| 307 | } |
| 308 | ; |
| 309 | arglist: |
| 310 | arglist arg |
| 311 | | |
| 312 | arg |
| 313 | ; |
| 314 | arg: |
| 315 | NAME |
| 316 | { |
| 317 | newarg(ident($1)); |
| 318 | } |
| 319 | | |
| 320 | '<' NAME |
| 321 | { |
| 322 | inarg(ident($2)); |
| 323 | } |
| 324 | | |
| 325 | '>' NAME |
| 326 | { |
| 327 | outarg(ident($2)); |
| 328 | } |
| 329 | ; |
| 330 | step: |
| 331 | STEP |
| 332 | { |
| 333 | $$ = build(O_STEP, true, false); |
| 334 | } |
| 335 | | |
| 336 | STEPI |
| 337 | { |
| 338 | $$ = build(O_STEP, false, false); |
| 339 | } |
| 340 | | |
| 341 | NEXT |
| 342 | { |
| 343 | $$ = build(O_STEP, true, true); |
| 344 | } |
| 345 | | |
| 346 | NEXTI |
| 347 | { |
| 348 | $$ = build(O_STEP, false, true); |
| 349 | } |
| 350 | ; |
| 351 | shellmode: |
| 352 | /* empty */ |
| 353 | { |
| 354 | beginshellmode(); |
| 355 | } |
| 356 | ; |
| 357 | sourcepath: |
| 358 | sourcepath NAME |
| 359 | { |
| 360 | list_append(list_item(ident($2)), nil, sourcepath); |
| 361 | } |
| 362 | | |
| 363 | /* empty */ |
| 364 | { |
| 365 | String dir; |
| 366 | |
| 367 | foreach (String, dir, sourcepath) |
| 368 | list_delete(list_curitem(sourcepath), sourcepath); |
| 369 | endfor |
| 370 | } |
| 371 | ; |
| 372 | event: |
| 373 | where |
| 374 | | |
| 375 | exp |
| 376 | ; |
| 377 | actions: |
| 378 | actions cmd ';' |
| 379 | { |
| 380 | $$ = $1; |
| 381 | cmdlist_append($2, $$); |
| 382 | } |
| 383 | | |
| 384 | cmd ';' |
| 385 | { |
| 386 | $$ = list_alloc(); |
| 387 | cmdlist_append($1, $$); |
| 388 | } |
| 389 | ; |
| 390 | cmd: |
| 391 | command |
| 392 | | |
| 393 | rcommand |
| 394 | ; |
| 395 | |
| 396 | /* |
| 397 | * Redirectable commands. |
| 398 | */ |
| 399 | rcommand: |
| 400 | PRINT exp_list |
| 401 | { |
| 402 | $$ = build(O_PRINT, $2); |
| 403 | } |
| 404 | | |
| 405 | WHERE |
| 406 | { |
| 407 | $$ = build(O_WHERE); |
| 408 | } |
| 409 | | |
| 410 | examine |
| 411 | { |
| 412 | $$ = $1; |
| 413 | } |
| 414 | | |
| 415 | CALL term |
| 416 | { |
| 417 | $$ = $2; |
| 418 | } |
| 419 | | |
| 420 | DEBUG INT |
| 421 | { |
| 422 | $$ = build(O_DEBUG, $2); |
| 423 | } |
| 424 | | |
| 425 | DUMP |
| 426 | { |
| 427 | $$ = build(O_DUMP); |
| 428 | } |
| 429 | | |
| 430 | STATUS |
| 431 | { |
| 432 | $$ = build(O_STATUS); |
| 433 | } |
| 434 | ; |
| 435 | alias_command: |
| 436 | ALIAS name name |
| 437 | { |
| 438 | $$ = build(O_ALIAS, build(O_NAME, $2), build(O_NAME, $3)); |
| 439 | } |
| 440 | | |
| 441 | ALIAS name |
| 442 | { |
| 443 | $$ = build(O_ALIAS, build(O_NAME, $2), nil); |
| 444 | } |
| 445 | | |
| 446 | ALIAS |
| 447 | { |
| 448 | $$ = build(O_ALIAS, nil, nil); |
| 449 | } |
| 450 | ; |
| 451 | trace: |
| 452 | TRACE |
| 453 | { |
| 454 | $$ = O_TRACE; |
| 455 | } |
| 456 | | |
| 457 | TRACEI |
| 458 | { |
| 459 | $$ = O_TRACEI; |
| 460 | } |
| 461 | ; |
| 462 | stop: |
| 463 | STOP |
| 464 | { |
| 465 | $$ = O_STOP; |
| 466 | } |
| 467 | | |
| 468 | STOPI |
| 469 | { |
| 470 | $$ = O_STOPI; |
| 471 | } |
| 472 | ; |
| 473 | what: |
| 474 | exp |
| 475 | { |
| 476 | $$ = $1; |
| 477 | } |
| 478 | | |
| 479 | STRING ':' line_number |
| 480 | { |
| 481 | $$ = build(O_QLINE, build(O_SCON, $1), $3); |
| 482 | } |
| 483 | ; |
| 484 | where: |
| 485 | IN term |
| 486 | { |
| 487 | $$ = $2; |
| 488 | } |
| 489 | | |
| 490 | AT line_number |
| 491 | { |
| 492 | $$ = build(O_QLINE, build(O_SCON, cursource), $2); |
| 493 | } |
| 494 | | |
| 495 | AT STRING ':' line_number |
| 496 | { |
| 497 | $$ = build(O_QLINE, build(O_SCON, $2), $4); |
| 498 | } |
| 499 | ; |
| 500 | filename: |
| 501 | NAME |
| 502 | { |
| 503 | $$ = ident($1); |
| 504 | } |
| 505 | ; |
| 506 | opt_filename: |
| 507 | /* empty */ |
| 508 | { |
| 509 | $$ = nil; |
| 510 | } |
| 511 | | |
| 512 | filename |
| 513 | { |
| 514 | $$ = $1; |
| 515 | } |
| 516 | ; |
| 517 | opt_exp_list: |
| 518 | exp_list |
| 519 | { |
| 520 | $$ = $1; |
| 521 | } |
| 522 | | |
| 523 | /* empty */ |
| 524 | { |
| 525 | $$ = nil; |
| 526 | } |
| 527 | ; |
| 528 | list_command: |
| 529 | LIST |
| 530 | { |
| 531 | $$ = build(O_LIST, |
| 532 | build(O_LCON, (long) cursrcline), |
| 533 | build(O_LCON, (long) cursrcline + 9) |
| 534 | ); |
| 535 | } |
| 536 | | |
| 537 | LIST line_number |
| 538 | { |
| 539 | $$ = build(O_LIST, $2, $2); |
| 540 | } |
| 541 | | |
| 542 | LIST line_number ',' line_number |
| 543 | { |
| 544 | $$ = build(O_LIST, $2, $4); |
| 545 | } |
| 546 | | |
| 547 | LIST symbol |
| 548 | { |
| 549 | $$ = build(O_LIST, $2); |
| 550 | } |
| 551 | ; |
| 552 | line_number: |
| 553 | INT |
| 554 | { |
| 555 | $$ = build(O_LCON, $1); |
| 556 | } |
| 557 | | |
| 558 | '$' |
| 559 | { |
| 560 | $$ = build(O_LCON, (long) LASTLINE); |
| 561 | } |
| 562 | ; |
| 563 | examine: |
| 564 | address '/' count mode |
| 565 | { |
| 566 | $$ = build(O_EXAMINE, $4, $1, nil, $3); |
| 567 | } |
| 568 | | |
| 569 | address ',' address '/' mode |
| 570 | { |
| 571 | $$ = build(O_EXAMINE, $5, $1, $3, 0); |
| 572 | } |
| 573 | | |
| 574 | '/' count mode |
| 575 | { |
| 576 | $$ = build(O_EXAMINE, $3, build(O_LCON, (long) prtaddr), nil, $2); |
| 577 | } |
| 578 | | |
| 579 | address '=' mode |
| 580 | { |
| 581 | $$ = build(O_EXAMINE, $3, $1, nil, 0); |
| 582 | } |
| 583 | ; |
| 584 | address: |
| 585 | INT |
| 586 | { |
| 587 | $$ = build(O_LCON, $1); |
| 588 | } |
| 589 | | |
| 590 | '&' term |
| 591 | { |
| 592 | $$ = amper($2); |
| 593 | } |
| 594 | | |
| 595 | address '+' address |
| 596 | { |
| 597 | $$ = build(O_ADD, $1, $3); |
| 598 | } |
| 599 | | |
| 600 | address '-' address |
| 601 | { |
| 602 | $$ = build(O_SUB, $1, $3); |
| 603 | } |
| 604 | | |
| 605 | address '*' address |
| 606 | { |
| 607 | $$ = build(O_MUL, $1, $3); |
| 608 | } |
| 609 | | |
| 610 | '*' address %prec UNARYSIGN |
| 611 | { |
| 612 | $$ = build(O_INDIR, $2); |
| 613 | } |
| 614 | | |
| 615 | '(' exp ')' |
| 616 | { |
| 617 | $$ = $2; |
| 618 | } |
| 619 | ; |
| 620 | count: |
| 621 | /* empty */ |
| 622 | { |
| 623 | $$ = 1; |
| 624 | } |
| 625 | | |
| 626 | INT |
| 627 | { |
| 628 | $$ = $1; |
| 629 | } |
| 630 | ; |
| 631 | mode: |
| 632 | name |
| 633 | { |
| 634 | $$ = ident($1); |
| 635 | curformat = $$; |
| 636 | } |
| 637 | | |
| 638 | /* empty */ |
| 639 | { |
| 640 | $$ = curformat; |
| 641 | } |
| 642 | ; |
| 643 | opt_cond: |
| 644 | /* empty */ |
| 645 | { |
| 646 | $$ = nil; |
| 647 | } |
| 648 | | |
| 649 | IF boolean_exp |
| 650 | { |
| 651 | $$ = $2; |
| 652 | } |
| 653 | ; |
| 654 | exp_list: |
| 655 | exp |
| 656 | { |
| 657 | $$ = build(O_COMMA, $1, nil); |
| 658 | } |
| 659 | | |
| 660 | exp ',' exp_list |
| 661 | { |
| 662 | $$ = build(O_COMMA, $1, $3); |
| 663 | } |
| 664 | ; |
| 665 | exp: |
| 666 | term |
| 667 | { |
| 668 | $$ = build(O_RVAL, $1); |
| 669 | } |
| 670 | | |
| 671 | constant |
| 672 | { |
| 673 | $$ = $1; |
| 674 | } |
| 675 | | |
| 676 | exp '\\' symbol |
| 677 | { |
| 678 | $$ = build(O_TYPERENAME, $1, $3); |
| 679 | } |
| 680 | | |
| 681 | '+' exp %prec UNARYSIGN |
| 682 | { |
| 683 | $$ = $2; |
| 684 | } |
| 685 | | |
| 686 | '-' exp %prec UNARYSIGN |
| 687 | { |
| 688 | $$ = build(O_NEG, $2); |
| 689 | } |
| 690 | | |
| 691 | '&' exp %prec UNARYSIGN |
| 692 | { |
| 693 | $$ = amper($2); |
| 694 | } |
| 695 | | |
| 696 | exp '+' exp |
| 697 | { |
| 698 | $$ = build(O_ADD, $1, $3); |
| 699 | } |
| 700 | | |
| 701 | exp '-' exp |
| 702 | { |
| 703 | $$ = build(O_SUB, $1, $3); |
| 704 | } |
| 705 | | |
| 706 | exp '*' exp |
| 707 | { |
| 708 | $$ = build(O_MUL, $1, $3); |
| 709 | } |
| 710 | | |
| 711 | exp '/' exp |
| 712 | { |
| 713 | $$ = build(O_DIVF, $1, $3); |
| 714 | } |
| 715 | | |
| 716 | exp DIV exp |
| 717 | { |
| 718 | $$ = build(O_DIV, $1, $3); |
| 719 | } |
| 720 | | |
| 721 | exp MOD exp |
| 722 | { |
| 723 | $$ = build(O_MOD, $1, $3); |
| 724 | } |
| 725 | | |
| 726 | exp AND exp |
| 727 | { |
| 728 | $$ = build(O_AND, $1, $3); |
| 729 | } |
| 730 | | |
| 731 | exp OR exp |
| 732 | { |
| 733 | $$ = build(O_OR, $1, $3); |
| 734 | } |
| 735 | | |
| 736 | exp '<' exp |
| 737 | { |
| 738 | $$ = build(O_LT, $1, $3); |
| 739 | } |
| 740 | | |
| 741 | exp '<' '=' exp |
| 742 | { |
| 743 | $$ = build(O_LE, $1, $4); |
| 744 | } |
| 745 | | |
| 746 | exp '>' exp |
| 747 | { |
| 748 | $$ = build(O_GT, $1, $3); |
| 749 | } |
| 750 | | |
| 751 | exp '>' '=' exp |
| 752 | { |
| 753 | $$ = build(O_GE, $1, $4); |
| 754 | } |
| 755 | | |
| 756 | exp '=' exp |
| 757 | { |
| 758 | $$ = build(O_EQ, $1, $3); |
| 759 | } |
| 760 | | |
| 761 | exp '=' '=' exp |
| 762 | { |
| 763 | $$ = build(O_EQ, $1, $4); |
| 764 | } |
| 765 | | |
| 766 | exp '<' '>' exp |
| 767 | { |
| 768 | $$ = build(O_NE, $1, $4); |
| 769 | } |
| 770 | | |
| 771 | exp '!' '=' exp |
| 772 | { |
| 773 | $$ = build(O_NE, $1, $4); |
| 774 | } |
| 775 | | |
| 776 | '(' exp ')' |
| 777 | { |
| 778 | $$ = $2; |
| 779 | } |
| 780 | ; |
| 781 | term: |
| 782 | symbol |
| 783 | { |
| 784 | $$ = $1; |
| 785 | } |
| 786 | | |
| 787 | term '[' exp_list ']' |
| 788 | { |
| 789 | $$ = subscript($1, $3); |
| 790 | } |
| 791 | | |
| 792 | term '.' name |
| 793 | { |
| 794 | $$ = dot($1, $3); |
| 795 | } |
| 796 | | |
| 797 | term ARROW name |
| 798 | { |
| 799 | $$ = dot($1, $3); |
| 800 | } |
| 801 | | |
| 802 | '*' term %prec UNARYSIGN |
| 803 | { |
| 804 | $$ = build(O_INDIR, $2); |
| 805 | } |
| 806 | | |
| 807 | '*' '(' exp ')' %prec UNARYSIGN |
| 808 | { |
| 809 | $$ = build(O_INDIR, $3); |
| 810 | } |
| 811 | | |
| 812 | term '^' %prec UNARYSIGN |
| 813 | { |
| 814 | $$ = build(O_INDIR, $1); |
| 815 | } |
| 816 | | |
| 817 | '#' term %prec UNARYSIGN |
| 818 | { |
| 819 | $$ = concrete($2); |
| 820 | } |
| 821 | | |
| 822 | term '(' opt_exp_list ')' |
| 823 | { |
| 824 | $$ = build(O_CALL, $1, $3); |
| 825 | } |
| 826 | ; |
| 827 | boolean_exp: |
| 828 | exp |
| 829 | { |
| 830 | chkboolean($1); |
| 831 | $$ = $1; |
| 832 | } |
| 833 | ; |
| 834 | constant: |
| 835 | INT |
| 836 | { |
| 837 | $$ = build(O_LCON, $1); |
| 838 | } |
| 839 | | |
| 840 | REAL |
| 841 | { |
| 842 | $$ = build(O_FCON, $1); |
| 843 | } |
| 844 | | |
| 845 | STRING |
| 846 | { |
| 847 | $$ = build(O_SCON, $1); |
| 848 | } |
| 849 | ; |
| 850 | symbol: |
| 851 | name |
| 852 | { |
| 853 | $$ = build(O_SYM, which($1)); |
| 854 | } |
| 855 | ; |
| 856 | name: |
| 857 | NAME |
| 858 | { |
| 859 | $$ = $1; |
| 860 | } |
| 861 | | |
| 862 | keyword |
| 863 | { |
| 864 | $$ = $1; |
| 865 | } |
| 866 | keyword: |
| 867 | ALIAS | AND | ASSIGN | AT | CALL | CATCH | CONT | DEBUG | DELETE | DIV | |
| 868 | DUMP | EDIT | FILE | FUNC | GRIPE | HELP | IGNORE | IN | LIST | MOD | |
| 869 | NEXT | NEXTI | NIL | NOT | OR | PRINT | PSYM | QUIT | RUN | |
| 870 | SH | SKIP | SOURCE | STATUS | STEP | STEPI | |
| 871 | STOP | STOPI | TRACE | TRACEI | |
| 872 | USE | WHATIS | WHEN | WHERE | WHEREIS | WHICH |
| 873 | ; |