One of the simplest and most useful simplified forms of. CFG is called the Chomsky normal form. Chomsky and Greibach Normal Forms – p.2/ 1 Greibach Normal Form (GNF). A CFG G = (V,T,R,S) is said to be in GNF if every production is of the form. A → aα, where a ∈ T and α ∈ V ∗. Greibach Normal Form - Free download as Powerpoint Presentation .ppt), PDF File .pdf), Text File .txt) or view presentation slides online.
|Language:||English, German, Portuguese|
|Genre:||Business & Career|
|ePub File Size:||26.41 MB|
|PDF File Size:||9.45 MB|
|Distribution:||Free* [*Registration needed]|
Greibach Normal Form 1. Greibach Normal Form. Definition Greibach Normal Form (GNF). A CFG is in Greibach Normal Form if all productions are of the form. We present an algorithm which given an arbitrary A-free context-free grammar produces an equivalent context-free grammar in 2 Greibach normal form. The. Chomsky and Greibach. Normal Forms. Fall Review. • Languages and Grammars. – Alphabets, strings, languages. • Regular Languages. – Deterministic.
Now we consider the cover-relztion between grammars. In the following definition of cover left parses are mapped on right parses.
Definition 2. Variants of this definition can be found in [ 1,3,7]. Analogous definitions can be given for right covers, in which case right parses are mapped on right parses, for left covers left parses on left parses and for rightto-left covers right parses on left parses.
Notice that with our definition productions are mapped on possibly empty strings of productions.
In the definif ion of Aho and Ullman [I ] q should also be considerrd as a fine cover-homomorphism. Since our definition is slightly more general some cover results can be obtained which are not obtain3ble with the definitions which make use of a fine cover-homomorphism.
Example 1. Theorem 1.
It is the aim of this paper to show that with our definition each left-regular grammar hence, also Ge can be right covered and left-to-right covered by a Greibach normal form grammar. A few notes on notations are in order.
We use the notation i. Covers for left-regulargrammars The two transformations presented in this section are very simple, therefore we omit detailed proofs.
The first algorithm is a well-known method to obtain a right-regular grammar from a left-regular grammar. Blum, More on the power of chain rules in context-free grammars, TCS 27 , — CrossRef Google Scholar 3.
Greibach, A new normal-form theorem for context-free, phrase-structure grammars, JACM 12 , 42— CrossRef Google Scholar 4. Google Scholar 5.
Harrison, and A. Yehudai, Eliminating null rules in linear time, The Computer Journal 24 , — Step 1: add a new start symbol to, and the rule to Chomsky and Greibach Normal Forms p.
Step 1: add a new start symbol to, and the rule to Note: this change guarantees that the start symbol of does not occur on the of any rule Chomsky and Greibach Normal Forms p.
Eliminate the rule from where is not the start symbol 2. For each occurrence of on the with that occurrence of deleted Example: replace by replace by of a rule, add a new rule to ; 3.
Replace the rule, if it is present by rule has been previously eliminated unless the until all rules are eliminated Chomsky and Greibach Normal Forms p. Remove a unit rule 2.
For each rule, add the rule was a unit rule previously removed until all unit rules are eliminated to, unless Note: is a string of variables and terminals Chomsky and Greibach Normal Forms p. Replace a rule,, where each is a variable or a terminal, by:,,, where,,, are new variables,, 2.
If rule replace any terminal with a new variable and add the until no rules of the form with remain Chomsky and Greibach Normal Forms p.Proof idea: Chomsky and Greibach Normal Forms p. Yes, for every context-free grammar there exists an equivalent grammar in GNF.
Algorithm to Convert a CFG into Greibach Normal Form
Thus, t 0,. Proposition 5.
For one such construction the size of the constructed grammar is O n 4 in the general case and O n 3 if no derivation of the original grammar consists of a single nonterminal symbol, where n is the size of the original grammar.