To convert a context-free grammar to Chomsky Normal Form, you need to follow these steps:
- Eliminate -productions (productions that derive the empty string).
- Eliminate unit productions (productions of the form A B).
- Eliminate terminals from right-hand sides of productions.
- Replace any production A BC with two productions A B and B C.
- If a production has more than two symbols on the right-hand side, introduce new non-terminal symbols to break it down into smaller productions.
By following these steps, you can convert a context-free grammar to Chomsky Normal Form.