Misplaced Pages

Deterministic context-free language: Difference between revisions

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.
Browse history interactively← Previous editNext edit →Content deleted Content addedVisualWikitext
Revision as of 01:14, 7 February 2015 editBgwhite (talk | contribs)Extended confirmed users547,151 editsm fix borked tag using AWB (10813)← Previous edit Revision as of 01:19, 30 April 2015 edit undo165.82.203.181 (talk) Corrected statement that DCFL's are a proper subset of CLF's: it is not known if they are a proper subset or equivalent.Next edit →
Line 1: Line 1:
In ], '''deterministic context-free languages''' ('''DCFL''') are a ] of ]s. They are the context-free languages that can be accepted by a ]. DCFLs are always unambiguous, meaning that they admit an ], but any (non-empty) DCFLs also admits ambiguous grammars. There are non-deterministic unambiguous CFLs, so DCFLs form a proper subset of unambiguous CFLs. In ], '''deterministic context-free languages''' ('''DCFL''') are a ] of ]s. They are the context-free languages that can be accepted by a ]. It is unknown if they are a proper subset of the context-free languages or equivalent to them.<ref>{{cite book|last=Martin|first=John C.|title=Introduction to Languages and the Theory of Computation|year=2010|publisher=McGraw-Hill|location=New York, NY|isbn=9780073191461|edition=4th|page=283}}</ref> DCFLs are always unambiguous, meaning that they admit an ], but any (non-empty) DCFLs also admits ambiguous grammars. There are non-deterministic unambiguous CFLs, so DCFLs form a proper subset of unambiguous CFLs.


DCFLs are of great practical interest, as they can be parsed in linear time, and various restricted forms of DCFGs admit simple practical parsers. They are thus widely used throughout computer science. DCFLs are of great practical interest, as they can be parsed in linear time, and various restricted forms of DCFGs admit simple practical parsers. They are thus widely used throughout computer science.

Revision as of 01:19, 30 April 2015

In formal language theory, deterministic context-free languages (DCFL) are a subset of context-free languages. They are the context-free languages that can be accepted by a deterministic pushdown automaton. It is unknown if they are a proper subset of the context-free languages or equivalent to them. DCFLs are always unambiguous, meaning that they admit an unambiguous grammar, but any (non-empty) DCFLs also admits ambiguous grammars. There are non-deterministic unambiguous CFLs, so DCFLs form a proper subset of unambiguous CFLs.

DCFLs are of great practical interest, as they can be parsed in linear time, and various restricted forms of DCFGs admit simple practical parsers. They are thus widely used throughout computer science.

Description

The notion of the DCFL is closely related to the deterministic pushdown automaton (DPDA). It is where the language power of a pushdown automaton is reduced if we make it deterministic; the pushdown automaton becomes unable to choose between different state transition alternatives and as a consequence cannot recognize all context-free languages. Unambiguous grammars do not always generate a DCFL. For example, the language of even-length palindromes on the alphabet of 0 and 1 has the unambiguous context-free grammar S → 0S0 | 1S1 | ε. An arbitrary string of this language cannot be parsed without reading all its letters first which means that a pushdown automaton has to try alternative state transitions to accommodate for the different possible lengths of a semi-parsed string.

Properties

Deterministic context-free languages can be recognized by a deterministic Turing machine in polynomial time and O(log2 n) space; as a corollary, DCFL is a subset of the complexity class SC. The set of deterministic context-free languages is not closed under union but is closed under complement.

Importance

The languages of this class have great practical importance in computer science as they can be parsed much more efficiently than nondeterministic context-free languages. The complexity of the program and execution time of a deterministic pushdown automaton is vastly less than that of a nondeterministic one. In the naive implementation, the latter must make copies of the stack every time a nondeterministic step occurs. The best known algorithm to test membership in any context-free language is Valiant's algorithm, taking O(n) time, where n is the length of the string. On the other hand, deterministic context-free languages can be accepted in O(n) time by a LR(k) parser. This is very important for computer language translation because many computer languages belong to this class of languages.

See also

References

  1. Martin, John C. (2010). Introduction to Languages and the Theory of Computation (4th ed.). New York, NY: McGraw-Hill. p. 283. ISBN 9780073191461.
  2. Hopcroft, John; Jeffrey Ullman (1979). Introduction to automata theory, languages, and computation. Addison-Wesley. p. 233.
  3. Hopcroft, John (2001). Introduction to automata theory, languages, and computation 2nd edition. Addison-Wesley. pp. 249–253. {{cite book}}: Unknown parameter |coauthors= ignored (|author= suggested) (help)
  4. S. A. Cook. Deterministic CFL's are accepted simultaneously in polynomial time and log squared space. Proceedings of ACM STOC'79, pp. 338–345. 1979.
  5. Attention: This template ({{cite doi}}) is deprecated. To cite the publication identified by doi:10.1016/S0019-9958(65)90426-2, please use {{cite journal}} (if it was published in a bona fide academic journal, otherwise {{cite report}} with |doi=10.1016/S0019-9958(65)90426-2 instead.
Automata theory: formal languages and formal grammars
Chomsky hierarchyGrammarsLanguagesAbstract machines
  • Type-0
  • Type-1
  • Type-2
  • Type-3
Each category of languages, except those marked by a , is a proper subset of the category directly above it. Any language in each category is generated by a grammar and by an automaton in the category in the same line.
Category: