onvert these rules to CNF. A → ABA| B|a|ab B→BCB|C|b|bc|e C→CD|DC|c D→D E

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
**Converting Grammar Rules to Chomsky Normal Form (CNF)**

In this lesson, we will focus on converting the given set of grammar rules to Chomsky Normal Form (CNF). CNF is a type of context-free grammar where each rule is of the form:

1. \( A \rightarrow BC \) (where \( A \), \( B \), and \( C \) are non-terminal symbols, and \( B \) and \( C \) are not start symbols) 
2. \( A \rightarrow a \) (where \( A \) is a non-terminal symbol and \( a \) is a terminal symbol)

Given grammar rules:

\[ A \rightarrow ABA \ | \ B \ | \ a \ | \ ab \]
\[ B \rightarrow BCB \ | \ C \ | \ b \ | \ bc \ | \ \epsilon \]
\[ C \rightarrow CD \ | \ DC \ | \ c \]
\[ D \rightarrow D \ | \ \epsilon \]

Here are the steps involved in converting these rules to CNF:

1. **Remove ε-productions**: Get rid of productions that produce an empty string (ε), except when the start symbol itself can generate ε.
2. **Remove unit productions**: Productions where one non-terminal goes to another non-terminal.
3. **Eliminate useless symbols**: Remove any non-terminal symbols that do not appear in any derivations of terminal strings.
4. **Break down long productions**: Ensure that each production has at most two non-terminals on the right-hand side, or a single terminal.

### Explanation

#### Step 1: Remove ε-productions
- From \( B \rightarrow \epsilon \)
- From \( D \rightarrow \epsilon \)

#### Step 2: Remove unit productions

Unit productions such as \( A \rightarrow B \), \( B \rightarrow C \), etc., need to be replaced with equivalent productions without chaining single non-terminal to another.

#### Step 3: Eliminate long Productions
- Productions like \(A \rightarrow ABA \), \( BCB \) need to be decomposed to follow CNF rules.

Here is the systematic approach to convert it to CNF:

#### Intermediate Grammars Post Transformation:
1. **Eliminating ε-productions:**
   We introduce new rules for possibilities without ε.
   
   For \( B \rightarrow b \mid C \mid bC \mid b \
Transcribed Image Text:**Converting Grammar Rules to Chomsky Normal Form (CNF)** In this lesson, we will focus on converting the given set of grammar rules to Chomsky Normal Form (CNF). CNF is a type of context-free grammar where each rule is of the form: 1. \( A \rightarrow BC \) (where \( A \), \( B \), and \( C \) are non-terminal symbols, and \( B \) and \( C \) are not start symbols) 2. \( A \rightarrow a \) (where \( A \) is a non-terminal symbol and \( a \) is a terminal symbol) Given grammar rules: \[ A \rightarrow ABA \ | \ B \ | \ a \ | \ ab \] \[ B \rightarrow BCB \ | \ C \ | \ b \ | \ bc \ | \ \epsilon \] \[ C \rightarrow CD \ | \ DC \ | \ c \] \[ D \rightarrow D \ | \ \epsilon \] Here are the steps involved in converting these rules to CNF: 1. **Remove ε-productions**: Get rid of productions that produce an empty string (ε), except when the start symbol itself can generate ε. 2. **Remove unit productions**: Productions where one non-terminal goes to another non-terminal. 3. **Eliminate useless symbols**: Remove any non-terminal symbols that do not appear in any derivations of terminal strings. 4. **Break down long productions**: Ensure that each production has at most two non-terminals on the right-hand side, or a single terminal. ### Explanation #### Step 1: Remove ε-productions - From \( B \rightarrow \epsilon \) - From \( D \rightarrow \epsilon \) #### Step 2: Remove unit productions Unit productions such as \( A \rightarrow B \), \( B \rightarrow C \), etc., need to be replaced with equivalent productions without chaining single non-terminal to another. #### Step 3: Eliminate long Productions - Productions like \(A \rightarrow ABA \), \( BCB \) need to be decomposed to follow CNF rules. Here is the systematic approach to convert it to CNF: #### Intermediate Grammars Post Transformation: 1. **Eliminating ε-productions:** We introduce new rules for possibilities without ε. For \( B \rightarrow b \mid C \mid bC \mid b \
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Transitive relations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education