|
|
Line 1: |
Line 1: |
| In [[computer science]] and [[formal language]] theory, a [[context-free grammar]] is in '''Greibach normal form''' (GNF) if the right-hand sides of all [[production (computer science)|production]] rules start with a [[terminal symbol]], optionally followed by some variables. A non-strict form allows one exception to this format restriction for allowing the [[empty word]] (epsilon, ε) to be a member of the described language. The normal form bears the name of [[Sheila Greibach]].
| | Alyson Meagher is the name her parents gave her but she doesn't like when people use her full title. To climb is something I truly appreciate doing. My working day occupation is a journey agent. For a while I've been in Mississippi but now I'm contemplating other choices.<br><br>My web blog: love psychics ([http://yoparo.org/content/very-best-details-about-hobbies-you-may-read yoparo.org]) |
| | |
| More precisely, a context-free grammar is in Greibach normal form, if all production rules are of the form:
| |
| :<math>A \to \alpha A_1 A_2 \cdots A_n</math>
| |
| or
| |
| :<math>S \to \varepsilon</math>
| |
| where <math>A</math> is a [[nonterminal symbol]], <math>\alpha</math> is a terminal symbol,
| |
| <math>A_1 A_2 \ldots A_n</math> is a (possibly empty) sequence of nonterminal symbols not including the start symbol, ''S'' is the start symbol, and ''ε'' is the [[empty word]].
| |
| | |
| Observe that the grammar does not have [[left recursion]]s.
| |
| | |
| Every context-free grammar can be transformed into an equivalent grammar in Greibach normal form.<ref>{{cite journal | last=Greibach | first=Sheila | title=A New Normal-Form Theorem for Context-Free Phrase Structure Grammars |date=January 1965| work=Journal of the ACM | volume=12| issue=1}}</ref> Various constructions exist. Some do not permit the second form of rule and cannot transform context-free grammars that can generate the empty word. One such construction the size of the constructed grammar is ''O(n<sup>4</sup>)'' in the general case and ''O(n<sup>3</sup>)'' if no derivation of the original grammar consists of a single nonterminal symbol, where ''n'' is the size of the original grammar.<ref>{{cite journal | first1 = Norbert | last1 = Blum | first2 = Robert | last2 = Koch | title = Greibach Normal Form Transformation Revisited | journal = Information and Computation | volume = 150 | issue = 1 | year = 1999 | pages = 112–118 | id = {{citeseerx|10.1.1.47.460}} }}</ref> This conversion can be used to prove that every [[context-free language]] can be accepted by a non-deterministic [[pushdown automaton]].
| |
| | |
| Given a grammar in GNF and a derivable string in the grammar with length ''n'', any [[top-down parsing|top-down parser]] will halt at depth ''n''.
| |
| | |
| == See also ==
| |
| *[[Backus-Naur form]]
| |
| *[[Chomsky normal form]]
| |
| *[[Kuroda normal form]]
| |
| | |
| ==Notes==
| |
| <references/>
| |
| | |
| == References ==
| |
| * {{cite book | first1 = John E. | last1 = Hopcroft | first2 = Jeffrey D. | last2 = Ullman | title = Introduction to Automata Theory, Languages and Computation | publisher = Addison-Wesley Publishing | location = Reading, Massachusetts | year = 1979 | isbn = 0-201-02988-X | postscript = }} ''(See chapter 4.)''
| |
| | |
| [[Category:Formal languages]]
| |
Revision as of 00:54, 4 March 2014
Alyson Meagher is the name her parents gave her but she doesn't like when people use her full title. To climb is something I truly appreciate doing. My working day occupation is a journey agent. For a while I've been in Mississippi but now I'm contemplating other choices.
My web blog: love psychics (yoparo.org)