[go: up one dir, main page]
More Web Proxy on the site http://driver.im/ skip to main content
10.1145/800169.805433acmconferencesArticle/Chapter ViewAbstractPublication PagesstocConference Proceedingsconference-collections
Article
Free access

Efficient LR(1) processor construction

Published: 05 May 1969 Publication History

Abstract

Strings from LR(k) grammars can be recognized and parsed in linear time by a processor that is directed by a pre-computed parsing table. This paper deals with two questions of practical importance: the effort required to generate an LR(k)parsing table for a grammar and the size of the table generated. Knuth has described an algorithm for checking an arbitrary context-free grammar for the LR(k) condition and producing a parsing table, if possible. The time-complexity of this algorithm and the size of the table it produces are each exponential functions of the grammar size. Thus, for very large grammars — such as those defining the syntax of a programming language — it is not feasible to use this algorithm directly.
This paper presents a practical method of checking large cfgs for the LR(1) condition and generating the corresponding parsing table. It significantly decreases both the computation required to produce the parsing table and the size of the resulting table. It operates as follows. The given grammar G is partitioned into a number of parts. Each part is checked for LR(1)-ness and individual parsing tables are generated, using the Knuth algorithm. Certain conditional modifications to these tables are then made; if the conditions are satisfied, the grammar G is LR(1) and the modified tables can be combined into a single parsing table for G. Because of the exponential nature of the Knuth algorithm, this process of partitioning, computing and combining can greatly improve the efficiency of the table generation procedure.
Using this method LR(1) parsers for a number of programming languages, including ALGOL, have been constructed. The empirical evidence obtained has verified the efficacy of this method: in one programming language example, table construction time was reduced by a factor of nine and the table size was reduced by a factor of three.

References

[1]
Earley, J. An efficient context-free parsing algorithm. Thesis, Carnegie-Mellon University, Pittsburgh, Pa. (Aug. 1968).
[2]
Ginsburg, S. and Greibach, S. A. Deterministic context-free languages. Information and Control 9 (Dec. 1966), 620-648.
[3]
Knuth, D.E. On the translation of languages from left to right. Information and Control 8 (Dec. 1965), 607-639.
[4]
Korenjak, A. J. Determinisitic language processing. Thesis, Princeton University, Princeton, N. J. (Sept. 1967). Also, submitted for publication.
[5]
Srinivasan, C. V. An introduction to CDL1, a computer description language. Scientific Report No. 1, Contract No. AF19(628)4789, (Sept. 1967).

Cited By

View all
  • (2011)Full LR(1) parser generator Hyacc and study on the performance of LR(1) algorithmsProceedings of The Fourth International C* Conference on Computer Science and Software Engineering10.1145/1992896.1992907(83-92)Online publication date: 16-May-2011

Recommendations

Comments

Please enable JavaScript to view thecomments powered by Disqus.

Information & Contributors

Information

Published In

cover image ACM Conferences
STOC '69: Proceedings of the first annual ACM symposium on Theory of computing
May 1969
267 pages
ISBN:9781450374781
DOI:10.1145/800169
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 05 May 1969

Permissions

Request permissions for this article.

Check for updates

Qualifiers

  • Article

Acceptance Rates

Overall Acceptance Rate 1,469 of 4,586 submissions, 32%

Upcoming Conference

STOC '25
57th Annual ACM Symposium on Theory of Computing (STOC 2025)
June 23 - 27, 2025
Prague , Czech Republic

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)39
  • Downloads (Last 6 weeks)6
Reflects downloads up to 09 Jan 2025

Other Metrics

Citations

Cited By

View all
  • (2011)Full LR(1) parser generator Hyacc and study on the performance of LR(1) algorithmsProceedings of The Fourth International C* Conference on Computer Science and Software Engineering10.1145/1992896.1992907(83-92)Online publication date: 16-May-2011

View Options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Login options

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media