How to Convert Given Grammar to Chomsky Normal Form?

  • Context: Graduate 
  • Thread starter Thread starter MalickT
  • Start date Start date
  • Tags Tags
    Form Normal
Click For Summary

Discussion Overview

The discussion revolves around converting various grammars into Chomsky Normal Form (CNF), a specific format used in formal language theory. Participants present different grammars and seek assistance with the conversion process, which involves multiple steps such as removing epsilon productions, unit productions, and ensuring the grammar adheres to CNF rules.

Discussion Character

  • Exploratory
  • Technical explanation
  • Homework-related
  • Debate/contested

Main Points Raised

  • One participant presents a grammar and requests help converting it to CNF, outlining the productions involved.
  • Another participant proposes a CNF grammar but expresses uncertainty about the correctness of their answer, particularly regarding the transformation of the production ASA.
  • A third participant offers a step-by-step approach to converting the initial grammar into CNF, detailing the removal of epsilon and unit productions, but does not confirm the final correctness of the CNF form.
  • Another participant introduces a different grammar and requests urgent assistance with its conversion to CNF.
  • A subsequent post questions whether the previous request is homework-related and references a Wikipedia page for CNF, implying that the information may be readily available.
  • Another participant presents a new grammar involving expressions and asks how to convert it to CNF, indicating a need for clarification on the process.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the correctness of the proposed CNF transformations. There are multiple competing views and approaches to the conversion process, with some expressing uncertainty about specific steps and rules.

Contextual Notes

Some participants' steps may depend on interpretations of CNF rules, and there are unresolved aspects regarding the correctness of transformations and the handling of specific grammar productions.

Who May Find This Useful

Students and practitioners interested in formal language theory, specifically those learning about Chomsky Normal Form and its applications in parsing algorithms like the CKY algorithm.

MalickT
Messages
4
Reaction score
0
I have grammar:

S -> ASA
S -> aB
A -> B
A -> S
B -> b
B -> epsilon (empty string)

Can someone please help me to convert this grammar to Chomsky Normal From so i can do CKY-algorithm
 
Physics news on Phys.org
Hi,

S -> ASA | aB
A -> B | S
B -> b | eps

your CNF grammar should be

S -> AS | SA | CB | a
A-> b | AS | SA | CB | a
B -> b
C -> a
 
Saw this online and decided to give another version, because I'm not sure if the answer above is correct. Unless there is a rule that allows ASA -> AS | SA that I don't know about.

(From where you left off...)
S -> ASA | aB
A -> B | S
B -> b | eps

(Step 1: remove eps productions)
S -> ASA | aB | a
A -> B | S
B -> b

(Step 2: remove unit productions)
S -> ASA | aB | a
A -> b | ASA | aB | a
B -> b

(Step 3: remove useless productions)
none, all have terminal variable

(Step 4: put into Chomsky form)
S -> DA | CB | a
A -> b | DA | CB | a
B -> b
C -> a
D -> AS
 
Can someone help me convert this Grammar to Chomsky Normal Form?

S--->XYx
X--->xxy
Y--->Xw

Thank you.
Urgent Reply Needed
 
help me in this
if we have E →E+T/E-T/T
T→T*F/T-F/F
F→(E)/i/ε
how we will solve using chomsky normal form
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
6K
  • · Replies 20 ·
Replies
20
Views
4K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 29 ·
Replies
29
Views
6K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
1K