Computing Reviews
Today's Issue Hot Topics Search Browse Recommended My Account Log In
Review Help
Search
Characterization of context-free languages
Badano M., Vaggione D. Theoretical Computer Science676  92-96,2017.Type:Article
Date Reviewed: Sep 20 2018

The authors prove that a generalized Greibach normal form (GNF) grammar still generates a context-free language. They expand the left side of GNF-type rules to be any nonempty product of variables (nonterminals), not just a single variable. Then, by means of a factorization and composition depending on left association, they convert the new grammar to a weakly equivalent grammar in GNF.

More specifically, “a grammar is a 4-tuple G = (V,T,S,P), where V and T are finite sets of variables and terminals, respectively, SV is the start symbol, and P is a finite set of productions [or rules] of the form α → β, with α,β ∈ (VT)* and α non-empty.” They use ε to denote the empty string.

A subset of T* is called a language. We assume the application of rules and definition of the language L(G) generated by G as well known. Unfortunately, the authors never define a language and do not define the language G generates until after the introduction and the statement of the principal result, which uses both “language” and “generated by.” Here is that result:

Theorem 1. Let L be a language without ε. Then L is context-free if and only if L can be generated by a grammar for which every production has the form α→aβ where α ∈ V+ and aβ ∈ TV*.

This becomes a GNF grammar when α is restricted to being a single variable. It should be mentioned that some expositors of GNF allow the ε-production S → ε and others exclude S from occurring in β. These variations are ignored here.

If L is context-free, then a GNF generating it proves if … then. Here is a sketch of the construction of then … if--see the paper for the proof. Given a grammar G = (V,T,S,P) whose every rule has the form α → aβ, where α ∈ V+, aT, and β ∈ V*, construct a new grammar = (, T, VS, )--obviously in GNF, but not obviously equivalent to G. Take NGV+ to be all left sides of rules in P, and take MGV* to be all proper prefixes of strings in NG. Then the new variables are = {Vα,β : α ∈ NG, β ∈ MG}, and the new rules = 12 come in two kinds, the second generalizing the first:

1 = {Vα,βa : α → aβ ∈ P},
2 = Vα,βaVβ11 Vτ1β22Vτk-1βk,τk : k ≥ 1
& α → aβ1 … βkβk+1P
& βi ≠ ε (i = 1,…,k)
& β = τkβk+1}.

The conditions for are simplified over the original, because to mention Vγ,δ is to force γ∈NG and δ∈MG. The definition of is subtle and brilliant. Note how the final string (suffix of a prefix) is stored as state in the second subscript of the variable.

On page 95, for the case when δ is a proper prefix of β1, it could be noted that δ may be empty. In the discussion of this case, “and since aδ and” should read “and since aδ ∈ P and”.

For the case δ = β1…βk, it could be noted that k′ = 1 and β′1 = α.

For the case δ ≠ β1…βk, observe that φ may be empty, although ψ is not. The index limits for β′i,τ′i must be restated as:

β′i = βj+i-1 for i = 3,…,k-j+1,
τ′i = τj+i-1 for i = 2,…,k-j.

k+1k do not exist; when j = k-1, there is no β′3 or τ′2.) Taking k′ = k-j+1, we have α=β′1…β′k.

In the last line on page 95, “Since aβ1…βjφ, by” should read “Since aβ1…βjφ ∈ P, by”. Note that Vβ′1,τ′1 = Vjφ.

Then, at the top of page 96, the third line:

Vβ’1,τ’1Vτ’1β’2,τ’2Vτ’k-1β’k

aVβ11Vτj-iβjjVτj φψ,τj+1Vτ’k-1β’k
w

needs correction to:

Vβ’1,τ’1Vτ’1β’2,τ’2Vτ’k’-1β’k

= Vj φVτ’1β’2,τ’2Vτ’k-jβ’k-j+1
= Vj φVτj φ ψ,τj+1Vτk-1βk
aVβ11Vτj-iβjjVτj φψ,τj+1Vτk-1βk
a = w.

The authors write of revising the basic definitions. The only obvious thing is the reversal of the order of P,S in the definition of a grammar, but on page 94 they revert to the standard (V,T,P,S).

Some steps are left out. For VS to belong to requires that SNG, which must be so as long as L(G) is nonempty, that is, nontrivial. There are several places where it is asserted that γ → w belongs to P, which requires wT; although unstated, this follows from the hypotheses. In addition, citing w,T* always entails w, being nonempty.

It might be mentioned that whether a grammar has the required form is obviously a computable question. The conversion to GNF is also computable. GNF covers broader problems of computably finding such a grammar for a CFL given by some other method.

The authors could have spoken to the importance and usefulness of their elegant result. This and the issues mentioned above should have been handled by the referees.

Reviewer:  Benjamin Wells Review #: CR146247 (1812-0646)
Bookmark and Share
  Featured Reviewer  
 
Grammar Types (F.4.2 ... )
 
 
Grammars And Other Rewriting Systems (F.4.2 )
 
 
Mathematical Logic And Formal Languages (F.4 )
 
Would you recommend this review?
yes
no
Other reviews under "Grammar Types": Date
Results on NLC grammars with one-letter terminal alphabets
Hoffmann J., Main M. Theoretical Computer Science 73(3): 279-294, 2001. Type: Article
Oct 1 1991
Recursive queries and context-free graph grammars
Courcelle B. Theoretical Computer Science 78(1): 217-244, 1991. Type: Article
Aug 1 1992
Attribute grammars : definitions, analysis of dependencies, proof methods
Courcelle B. (ed), Cambridge University Press, New York, NY, 1984. Type: Book (9780521268431)
Oct 1 1985
more...

E-Mail This Printer-Friendly
Send Your Comments
Contact Us
Reproduction in whole or in part without permission is prohibited.   Copyright 1999-2024 ThinkLoud®
Terms of Use
| Privacy Policy