Mail us on hr javatpoint. Please mail your requirement at hr javatpoint. Duration: 1 week to 2 week. Automata Tutorial. Next Topic Derivation. Digital E. Given two CFGs, can the first one generate all strings that the second one can generate? Using Greibach's theorem , it can be shown that the two following problems are undecidable:. The undecidability of this problem follows from the fact that if an algorithm to determine ambiguity existed, the Post correspondence problem could be decided, which is known to be undecidable.
An obvious way to extend the context-free grammar formalism is to allow nonterminals to have arguments, the values of which are passed along within the rules. This allows natural language features such as agreement and reference , and programming language analogs such as the correct use and definition of identifiers, to be expressed in a natural way. In computer science, examples of this approach include affix grammars , attribute grammars , indexed grammars , and Van Wijngaarden two-level grammars.
Similar extensions exist in linguistics. An extended context-free grammar or regular right part grammar is one in which the right-hand side of the production rules is allowed to be a regular expression over the grammar's terminals and nonterminals.
Extended context-free grammars describe exactly the context-free languages. Another extension is to allow additional terminal symbols to appear at the left-hand side of rules, constraining their application.
This produces the formalism of context-sensitive grammars. LR parsing extends LL parsing to support a larger range of grammars; in turn, generalized LR parsing extends LR parsing to support arbitrary context-free grammars. On LL grammars and LR grammars, it essentially performs LL parsing and LR parsing, respectively, while on nondeterministic grammars , it is as efficient as can be expected.
Chomsky initially hoped to overcome the limitations of context-free grammars by adding transformation rules. Such rules are another standard device in traditional linguistics; e. Much of generative grammar has been devoted to finding ways of refining the descriptive mechanisms of phrase-structure grammar and transformation rules such that exactly the kinds of things can be expressed that natural language actually allows. Allowing arbitrary transformations does not meet that goal: they are much too powerful, being Turing complete unless significant restrictions are added e.
Chomsky's general position regarding the non-context-freeness of natural language has held up since then,  although his specific examples regarding the inadequacy of context-free grammars in terms of their weak generative capacity were later disproved. From Wikipedia, the free encyclopedia. Type of formal grammar. This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources.
Unsourced material may be challenged and removed. This section needs additional citations for verification. July Learn how and when to remove this template message. Main article: Regular grammar. Hopcroft, Rajeev Motwani, Jeffrey D. Ullman, Addison Wesley, , p. Every construct that can be described by a regular expression can be described by a [context-free] grammar, but not vice-versa. General context-free recognition in less than cubic time Technical report.
Carnegie Mellon University. Valiant Ris Ris 1, 7 7 gold badges 21 21 silver badges 36 36 bronze badges. Note that the grammar is not only context free, but also regular. It is not possible to convert every CFG into a regular expression. Active Oldest Votes. So let's replace Y also in S derived sentential form. Grijesh Chauhan Grijesh Chauhan Archisman Pathak Archisman Pathak 23 5 5 bronze badges. Sign up or log in Sign up using Google. You can achieve that by the following steps: Translate the regular expression into an NFA.
Translate the NFA into a right- regular grammar. I give the high-level answer, without many details. Hendrik Jan Hendrik Jan This is essentially equivalent to Hendrik's answer, but with more detail which may be useful.