| On the complexity of LR(k) testing |
| Full text |
Pdf
(913 KB)
|
Source
|
Communications of the ACM
archive
Volume 18 , Issue 12 (December 1975)
table of contents
Pages: 707 - 716
Year of Publication: 1975
ISSN:0001-0782
|
|
Authors
|
|
| Publisher |
|
| Bibliometrics |
Downloads (6 Weeks): 3, Downloads (12 Months): 21, Citation Count: 5
|
|
|
ABSTRACT
The problem of determining whether an arbitrary context-free grammar is a member of some easily parsed subclass of grammars such as the LR(k) grammars is considered. The time complexity of this problem is analyzed both when k is considered to be a fixed integer and when k is considered to be a parameter of the test. In the first case, it is shown that for every k there exists an O(nk+2) algorithm for testing the LR(k) property, where n is the size of the grammar in question. On the other hand, if both k and the subject grammar are problem parameters, then the complexity of the problem depends very strongly on the representation chosen for k. More specifically, it is shown that this problem is NP-complete when k is expressed in unary. When k is expressed in binary the problem is complete for nondeterministic exponential time. These results carry over to many other parameterized classes of grammars, such as the LL(k), strong LL(k), SLR(k), LC(k), and strong LC(k) grammars.
REFERENCES
Note: OCR errors may be found in this Reference List extracted from the full text article. ACM has opted to expose the complete List rather than only correct and linked references.
| |
1
|
Hunt, H.B. III, Szymanski, T.G. and Ullman, J.D. Operations on sparse relations and efficient algorithms for grammar problems. IEEE Conf. Rec., 15th Ann. Syrup. on Switching and Automata Theory, 1974, pp. 127-132.
|
| |
2
|
Hartmanis, J. Context-free languages and Turing machine computations. Proc. Syrup. Appl. Math. Vol. 19, Amer. Math. Soc., Providence R.I., 1967, pp. 45-51.
|
| |
3
|
|
| |
4
|
Knuth, D.E. On the translation of languages from left to right, lnfo. Contr., 8, 6 (1965), 607-639.
|
| |
5
|
Korenjak, A.J., and Hopcroft. J.E. Simple deterministic languages. IEEE Conf. Rec., 7th Ann. Syrup. on Switching and Automata Theory, 1966, pp. 36-46.
|
| |
6
|
Brosgol, B.M. Deterministic translation grammars. TR-3- 74, Center for Research in Computing Technology, Harvard U., 1974 (also Proc. 8th Ann. Princeton Conf. on Inform. Sci. and Systems, 1974, pp. 300-306.
|
| |
7
|
Younger, D. H. Recognition and parsing of context-free languages in time n 3. Inform. Contr., 10, 2 (1967), 189-208.
|
| |
8
|
Rosenkrantz, D.J. and Lewis P.M. II Deterministic left corner parsing. IEEE Conf. Rec., llth Ann. Symp. on Switching and Automata Theory, 1970, pp. 139-152.
|
| |
9
|
Johnson, D.B. and Sethi, R. Efficient construction of LL(1) Parsers. TR-164, Dep. of Computer Sci., Penn State U., State College, Pa., March 1975.
|
|