Question
Asked Apr 11, 2019
428 views

 Transform the grammar with productions

S → baAB,

A → bAB|λ,

B → BAa |Aλ

into Chomsky normal form.

check_circle

Expert Answer

Step 1

A context free grammar is in Chomsky normal form if its productions are in the form

A → a or A → BC or S → ε where a is a terminal and A, B, C are non-terminals.

 In the first step we will remove λ-productions as removing A → λ, we get

S → baAB|baB

A → bAB|bB

B → BAa|A|Ba

Step 2

In the next step, we will remove B → λ, we get
S → baAB|baB|baA|ba
A → bAB|bB|bA|b
B → BAa|A|Ba|Aa|a

Step 3

Now, remove the unit-production as B → A, we get

 S → baAB|baB|baA...

Want to see the full answer?

See Solution

Check out a sample Q&A here.

Want to see this answer and more?

Solutions are written by subject experts who are available 24/7. Questions are typically answered within 1 hour.*

See Solution
*Response times may vary by subject and question.

Related Computer Science Q&A

Find answers to questions asked by student like you
Show more Q&A
add
question_answer

Q: This code is for python Searching for Data In this lab we'll compare the time it takes to search for...

A: Instructions for solving the given problem:In part 1, use random.randint() function to generate rand...

question_answer

Q: This is for Python code.

A: Solution:#Define functiondef twoscomp(n):       #Declare empty variable    comp = ""       #Loop exe...

question_answer

Q: This code is for python

A: This is a very long problem because of lack of space we provide only a portion of the algorithm. How...

question_answer

Q: Write a complete C++ program that randomly generates 20 integers between the rangeof 1 to 50 and sto...

A: Solution:Given data,The C++ code to generate the 20 random numbers with the range from “1” to “50”, ...

question_answer

Q: Question 2 3 4

A: Question 2:Given binary value = 11012   The given binary value does not represents the decimal numbe...

question_answer

Q: Create a program that will input the 3 game scores of a player and then output the level of the play...

A: Since there are no messages given in the question for the condition where the weighted average falls...

question_answer

Q: What type of data breach occurred involving the Facebook/Cambridge Analytica?

A: Data breaching involves intentional or unintentional leakage of confidential information to un autho...

question_answer

Q: Read in 5 letters from the keyboard, reverse the order of the second and next to last letters, and p...

A: Program to read 5 letters from the keyboards and reversing the order of the second and next to last ...

question_answer

Q: In a computer instruction format, the instruction length is 11 bits and the size of an address field...

A: Given:Instruction length = 11 bits = 211 = 2048 bitsAddress register size = 4 bits