File size: 72,493 Bytes
6fa4bc9 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 | {
"paper_id": "P91-1014",
"header": {
"generated_with": "S2ORC 1.0.0",
"date_generated": "2023-01-19T09:03:29.345009Z"
},
"title": "Polynomial Time and Space Shift-Reduce Parsing of Arbitrary Context-free Grammars.*",
"authors": [
{
"first": "Yves",
"middle": [],
"last": "Schabes",
"suffix": "",
"affiliation": {
"laboratory": "",
"institution": "University of Pennsylvania Philadelphia",
"location": {
"postCode": "19104-6389",
"region": "PA",
"country": "USA"
}
},
"email": ""
}
],
"year": "",
"venue": null,
"identifiers": {},
"abstract": "We introduce an algorithm for designing a predictive left to right shift-reduce non-deterministic push-down machine corresponding to an arbitrary unrestricted context-free grammar and an algorithm for efficiently driving this machine in pseudo-parallel. The performance of the resulting parser is formally proven to be superior to Earley's parser (1970). The technique employed consists in constructing before run-time a parsing table that encodes a nondeterministic machine in the which the predictive behavior has been compiled out. At run time, the machine is driven in pseudo-parallel with the help of a chart. The recognizer behaves in the worst case in O(IGI2n3)-time and O(IGIn2)-space. However in practice it is always superior to Earley's parser since the prediction steps have been compiled before runtime. Finally, we explain how other more efficient variants of the basic parser can be obtained by determinizing portionsof the basic non-deterministic pushdown machine while still using the same pseudoparallel driver.",
"pdf_parse": {
"paper_id": "P91-1014",
"_pdf_hash": "",
"abstract": [
{
"text": "We introduce an algorithm for designing a predictive left to right shift-reduce non-deterministic push-down machine corresponding to an arbitrary unrestricted context-free grammar and an algorithm for efficiently driving this machine in pseudo-parallel. The performance of the resulting parser is formally proven to be superior to Earley's parser (1970). The technique employed consists in constructing before run-time a parsing table that encodes a nondeterministic machine in the which the predictive behavior has been compiled out. At run time, the machine is driven in pseudo-parallel with the help of a chart. The recognizer behaves in the worst case in O(IGI2n3)-time and O(IGIn2)-space. However in practice it is always superior to Earley's parser since the prediction steps have been compiled before runtime. Finally, we explain how other more efficient variants of the basic parser can be obtained by determinizing portionsof the basic non-deterministic pushdown machine while still using the same pseudoparallel driver.",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "Abstract",
"sec_num": null
}
],
"body_text": [
{
"text": "Predictive bottom-up parsers (Earley, 1968; Earley, 1970; Graham et al., 1980) are often used for natural language processing because of their superior average performance compared to purely bottom-up parsers *We are extremely indebted to Fernando Pereira and Stuart Shleber for providing valuable technical comments during discussions about earlier versio/m of this algorithm. We are also grateful to Aravind Joehi for his support of this research. We also thank Robert Frank. All remaining errors are the author's responsibility alone. This research wa~ partially funded by ARO grant DAAL03-89-C0031PRI and DARPA grant N00014-90-J-1863. such as CKY-style parsers (Kasami, 1965; Younger, 1967) . Their practical superiority is mainly obtained because of the top-down filtering accomplished by the predictive component of the parser. Compiling out as much as possible this predictive component before run-time will result in a more efficient parser so long as the worst case behavior is not deteriorated.",
"cite_spans": [
{
"start": 29,
"end": 43,
"text": "(Earley, 1968;",
"ref_id": "BIBREF2"
},
{
"start": 44,
"end": 57,
"text": "Earley, 1970;",
"ref_id": "BIBREF3"
},
{
"start": 58,
"end": 78,
"text": "Graham et al., 1980)",
"ref_id": "BIBREF4"
},
{
"start": 665,
"end": 679,
"text": "(Kasami, 1965;",
"ref_id": "BIBREF6"
},
{
"start": 680,
"end": 694,
"text": "Younger, 1967)",
"ref_id": null
}
],
"ref_spans": [],
"eq_spans": [],
"section": "Introduction",
"sec_num": "1"
},
{
"text": "Approaches in this direction have been investigated (Earley, 1968; Lang, 1974; Tomita, 1985; Tomita, 1987) , however none of them is satisfying, either because the worst case complexity is deteriorated (worse than Earley's parser) or because the technique is not general. Furthermore, none of these approaches have been formally proven to have a behavior superior to well known parsers such as Earley's parser. Earley himself ([1968] pages 69-89) proposed to precompile the state sets generated by his algorithm to make it as efficient as LR(k) parsers (Knuth, 1965) when used on LR(k) grammars by precomputing all possible states sets that the parser could create. However, some context-free grammars, including most likely most natural language grammars, cannot be compiled using his technique and the problem of knowing if a grammar can be compiled with this technique is undecidable (Earley [1968] , page 99). Lang (1974) proposed a technique for evaluating in pseudo-parallel non-deterministic push down automata. Although this technique achieves a worst case complexity of O(n3)-time with respect to the length of input, it requires that at most two symbols are popped from the stack in a single move. When the technique is used for shift-reduce parsing, this constraint requires that the context-free grammar is in Chomsky normal form (CNF). As far as the grammar size is concerned, an exponential worst case behavior is reached when used with the characteristic LR(0) machine. 1 Tomita (1985; 1987) proposed to extend LR(0) parsers to non-deterministic context-free grammars by explicitly using a graph structured stack which represents the pseudo-parallel evaluation of the moves of a non-deterministic LR(0) push-down automaton. Tomita's encoding of the non-deterministic pushdown automaton suffers from an exponential time and space worst case complexity with respect to the input length and also with respect to the grammar size (Johnson [1989] and also page 72 in Tomita [1985] ). Although Tomita reports experimental data that seem to show that the parser behaves in practice better than Earley's parser (which is proven to take in the worst case O ([G[2n3)-time) , the duplication of the same experiments shows no conclusive outcome. Modifications to Tomita's algorithm have been proposed in order to alleviate the exponential complexity with respect to the input length (Kipps, 1989) but, according to Kipps, the modified algorithm does not lead to a practical parser. Furthermore, the algorithm is doomed to behave in the worst case in exponential time with respect to the grammar size for some ambiguous grammars and inputs (Johnson, 1989) . 2 So far, there is no formal proof showing that the Tomita's parser can be superior for some grammars and inputs to Earley's parser, and its worst case complexity seems to contradict the experimental data.",
"cite_spans": [
{
"start": 52,
"end": 66,
"text": "(Earley, 1968;",
"ref_id": "BIBREF2"
},
{
"start": 67,
"end": 78,
"text": "Lang, 1974;",
"ref_id": "BIBREF9"
},
{
"start": 79,
"end": 92,
"text": "Tomita, 1985;",
"ref_id": null
},
{
"start": 93,
"end": 106,
"text": "Tomita, 1987)",
"ref_id": null
},
{
"start": 411,
"end": 433,
"text": "Earley himself ([1968]",
"ref_id": null
},
{
"start": 553,
"end": 566,
"text": "(Knuth, 1965)",
"ref_id": "BIBREF8"
},
{
"start": 887,
"end": 901,
"text": "(Earley [1968]",
"ref_id": "BIBREF2"
},
{
"start": 914,
"end": 925,
"text": "Lang (1974)",
"ref_id": "BIBREF9"
},
{
"start": 1487,
"end": 1500,
"text": "Tomita (1985;",
"ref_id": null
},
{
"start": 1501,
"end": 1506,
"text": "1987)",
"ref_id": null
},
{
"start": 1941,
"end": 1956,
"text": "(Johnson [1989]",
"ref_id": "BIBREF5"
},
{
"start": 1984,
"end": 1990,
"text": "[1985]",
"ref_id": null
},
{
"start": 2163,
"end": 2177,
"text": "([G[2n3)-time)",
"ref_id": null
},
{
"start": 2386,
"end": 2399,
"text": "(Kipps, 1989)",
"ref_id": "BIBREF7"
},
{
"start": 2642,
"end": 2657,
"text": "(Johnson, 1989)",
"ref_id": "BIBREF5"
}
],
"ref_spans": [],
"eq_spans": [],
"section": "Introduction",
"sec_num": "1"
},
{
"text": "As explained, the previous attempts to compile the predictive component are not general and achieve a worst case complexity (with respect to the grammar size and the input length) worse than standard parsers.",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "Introduction",
"sec_num": "1"
},
{
"text": "The methodology we follow in order to compile the predictive component of Earley's parser is to define a predictive bottom-up pushdown machine equivalent to the given grammar which we drive in pseudoparallel. Following Johnson's (1989) argument, any parsing algorithm based on the LR(0) characteristic machine is doomed to behave in exponential time with respect to the grammar size for some ambiguous grammars and inputs. This is a result of the fact that the number of states of an LR(0) characteristic machine can be exponential and that there are some grammars and inputs for which an exponential number of states must be reached (See Johnson [1989] for examples of such grammars and inputs). One must therefore design a different pushdown machine which can be driven efficiently in pseudo-parallel.",
"cite_spans": [
{
"start": 219,
"end": 235,
"text": "Johnson's (1989)",
"ref_id": "BIBREF5"
},
{
"start": 639,
"end": 653,
"text": "Johnson [1989]",
"ref_id": "BIBREF5"
}
],
"ref_spans": [],
"eq_spans": [],
"section": "Introduction",
"sec_num": "1"
},
{
"text": "We construct a non-deterministic predictive pushdown machine given an arbitrary context-free grammar whose number of states is proportional to the size of the grammar. Then at run time, we efficiently drive this machine in pseudo-parallel. Even if all the states of the machine are reached for some grammars and inputs, a polynomial complexity will still be obtained since the number of states is bounded by the grammar size. We therefore introduce a shift-reduce driver for this machine in which all of the predictive component has been compiled in the finite state control of the machine. The technique makes no requirement on the form of the context-free grammar and it behaves in the worst case as well as Earley's parser (Earley, 1970) . The push-down machine is built before runtime and it is encoded as parsing tables in the which the predictive behavior has been compiled out.",
"cite_spans": [
{
"start": 726,
"end": 740,
"text": "(Earley, 1970)",
"ref_id": "BIBREF3"
}
],
"ref_spans": [],
"eq_spans": [],
"section": "Introduction",
"sec_num": "1"
},
{
"text": "In the worst case, the recognizer behaves in the same O -space as Earley's parser. However in practice it is always superior to Earley's parser since the prediction steps have been eliminated before run-time. We show that the items produced in the chart correspond to equivalence classes on the items produced for the same input by Earley's parser. This mapping formally shows its practical superior behavior. 3",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "Introduction",
"sec_num": "1"
},
{
"text": "Finally, we explain how other more efficient variants of the basic parser can be obtained by determinizing portions of the basic non-deterministic pushdown machine while still using the same pseudoparallel driver.",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "Introduction",
"sec_num": "1"
},
{
"text": "The parser we propose handles any context-free grammar; the grammar can be ambiguous and need not be in any normal form. The parser is a predictive shiftreduce bottom-up parser that uses compiled top down prediction information in the form of tables. Before run-time, a non-deterministic push down automaton (NPDA) is constructed from a given context-free grammar. The parsing tables encode the finite state control and the moves of the NPDA. At run-time, the NPDA is then driven in pseudo-parallel with the help of a chart. We show the construction of a basic machine which will be driven non-deterministically.",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "The Parser",
"sec_num": "2"
},
{
"text": "In the following, the input string is w --al...an and the context-free grammar being considered is G = (~, NT, P, S), where ~ is the set of terminal 3The characteristic LR(0) machine is the result of determinizing the n~acldne we introduce. Since this procedure introduce exponentially more states, the LR(0) machine can be exponentially large. symbols, NT the set of non-terminal symbols, P a set of production rules, S the start symbol. We will need to refer to the subsequence of the input string w = az...aN from position i to j, w]i,j], which we define as follows:",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "The Parser",
"sec_num": "2"
},
{
"text": "f ai+l ... aj , if i < j w]i,~] I, \u00a2 ,ifi>_j",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "The Parser",
"sec_num": "2"
},
{
"text": "We explain the data-structures used by the parser, the moves of the parser, and how the parsing tables are constructed for the basic NPDA. Then, we study the formal characteristics of the parser.",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "The Parser",
"sec_num": "2"
},
{
"text": "The parser uses two moves: shift and reduce. As in standard shift-reduce parsers, shift moves recognize new terminal symbols and reduce moves perform the recognition of an entire context-free rule. However in the parser we propose, shift and reduce moves behave differently on rules whose recognition has just started (i.e. rules that have been predicted) than on rules of which some portion has been recognized. This behavior enables the parser to efficiently perform reduce moves when ambiguity arises.",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "The Parser",
"sec_num": "2"
},
{
"text": "The parser collects items into a set called the chart, C. Each item encodes a well formed substring of the input. The parser proceeds until no more items can be added to the chart C.",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "Data-Structures and the Moves of the Parser",
"sec_num": "2.1"
},
{
"text": "An item is defined as a triple (s,i,jl, where s is a state in the control of the NPDA, i and j are indices referring to positions in the input string (i, j E [0, n]).",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "Data-Structures and the Moves of the Parser",
"sec_num": "2.1"
},
{
"text": "In an item (s,i,j), j corresponds to the current position in the input string and i is a position in the input which will facilitate the reduce move. . As we will see, non-kernel dotted rules correspond to the predictive component of the parser. We will later see each state s of the NPDA corresponds to a set of dotted rules for the grammar G.",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "Data-Structures and the Moves of the Parser",
"sec_num": "2.1"
},
{
"text": "The set of all possible states in the control of the NPDA is written S. Section 2.2 explains how the states are constructed.",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "Data-Structures and the Moves of the Parser",
"sec_num": "2.1"
},
{
"text": "The algorithm maintains the following property (which guarantees its soundness)4: if an item (s, i,j) is in the chart C then for all dotted rules A ~ aofl E s the following is satisfied: ",
"cite_spans": [
{
"start": 93,
"end": 101,
"text": "(s, i,j)",
"ref_id": null
}
],
"ref_spans": [],
"eq_spans": [],
"section": "Data-Structures and the Moves of the Parser",
"sec_num": "2.1"
},
{
"text": "(i) if a E (E U NT) +, then B7 E (NT U ~)*",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "Data-Structures and the Moves of the Parser",
"sec_num": "2.1"
},
{
"text": "GOTO~(s,X) = {r},GOTOnk(s,X) = {r'} with r, rt,s E S,X E NT.",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "Data-Structures and the Moves of the Parser",
"sec_num": "2.1"
},
{
"text": "C := {(start, O, 0)}",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "Data-Structures and the Moves of the Parser",
"sec_num": "2.1"
},
{
"text": "Perform the following three operations until no more items can be added to the chart C:",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "Data-Structures and the Moves of the Parser",
"sec_num": "2.1"
},
{
"text": "(1) KERNEL SHIFT: if (s,i,j) 6 C and if ksh(s') 6 ACTION(s, aj+I), then (s', i, j + 1) is added to C.",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "Data-Structures and the Moves of the Parser",
"sec_num": "2.1"
},
{
"text": "(2) NON-KERNEL SHIFT: if (s,i,j) e C and if nksh(s') E ACTION(s, aj+I), then (s',j,j+ 1) is added to C.",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "Data-Structures and the Moves of the Parser",
"sec_num": "2.1"
},
{
"text": "(",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "Data-Structures and the Moves of the Parser",
"sec_num": "2.1"
},
{
"text": "3) REDUCE: if (s, i, j) E C, then for all X --~ j3 s.t. red(X ~ ~) 6 ACTION(s, aj+t)",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "Data-Structures and the Moves of the Parser",
"sec_num": "2.1"
},
{
"text": "and for all (s', k, i) E C, perform the following:",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "Data-Structures and the Moves of the Parser",
"sec_num": "2.1"
},
{
"text": "\u2022 for all rl 6 GOTO~(s',X), (rl,k,j) is added to C;",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "Data-Structures and the Moves of the Parser",
"sec_num": "2.1"
},
{
"text": "\u2022 for all r2 E GOTOnk(s',X), (r~,i,j) is added to C.",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "Data-Structures and the Moves of the Parser",
"sec_num": "2.1"
},
{
"text": "If {(s, O, n) I (s, O, n) 6 C and s e .r} .# # then return acceptance otherwise return rejection.",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "Data-Structures and the Moves of the Parser",
"sec_num": "2.1"
},
{
"text": "end (* recognizer *) In the above algorithm, non-determinism arises from multiple entries in ACTION(s, a) and also from the fact that GOTOk(s,X)and GOTOnk(s,X)contain a set of states.",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "Data-Structures and the Moves of the Parser",
"sec_num": "2.1"
},
{
"text": "We shall give an LR(0)-like method for constructing the parsing tables corresponding to the basic NPDA. Several other methods (such as LR(k)-like, SLR(k)like) can also be used for constructing the parsing tables and are described in (Schabes, 1991) .",
"cite_spans": [
{
"start": 233,
"end": 248,
"text": "(Schabes, 1991)",
"ref_id": null
}
],
"ref_spans": [],
"eq_spans": [],
"section": "Construction of the Parsing Tables",
"sec_num": "2.2"
},
{
"text": "To construct the LR(0)-like finite state control for the basic non-deterministic push-down automaton that the parser simulates, we define three functions, closure, gotok and gotonk.",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "Construction of the Parsing Tables",
"sec_num": "2.2"
},
{
"text": "If s is a state, then closure(s) is the state constructed from s by the two rules: X .,8) )1 A",
"cite_spans": [],
"ref_spans": [
{
"start": 83,
"end": 89,
"text": "X .,8)",
"ref_id": null
}
],
"eq_spans": [],
"section": "Construction of the Parsing Tables",
"sec_num": "2.2"
},
{
"text": "(i) Initially,",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "Construction of the Parsing Tables",
"sec_num": "2.2"
},
{
"text": "The goto functions we define differ from the one defined for the LR(0) construction in two ways: first we have distinguished transitions on symbols from kernel items and non-kernel items; second, each state in goto~(s,X) and gOtOn~(S,X) contains exactly one kernel item whereas for the LR(0) construction they may contain more than one.",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "\u2022 s}",
"sec_num": null
},
{
"text": "We are now ready to compute the set of states ,9 defining the finite state control of the parser.",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "\u2022 s}",
"sec_num": null
},
{
"text": "The SET OF STATES CONSTRUCTION is constructed as follows: for each X E r~ u NT terminal for each r E gotok(s,X) U goton~ (s, X) add r to S until no more states can be added to 8 end PARSING TABLES. Now we construct the LR(0) parsing tables ACTION, GOTOk and GOTOnk from the finite state control constructed above. Given a context-free grammar G, we construct ~q, the set of states for G with the procedure given above. We construct the action table ACTION and the goto tables using the following algorithm.",
"cite_spans": [
{
"start": 121,
"end": 127,
"text": "(s, X)",
"ref_id": null
}
],
"ref_spans": [],
"eq_spans": [],
"section": "\u2022 s}",
"sec_num": null
},
{
"text": "Input: A context-free grammar G = (Y,, NT, P, S). Output: The parsing tables ACTION, GOTOk and GOTOnk for G, the start state start and the set of final states ~'.",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "begin (CONSTRUCTION OF THE PARSING TABLES)",
"sec_num": null
},
{
"text": "Step 1. Construct 8 = {so,..., sin}, the set of states for G.",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "begin (CONSTRUCTION OF THE PARSING TABLES)",
"sec_num": null
},
{
"text": "Step 2. The parsing actions for state si are determined for all terminal symbols a E ~ as follows:",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "begin (CONSTRUCTION OF THE PARSING TABLES)",
"sec_num": null
},
{
"text": "(i) for all r e gotok(si,a), add ksh(r) to ACTION(si, a);",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "begin (CONSTRUCTION OF THE PARSING TABLES)",
"sec_num": null
},
{
"text": "(ii) for all r E goto, k(si,a), add nksh(r) to to ACTION(si, a);",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "begin (CONSTRUCTION OF THE PARSING TABLES)",
"sec_num": null
},
{
"text": "(iii) if A --* a* is in si, then add red(A--* a)",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "begin (CONSTRUCTION OF THE PARSING TABLES)",
"sec_num": null
},
{
"text": "to ACTION(si, a) for all terminal symbol a and for the end marker $.",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "begin (CONSTRUCTION OF THE PARSING TABLES)",
"sec_num": null
},
{
"text": "Step 4. The kernel and non-kernel goto tables for state si are determined for all non-terminal symbols X as follows:",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "begin (CONSTRUCTION OF THE PARSING TABLES)",
"sec_num": null
},
{
"text": "(i) VX E NT, GOTO~(si,X) := gotok(si,X) (ii) VX E NT, GOTOnk(si, X) :--gotonk(si, X)",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "begin (CONSTRUCTION OF THE PARSING TABLES)",
"sec_num": null
},
{
"text": "Step 3. The start state of the parser is start := ciosure({S --* .a I S --~ a ~_ P})",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "begin (CONSTRUCTION OF THE PARSING TABLES)",
"sec_num": null
},
{
"text": "Step 4. One of the objectives for the design of the nondeterministic machine was to make sure that it was not possible to reach an exponential number of states, a property without which the machine is doomed to have exponential complexity (Johnson, 1989 ). First we observe that the number of states of the finite state control of the non-deterministic machine that we constructed in Section 2.2 is proportional to the size of the grammar, IG[. By construction, each state (except for the start state) contains exactly one kernel dotted rule. Therefore, the number of states is bounded by the maximum number of kernel rules of the form A --* ao/~ (with a non empty), and is O(IGI).",
"cite_spans": [
{
"start": 239,
"end": 253,
"text": "(Johnson, 1989",
"ref_id": "BIBREF5"
}
],
"ref_spans": [],
"eq_spans": [],
"section": "begin (CONSTRUCTION OF THE PARSING TABLES)",
"sec_num": null
},
{
"text": "We conclude that the algorithm requires in the worst case O(IGIn~)-space since the maximum number of items (8, i, j) in the chart is proportional to IGIn 2.",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "begin (CONSTRUCTION OF THE PARSING TABLES)",
"sec_num": null
},
{
"text": "A close look at the moves of the parser reveals that the reduce move is the most complex one since it involves a pair of states (s, i,j) and (s', k,j/. This move can be instantiated at most O(IGI2nS)-time since i,j,k E [0, n] and there are in the worst case O (IGI ~) pairs of states involved in this move. 5 The parser therefore behaves in the worst case in O(IGI2nS)-time.",
"cite_spans": [
{
"start": 128,
"end": 136,
"text": "(s, i,j)",
"ref_id": null
},
{
"start": 260,
"end": 267,
"text": "(IGI ~)",
"ref_id": null
}
],
"ref_spans": [],
"eq_spans": [],
"section": "begin (CONSTRUCTION OF THE PARSING TABLES)",
"sec_num": null
},
{
"text": "One should however note that in order to bound the worst case complexity as stated above, arrays similar to the one needed for Earley's parser must be used to implement efficiently the shift and reduce moves. 6",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "begin (CONSTRUCTION OF THE PARSING TABLES)",
"sec_num": null
},
{
"text": "As for Earley's parser, it can also be shown that the algorithm requires in the worst case O(IGI2n2)-time for unambiguous context-free grammars and behaves in linear time on a large class of grammars.",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "begin (CONSTRUCTION OF THE PARSING TABLES)",
"sec_num": null
},
{
"text": "The algorithm that we described in Section 2 is a recognizer. However, if we include pointers from an item to the other items (to a pair of items for the reduce moves or to an item for the shift moves) which caused it to be placed in the chart, the recognizer can be modified to record all parse trees of the input string. The representation is similar to a shared forest. ",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "Retrieving a Parse",
"sec_num": "4"
},
{
"text": "We derive the correctness of the parser by showing how it can be mapped to Earley's parser. In the process, we will also be able to show why this parser can be more efficient than Earley's parser. The detailed proofs are given in (Schabes, 1991) . We are also interested in formally characterizing the differences in performance between the parser we propose and Earley's parser. We show that the parser behaves in the worst scenario as well as Earley's parser by mapping it into Earley's parser. The parser behaves better than Earley's parser because it has eliminated the prediction step which takes in the worst case O(]GIn)-time for Earley's parser. Therefore, in the most favorable scenario, the parser we SKerael shift and non-kernel shift moves require both at most O(IGIn 2 )-time.",
"cite_spans": [
{
"start": 230,
"end": 245,
"text": "(Schabes, 1991)",
"ref_id": null
}
],
"ref_spans": [],
"eq_spans": [],
"section": "Correctness and Comparison with Earley's Parser",
"sec_num": "5"
},
{
"text": "6Due to the lack of space, the details of the implementation are not given in this paper but they are given in (Schabes, 1991 ).",
"cite_spans": [
{
"start": 111,
"end": 125,
"text": "(Schabes, 1991",
"ref_id": null
}
],
"ref_spans": [],
"eq_spans": [],
"section": "Correctness and Comparison with Earley's Parser",
"sec_num": "5"
},
{
"text": "propose will require O(IGln) less time than Earley's parser.",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "Correctness and Comparison with Earley's Parser",
"sec_num": "5"
},
{
"text": "For a given context-free grammar G and an input string al .-.an, let C be the set of items produced by the parser and CearZey be the set of items produced by Earley's parser. Earley's parser (Earley, 1970) produces items of the form (A ---* a * ~, i, j) where A --* a \u2022 ~ is a single dotted rule and not a set of dotted rules.",
"cite_spans": [
{
"start": 191,
"end": 205,
"text": "(Earley, 1970)",
"ref_id": "BIBREF3"
}
],
"ref_spans": [
{
"start": 233,
"end": 253,
"text": "(A ---* a * ~, i, j)",
"ref_id": null
}
],
"eq_spans": [],
"section": "Correctness and Comparison with Earley's Parser",
"sec_num": "5"
},
{
"text": "The following lemma shows how one can map the items that the parser produces to the items that Earley's parser produces for the same grammar and input: The proof of the above lemma is by induction on the number of kernel items added to the chart created by Earley's parser.",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "Correctness and Comparison with Earley's Parser",
"sec_num": "5"
},
{
"text": "Lemma 1 If Cs, i,j) E C",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "Correctness and Comparison with Earley's Parser",
"sec_num": "5"
},
{
"text": "The correctness of the parser follows from Lemma 1 and its completeness from Lemma 2 since it is well known that the items created by Earley's parser are characterized as follows (see, for example, page 323 in Aho and Ullman [1973] for a proof of this invariant): The parser we propose is therefore more efficient than Earley's parser since it has compiled out prediction before run time. How much more efficient it is, depends on how prolific the prediction is and therefore on the nature of the grammar and the input string.",
"cite_spans": [
{
"start": 210,
"end": 231,
"text": "Aho and Ullman [1973]",
"ref_id": "BIBREF0"
}
],
"ref_spans": [],
"eq_spans": [],
"section": "Correctness and Comparison with Earley's Parser",
"sec_num": "5"
},
{
"text": "The parser can be easily extended to incorporate standard optimization techniques proposed for predictive parsers.",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "Optimizations",
"sec_num": "6"
},
{
"text": "The closure operation which defines how a state is constructed already optimizes the parser on chain derivations in a manner very similar to the techniques originally proposed by Graham eta] . (1980) and later also used by Leiss (1990) .",
"cite_spans": [
{
"start": 179,
"end": 190,
"text": "Graham eta]",
"ref_id": null
},
{
"start": 193,
"end": 199,
"text": "(1980)",
"ref_id": null
},
{
"start": 223,
"end": 235,
"text": "Leiss (1990)",
"ref_id": null
}
],
"ref_spans": [],
"eq_spans": [],
"section": "Optimizations",
"sec_num": "6"
},
{
"text": "In addition, the closure operation can be designed to optimize the processing of non-terminal symbols that derive the empty string in manner very similar to the one proposed by Graham et al. (1980) and Leiss (1990) . The idea is to perform the reduction of symbols that derive the empty string at compilation time, i.e. include this type of reduction in the definition of closure by adding (iii):",
"cite_spans": [
{
"start": 177,
"end": 197,
"text": "Graham et al. (1980)",
"ref_id": "BIBREF4"
},
{
"start": 202,
"end": 214,
"text": "Leiss (1990)",
"ref_id": null
}
],
"ref_spans": [],
"eq_spans": [],
"section": "Optimizations",
"sec_num": "6"
},
{
"text": "If s is a state, then closure(s) is now the state constructed from s by the three rules: The rest of the parser remains as before.",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "Optimizations",
"sec_num": "6"
},
{
"text": "(i) Initially,",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "Optimizations",
"sec_num": "6"
},
{
"text": "In the previous section we have constructed a machine whose number of states is in the worst case proportional to the size of the grammar. This requirement is essential to guarantee that the complexity of the resulting parser with respect to the grammar size is not exponential or worse than O(IGI2)time as other well known parsers. However, we may use some non-determinism in the machine to guarantee this property. The non-determinism of the machine is not a problem since we have shown how the non-deterministic machine can be efficiently driven in pseudo-parallel (in O([G[2n3)-time) .",
"cite_spans": [
{
"start": 568,
"end": 587,
"text": "(in O([G[2n3)-time)",
"ref_id": null
}
],
"ref_spans": [],
"eq_spans": [],
"section": "Variants on the basic machine",
"sec_num": "7"
},
{
"text": "We can now ask the question of whether it is possible to determinize the finite state control of the machine while still being able to bound the complexity of the parser to O([Gl2n3)-time. Johnson (1989) exhibits grammars for which the full determinization of the finite state control (the LR(0) construction) leads to a parser with exponential complexity, because the finite state control has an exponential number of states and also because there are some input string for which an exponential number of states will be reached. However, there are also cases where the full determin~ation either will not increase the number of states or will not lead to a parser with exponential complexity because there are no input that require to reach an exponential number of states. We are currently studying the classes of grammars for which this is the case.",
"cite_spans": [
{
"start": 189,
"end": 203,
"text": "Johnson (1989)",
"ref_id": "BIBREF5"
}
],
"ref_spans": [],
"eq_spans": [],
"section": "Variants on the basic machine",
"sec_num": "7"
},
{
"text": "One can also try to determinize portions of the finite state automaton from which the control is derived while making sure that the number of states does not become larger than O(IGI).",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "Variants on the basic machine",
"sec_num": "7"
},
{
"text": "All these variants of the basic parser obtained by determinizing portions of the basic non-deterministic push-down machine can be driven in pseudo-parallel by the same pseudo-parallel driver that we previously defined. These variants lead to a set of more efficient machines since the non-determinism is decreased.",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "Variants on the basic machine",
"sec_num": "7"
},
{
"text": "We have introduced a shift-reduce parser for unrestricted context-free grammars based on the construction of a non-deterministic machine and we have formally proven its superior performance compared to Earley's parser.",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "Conclusion",
"sec_num": "8"
},
{
"text": "The technique which we employed consists of constructing before run-time a parsing table that encodes a non-deterministic machine in the which the predictive behavior has been compiled out. At run time, the machine is driven in pseudo-parallel with the help a chart.",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "Conclusion",
"sec_num": "8"
},
{
"text": "By defining two kinds of shift moves (on kernel dotted rules and on non-kernel dotted rules) and two kinds of reduce moves (on kernel and non-kernel dotted rules), we have been able to efficiently evaluate in pseudo-parallel the non-deterministic push down machine constructed for the given context-free grammar.",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "Conclusion",
"sec_num": "8"
},
{
"text": "The same worst case complexity as Earley's recognizer is achieved: O(IGl2na)-time and O(IG]n2)space. However, in practice, it is superior to Earley's parser since all the prediction steps and some of the completion steps have been compiled before run-time. The parser can be modified to simulate other types of machines (such LR(k)-like or SLR-like automata). It can also be extended to handle unification based grammars using a similar method as that employed by Shieber (1985) for extending Earley's algorithm.",
"cite_spans": [
{
"start": 464,
"end": 478,
"text": "Shieber (1985)",
"ref_id": null
}
],
"ref_spans": [],
"eq_spans": [],
"section": "Conclusion",
"sec_num": "8"
},
{
"text": "Furthermore, the algorithm can be tuned to a par-ticular grammar and therefore be made more efficient by carefully determinizing portions of the nondeterministic machine while making sure that the number of states in not increased. These variants lead to more efficient parsers than the one based on the basic non-deterministic push-down machine. Furthermore, the same pseudo-parallel driver can be used for all these machines. We have adapted the technique presented in this paper to other grammatical formalism such as treeadjoining grammars (Schabes, 1991) .",
"cite_spans": [
{
"start": 544,
"end": 559,
"text": "(Schabes, 1991)",
"ref_id": null
}
],
"ref_spans": [],
"eq_spans": [],
"section": "Conclusion",
"sec_num": "8"
},
{
"text": "The same arguraent for the exponential graramar size complexity of Tomita's parser(Johnson, 1989) holds for Lang's technique.2 This problem is particularly acute for natural language processing since in this context the input length is typically small (10-20 words) and the granunar size very large (hundreds or thousands of rules and symbols).",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "",
"sec_num": null
}
],
"back_matter": [
{
"text": "Hans Leiss. 1990 ",
"cite_spans": [
{
"start": 5,
"end": 16,
"text": "Leiss. 1990",
"ref_id": null
}
],
"ref_spans": [],
"eq_spans": [],
"section": "annex",
"sec_num": null
},
{
"text": "We give an example that illustrates how the recognizer works. The grammar used for the example generates the language L = {a(ba)nln >_ O} and is infinitely ambiguous:The set of states and the goto function are shown in Figure 1 . In Figure 1 , the set of states is {0, 1, 2, 3, 4, 5}. We have marked with a sharp sign (~) transitions on a non-kernel dotted rule. If an arc from 51 to 52 is labeled by a non-sharped symbol X, then s2 is in gotot(Sl,X). If an arc from sl to 52 is labeled by a sharped symbol X~, then 52 is in gotont(Sx, X). The input string given to the recognizer is: ababa$ ($ is the end marker). The chart is shown in Figure 3. In Figure 3 , an arc labeled by s from position i to position j denotes the item (s, i,j) . The input is accepted since the final states 2 and 5 span the entire string ((2, 0, 5) E C and (5, 0, 5) E C). Notice that there are multiple arcs subsuming the same substring. ( 1,0, 3)(1,2, 3)15,0,3) (4, O, 4)(4, 2, 4) (3,4,5) (2,0,5) (2,2,5) (2,4,5) (1,0,5) (1,2,5) (1,4,5) (5,0,5)(5,2,5) ",
"cite_spans": [
{
"start": 728,
"end": 736,
"text": "(s, i,j)",
"ref_id": null
}
],
"ref_spans": [
{
"start": 219,
"end": 227,
"text": "Figure 1",
"ref_id": null
},
{
"start": 233,
"end": 241,
"text": "Figure 1",
"ref_id": null
},
{
"start": 637,
"end": 643,
"text": "Figure",
"ref_id": null
},
{
"start": 650,
"end": 658,
"text": "Figure 3",
"ref_id": null
},
{
"start": 918,
"end": 940,
"text": "1,0, 3)(1,2, 3)15,0,3)",
"ref_id": null
}
],
"eq_spans": [],
"section": "An Example",
"sec_num": null
}
],
"bib_entries": {
"BIBREF0": {
"ref_id": "b0",
"title": "Theory of Parsing",
"authors": [
{
"first": "A",
"middle": [
"V"
],
"last": "Aho",
"suffix": ""
},
{
"first": "J",
"middle": [
"D"
],
"last": "Ullman",
"suffix": ""
}
],
"year": 1973,
"venue": "Translation and Compiling",
"volume": "I",
"issue": "",
"pages": "",
"other_ids": {},
"num": null,
"urls": [],
"raw_text": "A. V. Aho and J. D. Ullman. 1973. Theory of Pars- ing, Translation and Compiling. Vol I: Parsing.",
"links": null
},
"BIBREF2": {
"ref_id": "b2",
"title": "An Efficient Context-Free Parsing Algorithm",
"authors": [
{
"first": "Jay",
"middle": [
"C"
],
"last": "Earley",
"suffix": ""
}
],
"year": 1968,
"venue": "",
"volume": "",
"issue": "",
"pages": "",
"other_ids": {},
"num": null,
"urls": [],
"raw_text": "Jay C. Earley. 1968. An Efficient Context-Free Pars- ing Algorithm. Ph.D. thesis, Carnegie-Mellon Uni- versity, Pittsburgh, PA.",
"links": null
},
"BIBREF3": {
"ref_id": "b3",
"title": "An efficient context-free parsing algorithm",
"authors": [
{
"first": "Jay",
"middle": [
"C"
],
"last": "Earley",
"suffix": ""
}
],
"year": 1970,
"venue": "Commun. ACM",
"volume": "13",
"issue": "2",
"pages": "94--102",
"other_ids": {},
"num": null,
"urls": [],
"raw_text": "Jay C. Earley. 1970. An efficient context-free parsing algorithm. Commun. ACM, 13(2):94-102.",
"links": null
},
"BIBREF4": {
"ref_id": "b4",
"title": "An improved context-free recognizer",
"authors": [
{
"first": "S",
"middle": [
"L"
],
"last": "Graham",
"suffix": ""
},
{
"first": "M",
"middle": [
"A"
],
"last": "Harrison",
"suffix": ""
},
{
"first": "W",
"middle": [
"L"
],
"last": "Ruzzo",
"suffix": ""
}
],
"year": 1980,
"venue": "ACM Transactions on Programming Languages and Systems",
"volume": "2",
"issue": "3",
"pages": "415--462",
"other_ids": {},
"num": null,
"urls": [],
"raw_text": "S.L. Graham, M.A. Harrison, and W.L. Ruzzo. 1980. An improved context-free recognizer. ACM Trans- actions on Programming Languages and Systems, 2(3):415-462, July.",
"links": null
},
"BIBREF5": {
"ref_id": "b5",
"title": "The computational complexity of Tomlta's algorithm",
"authors": [
{
"first": "Mark",
"middle": [],
"last": "Johnson",
"suffix": ""
}
],
"year": 1989,
"venue": "Proceedings of the International Workshop on Parsing Technologies",
"volume": "",
"issue": "",
"pages": "",
"other_ids": {},
"num": null,
"urls": [],
"raw_text": "Mark Johnson. 1989. The computational complex- ity of Tomlta's algorithm. In Proceedings of the International Workshop on Parsing Technologies, Pittsburgh, August.",
"links": null
},
"BIBREF6": {
"ref_id": "b6",
"title": "An efficient recognition and syntax algorithm for context-free languages",
"authors": [
{
"first": "T",
"middle": [],
"last": "Kasami",
"suffix": ""
}
],
"year": 1965,
"venue": "",
"volume": "",
"issue": "",
"pages": "",
"other_ids": {},
"num": null,
"urls": [],
"raw_text": "T. Kasami. 1965. An efficient recognition and syn- tax algorithm for context-free languages. Technical Report AF-CRL-65-758, Air Force Cambridge Re- search Laboratory, Bedford, MA.",
"links": null
},
"BIBREF7": {
"ref_id": "b7",
"title": "Analysis of Tomita's algorithm for general context-free parsing",
"authors": [
{
"first": "R",
"middle": [],
"last": "James",
"suffix": ""
},
{
"first": "",
"middle": [],
"last": "Kipps",
"suffix": ""
}
],
"year": 1989,
"venue": "Proceedings of the International Workshop on Parsing Technologies",
"volume": "",
"issue": "",
"pages": "",
"other_ids": {},
"num": null,
"urls": [],
"raw_text": "James R. Kipps. 1989. Analysis of Tomita's al- gorithm for general context-free parsing. In Pro- ceedings of the International Workshop on Parsing Technologies, Pittsburgh, August.",
"links": null
},
"BIBREF8": {
"ref_id": "b8",
"title": "On the translation of languages from left to right",
"authors": [
{
"first": "D",
"middle": [
"E"
],
"last": "Knuth",
"suffix": ""
}
],
"year": 1965,
"venue": "Information and Control",
"volume": "8",
"issue": "",
"pages": "607--639",
"other_ids": {},
"num": null,
"urls": [],
"raw_text": "D. E. Knuth. 1965. On the translation of languages from left to right. Information and Control, 8:607- 639.",
"links": null
},
"BIBREF9": {
"ref_id": "b9",
"title": "Deterministic techniques for efficient non-deterministic parsers",
"authors": [
{
"first": "Bernard",
"middle": [],
"last": "Lang",
"suffix": ""
}
],
"year": 1974,
"venue": "Automata, Languages and Programming",
"volume": "",
"issue": "",
"pages": "",
"other_ids": {},
"num": null,
"urls": [],
"raw_text": "Bernard Lang. 1974. Deterministic tech- niques for efficient non-deterministic parsers. In Jacques Loeckx, editor, Automata, Languages and Programming, 2nd Colloquium, University of Saarbr~cken. Lecture Notes in Computer Science, Springer Verlag.",
"links": null
}
},
"ref_entries": {
"FIGREF0": {
"type_str": "figure",
"uris": null,
"num": null,
"text": "dotted rule of a context-free grammar G is defined as a production of G associated with a dot at some position of the right hand side: A ~ a \u2022/~ with A --~ afl E P. We distinguish two kinds of dotted rules. Kernel dotted rules, which are of the form A ~ a \u2022 fl with a non empty, and non-kernel dotted rules, which have the dot at the left most position in the right hand side (A --~ \u20221~)"
},
"FIGREF1": {
"type_str": "figure",
"uris": null,
"num": null,
"text": "The use of these tables is explained below.The action table is accessed by a state and a terminal symbol. It contains a set of actions. Given an item,(s, i,j), the possible actions are determined by the content of ACTION(s, aj+x) where aj+l is the j + 1 th input token. The possible actions contained in ACTION(s, aj+l) are the following:\u2022 KERNEL SHIFT s t, (ksh(s t) for short), for s t E S. Anew token is recognized in a kernel dotted rule A --* a \u2022 aft and a push move is performed. The item (s I, i,j + 1) is added to the chart, since aa spans in this case w]i,j+l]. \u2022 NON-KERNEL SHIFT s t, (nksh(s I) for short), for s t E S. A new token is recognized in a nonkernel dotted rule of the form A --* \u2022aft. The item (s',j,j + 1) is is added to the chart, since a spans in this case wljj+x ] \u2022 REDUCE X ---. fl, (red(X ---* fl) for short), for X --* ~ E P. The context-free rule X --*/~ has been totally recognized. The rule spans the substring ai+z ...aj. For all items in the chart of the form (s ~, k, i), perform the following two steps: -for all rl E GOTOk(s',X), it adds the item (ra, k,j) to the chart. In this case, a dotted rule of the form A ~ a \u2022 Xfl is combined with X --* fl\u2022 to form A ---* aX \u2022/~; since a spans w]k,i] and X spans wli,j], aX spans w]k,j].-for all r2 E GOTOnk(s t, X), it adds the item (r2,i,j) to the chart. In this case, a dotted rule of the form A ~ \u2022 Xf~ is combined with X --~ fl\u2022 to form A ~ X \u2022/~; in this case X spans w]idl-4This property holds for all machines derived from the basic NPDA."
},
"FIGREF2": {
"type_str": "figure",
"uris": null,
"num": null,
"text": "{closure({S --, .~ I S-* a e P})} repeat for each state s in 8"
},
"FIGREF3": {
"type_str": "figure",
"uris": null,
"num": null,
"text": "The worst case time complexity of the parser is the same as for the recognizer (O([GI2n3)-time) but, as for Earley's parser, the worst case space complexity increases to O([G[2n 3) because of the additional bookkeeping."
},
"FIGREF4": {
"type_str": "figure",
"uris": null,
"num": null,
"text": "then we have: (i) for all kernel dotted rules A ~ a \u2022 ~ E s, we have C A ~ ct \u2022 ~, i, j) E CearIey (ii) and for all non-kernel dotted rules A ---, *j3 E s, we have C A ~ \u2022~, j, j) E Cearaev The proof of the above lemma is by induction on the number of items added to the chart C. This shows that an item is mapped into a set of items produced by Earley's parser. By construction, in a given state s E S, non-kernel dotted rules have been introduced before run-time by the closure of kernel dotted rules. It follows that Earley's parser can require O(IGln) more space since all Earley's items of the form C A ~ \u2022a, i, i) (i E [0, n]) are not stored separately from the kernel dotted rule which introduced them. Conversely, each kernel item in the chart created by Earley's parser can be put into correspondence with an item created by the parser we propose. Lemma 2 If CA --* a \u2022 fl, i,j) E CearZev and if (~ # e, then C s, i,j) e C where s = closure({A ~ a \u2022 fl})."
},
"FIGREF5": {
"type_str": "figure",
"uris": null,
"num": null,
"text": "C A --. a \u2022 fl, i, j) E Ceartey if and only if, ST E (VNT U VT)* such that S\"~W]o,i]XT and X==c, FA=~w]ij]A."
},
"TABREF0": {
"content": "<table><tr><td>The goto tables are accessed by a state and a non-</td></tr><tr><td>terminal symbol. They each contain a set of states:</td></tr></table>",
"type_str": "table",
"num": null,
"html": null,
"text": "such that S~w]o,i]A 7 and a=:=~w]~d]; (ii) if a is the empty string, then B 7 E (NT O ~)* such that S=~w]0./]A 7. The parser uses three tables to determine which move(s) to perform: an action table, ACTION, and two goto tables, the kernel goto table, GOTOk, and the non-kernel goto table, GOTOnk."
},
"TABREF2": {
"content": "<table><tr><td colspan=\"4\">every dotted rule in s is added to</td></tr><tr><td>closure(s);</td><td/><td/><td/></tr><tr><td colspan=\"4\">(ii) If A --* a \u2022 B/~ is in closure(s) and B --* 7 is a</td></tr><tr><td colspan=\"4\">production, then add the dotted rule B --* e7 to</td></tr><tr><td colspan=\"4\">closure(s) If s is a state and if X is a non-terminal or terminal</td></tr><tr><td colspan=\"4\">symbol, gotok(s,X) and gotonk(s,X) are the set of</td></tr><tr><td colspan=\"2\">states defined as follows:</td><td/><td/></tr><tr><td>gotok(s, X) =</td><td/><td/><td/></tr><tr><td>{closure({A</td><td>\u2022</td><td>A -*</td><td>\u2022 XZ e s</td></tr><tr><td/><td/><td colspan=\"2\">and a E (Z3 U NT) + }</td></tr><tr><td>gotonk ( s, X ) =</td><td/><td/><td/></tr><tr><td>{closure({A</td><td/><td/><td/></tr></table>",
"type_str": "table",
"num": null,
"html": null,
"text": "(if it is not already there). This rule is applied until no more new dotted rules can be added to closure(s)."
},
"TABREF4": {
"content": "<table><tr><td/><td colspan=\"2\">every dotted rule in s is added to</td></tr><tr><td colspan=\"2\">closure(s);</td><td/></tr><tr><td>(ii) ifA~</td><td>a.Bflisinclosure(s)</td><td>andB ~ 7is</td></tr><tr><td colspan=\"3\">a production, then add the dotted rule B ~ \u2022 7</td></tr><tr><td colspan=\"2\">to closure(s) (if it is not already there).</td><td/></tr><tr><td colspan=\"3\">Rules (ii) and (iii) are applied until no more new</td></tr><tr><td colspan=\"3\">dotted rules can be added to closure(s).</td></tr></table>",
"type_str": "table",
"num": null,
"html": null,
"text": "(if it is not already there); (iii) ifA ~ a.B~ is in closure(s) and ifB=~ e, then add the dotted rule A ~ aB \u2022 ~ to closure(s)"
}
}
}
} |