Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6575713
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:25:19+00:00 2026-05-25T15:25:19+00:00

Convert the grammar below into Chomsky Normal Form. Give all the intermediate steps. S

  • 0

Convert the grammar below into Chomsky Normal Form. Give all the intermediate steps.

S -> AB | aB
A -> aab|lambda
B -> bbA

Ok so the first thing I did was add a new start variable S0

so now I have

S0 -> S
S -> AB | aB
A -> aab|lambda
B -> bbA

then I removed all of the lambda rules:

S0 -> S
S -> AB | aB | B
A -> aab
B -> bbA | bb

Then I checked for S->S and A->B type rules which did not exist. And that was the answer I came up with, do I need to do anything further or did I do anything wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T15:25:19+00:00Added an answer on May 25, 2026 at 3:25 pm

    Wikipedia says:

    In computer science, a context-free grammar is said to be in Chomsky normal form if all of its production rules are of the form:

    • A -> BC, or
    • A -> α, or
    • S -> ε

    where A, B, C are nonterminal symbols, α is a terminal symbol, S is the start symbol, and ε is the empty string. Also, neither B nor C may be the start symbol.

    Continuing your work:

    S0 -> S
    S -> AB | aB | B
    A -> aab
    B -> bbA | bb
    

    Instead of using | to denote different choices, split a rule into multiple rules.

    S0 -> S
    S -> AB
    S -> aB
    S -> B
    A -> aab
    B -> bbA
    B -> bb
    

    Create new rules Y -> a and Z -> b because we will need them soon.

    S0 -> S
    S -> AB
    S -> aB
    S -> B
    A -> aab
    B -> bbA
    B -> bb
    Y -> a
    Z -> b
    

    S -> aB is not of the form S -> BC because a is a terminal. So change a into Y:

    S0 -> S
    S -> AB
    S -> YB
    S -> B
    A -> aab
    B -> bbA
    B -> bb
    Y -> a
    Z -> b
    

    Do the same for the B -> bb rule:

    S0 -> S
    S -> AB
    S -> YB
    S -> B
    A -> aab
    B -> bbA
    B -> ZZ
    Y -> a
    Z -> b
    

    For A -> aab, create C -> YY; for B -> bbA, create D -> ZZ:

    S0 -> S
    S -> AB
    S -> YB
    S -> B
    A -> CZ
    C -> YY
    B -> DA
    D -> ZZ
    B -> ZZ
    Y -> a
    Z -> b
    

    For S -> B, duplicate the one rule where S occurs on the right hand side and inline the rule:

    S0 -> B
    S0 -> S
    S -> AB
    S -> YB
    A -> CZ
    C -> YY
    B -> DA
    D -> ZZ
    B -> ZZ
    Y -> a
    Z -> b
    

    Deal with the rules S0 -> B and S0 -> S by joining the right hand side to the left hand sides of other rules. Also, delete the orphaned rules (where the LHS symbol never gets used on RHS):

    S0 -> DA
    S0 -> ZZ
    S0 -> AB
    S0 -> YB
    A -> CZ
    C -> YY
    B -> DA
    D -> ZZ
    B -> ZZ
    Y -> a
    Z -> b
    

    And we’re done. Phew!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

why do we convert the grammar to chomsky normal form ? Is there a
I need to convert latitude/longitude coordinates into Easting/Northing coordinates in the Alberta 10 TM
How can I convert some regular language to its equivalent Context Free Grammar? Is
Convert 20-JAN-2012 into 01/20/2012 . The solution should work in IE and FF latest
When I attempt to use the iterator form of parsing for a Spirit grammar
my convert code is all i have, but it converts a string to sha-1
I convert the secretkey into bytes with following code SecretKey key = KeyGenerator.getInstance(DES).generateKey(); byte[]
convert datetime format yyyy-mm-dd hh:mm:ss (Might be a string) into UTC, Looking into DateTime
My goal is to convert a PDF into an image (specifically in TIFF). There
I'm trying to convert the following (shortened for readability) to C# and running into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.