Theory of Computation etcs-206 Context Free Grammar



Download 1.68 Mb.
Page4/6
Date23.07.2021
Size1.68 Mb.
#57100
1   2   3   4   5   6
CFG

Problem

  • Remove null production from the following −
    • S → ASA | aB | b, A → B, B → b | ∈

Remove null production from the following −

  • S → XYX  
  • X → 0X | ε  
  • Y → 1Y | ε 
  • S → XY | YX | XX | X | Y  
  • X → 0X | 0  
  • Y → 1Y | 1  

Chomsky Normal Form

  • A CFG is in Chomsky Normal Form if the Productions are in the following forms −
      • A → a
      • A → BC
      • S → ε
  • where A, B, and C are non-terminals and a is terminal.

Algorithm to Convert into Chomsky Normal Form −

Step 1 − If the start symbol S occurs on some right side, create a new start symbol S’ and a new production S’→ S.

Step 2 − Remove Null productions. (Using the Null production removal algorithm discussed earlier)

Step 3 − Remove unit productions. (Using the Unit production removal algorithm discussed earlier)


Download 1.68 Mb.

Share with your friends:
1   2   3   4   5   6




The database is protected by copyright ©ininet.org 2024
send message

    Main page