请输入您要查询的百科知识:

 

词条 Deterministic context-free grammar
释义

  1. History

  2. See also

  3. References

In formal grammar theory, the deterministic context-free grammars (DCFGs) are a proper subset of the context-free grammars. They are the subset of context-free grammars that can be derived from deterministic pushdown automata, and they generate the deterministic context-free languages. DCFGs are always unambiguous, and are an important subclass of unambiguous CFGs; there are non-deterministic unambiguous CFGs, however.

DCFGs are of great practical interest, as they can be parsed in linear time and in fact a parser can be automatically generated from the grammar by a parser generator. They are thus widely used throughout computer science. Various restricted forms of DCFGs can be parsed by simpler, less resource-intensive parsers, and thus are often used. These grammar classes are referred to by the type of parser that parses them, and important examples are LALR, SLR, and LL.

History

In the 1960s, theoretical research in computer science on regular expressions and finite automata led to the discovery that context-free grammars are equivalent to nondeterministic pushdown automata.[1][2][3] These grammars were thought to capture the syntax of computer programming languages. The first computer programming languages were under development at the time (see History of programming languages) and writing compilers was difficult. But using context-free grammars to help automate the parsing part of the compiler simplified the task. Deterministic context-free grammars were particularly useful because they could be parsed sequentially by a deterministic pushdown automaton, which was a requirement due to computer memory constraints.[4] In 1965, Donald Knuth invented the LR(k) parser and proved that there exists an LR(k) grammar for every deterministic context-free language.[5] This parser still required a lot of memory. In 1969 Frank DeRemer invented the LALR and Simple LR parsers, both based on the LR parser and having greatly reduced memory requirements at the cost of less language recognition power. The LALR parser was the stronger alternative.[6] These two parsers have since been widely used in compilers of many computer languages. Recent research has identified methods by which canonical LR parsers may be implemented with dramatically reduced table requirements over Knuth's table-building algorithm.[7]

See also

  • Deterministic parsing
  • LL parser

References

1. ^{{cite journal | last=Chomsky | first=Noam | title=Context Free Grammars and Pushdown Storage | work=Quarterly Progress Report, MIT Research Laboratory in Electronics | volume=65 | pages=187–194 | year=1962 }}
2. ^{{cite journal | last=Evey | first=R.J. | title=Application of Pushdown-Store Machines | work=1963 AFIPS Proceedings of the Fall Joint Computer Conference | pages=215–227 | year=1963 }}
3. ^{{cite journal | last=Schützenberger | first=Marcel Paul | title=On Context-Free Languages and Push-Down Automata | work=Information and Control | volume=6 | pages=246–264 | year=1963 | doi=10.1016/s0019-9958(63)90306-1 }}
4. ^{{cite book | editors = A Salomaa, D Wood, S Yu | editor-link = A Salomaa | editor2-link = D Wood | editor3-link = S Yu | title = A Half-Century of Automata Theory | year = 2001 | publisher = World Scientific Publishing Co. Pte. Ltd. | pages =38–39 }}
5. ^{{Cite journal | last1 = Knuth | first1 = D. E. | authorlink = Donald Knuth | title = On the translation of languages from left to right | doi = 10.1016/S0019-9958(65)90426-2 | journal = Information and Control | volume = 8 | issue = 6 | pages = 607–639 | date=July 1965 | url = http://www.cs.dartmouth.edu/~mckeeman/cs48/mxcom/doc/knuth65.pdf | accessdate=29 May 2011 | ref = harv }}
6. ^{{cite web|title=Practical Translators for LR(k) languages |url=http://computer-refuge.org/bitsavers/pdf/mit/lcs/tr/MIT-LCS-TR-065.pdf |author=Franklin L. DeRemer |publisher=MIT, PhD Dissertation |year=1969 |deadurl=yes |archiveurl=https://web.archive.org/web/20120405124425/http://computer-refuge.org/bitsavers/pdf/mit/lcs/tr/MIT-LCS-TR-065.pdf |archivedate=2012-04-05 |df= }}
7. ^X. Chen, Measuring and extending LR(1) parsing, University of Hawaii PhD dissertation, 2009.
{{Formal languages and grammars}}

1 : Formal languages

随便看

 

开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。

 

Copyright © 2023 OENC.NET All Rights Reserved
京ICP备2021023879号 更新时间:2024/9/21 13:19:48