patternMinor
Can every linear grammar be converted to Greibach form?
Viewed 0 times
linearcangreibacheverygrammarformconverted
Problem
Can every linear grammar be converted to a linear Greibach normal form, a form in which all productions look like $A \rightarrow ax$ where $a \in T$ and $x \in V \cup \{\lambda\}$?
($T$ is the set of terminals, $V$ is the set of non-terminals, $\lambda$ is the empty sequence.)
($T$ is the set of terminals, $V$ is the set of non-terminals, $\lambda$ is the empty sequence.)
Solution
The more general answer is:
Blum and Koch showed a polynomial time transformation such that any context-free grammar can be converted to Greibach form.
Since a linear grammar is a special case of Context-free grammar, the answer is yes.
EDIT: the rest of this answer is out of scope since the question was about Linear GNF and not just GNF (thanks @hendrik-jan for spotting this)
A simpler transformation:
-
Any rule $X \rightarrow a_1 a_2 \cdot a_k Y$ you transform them in $k$ rules:
-
Any rule $X \rightarrow a Y b$ should be transformed in two rules
where the capital letters belong to $V$ and the small letters to the alphabet (terminals).
Blum and Koch showed a polynomial time transformation such that any context-free grammar can be converted to Greibach form.
Since a linear grammar is a special case of Context-free grammar, the answer is yes.
EDIT: the rest of this answer is out of scope since the question was about Linear GNF and not just GNF (thanks @hendrik-jan for spotting this)
A simpler transformation:
-
Any rule $X \rightarrow a_1 a_2 \cdot a_k Y$ you transform them in $k$ rules:
- $X\rightarrow a_1 X_1Y$.
- $\cdots$
- $X_{i-1}\rightarrow a_{i}X_i$
- $X_{k-1}\rightarrow a_{k}Y$
-
Any rule $X \rightarrow a Y b$ should be transformed in two rules
- $X \rightarrow a Y Y_1$.
- $Y_1 \rightarrow b$
where the capital letters belong to $V$ and the small letters to the alphabet (terminals).
Context
StackExchange Computer Science Q#588, answer score: 9
Revisions (0)
No revisions yet.