Deterministic context-free language

Deterministic context-free language

From Wikipedia, the free encyclopedia
 
 

In formal language theorydeterministic context-free languages (DCFL) are a proper subset of context-free languages. They are the context-free languages that can be accepted by a deterministic pushdown automaton.

Description[edit source | editbeta]

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.[1] Unambiguous grammars do not always generate a DCFL. For example, the language of even-lengthpalindromes 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. [2]

Properties[edit source | editbeta]

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

Importance[edit source | editbeta]

The languages of this class have great practical importance in computer science as they can be parsed much more efficienly 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(n2.378) 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.[4] This is very important for computer languagetranslation because many computer languages belong to this class of languages.

See also[edit source | editbeta]

References[edit source | editbeta]

  1. ^ Hopcroft, John; Jeffrey Ullman (1979). Introduction to automata theory, languages, and computation. Addison-Wesley. p. 233.
  2. ^ Hopcroft, John; Rajeev Motwani & Jeffrey Ullman (2001). Introduction to automata theory, languages, and computation 2nd edition. Addison-Wesley. pp. 249–253.
  3. ^ 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.
  4. ^ Knuth, Donald (July 1965). "On the Translation of Languages from Left to Right"Information and Control 8: 707 – 639. Retrieved 29 May 2011.
原文地址:https://www.cnblogs.com/threef/p/3250021.html