___________________________________________________________________________ Chomsky Normal Form: 1. Add the rule S_0 -> S 2. Break long rules into smaller ones: if A -> s_1 ... s_n is a rule where n > 2, then delete it and instead add the rules A -> s_1 Z_1 Z_1 -> s_2 Z_2 . . . Z_{n-2} -> s_{n-1} s_n The Z's are new variables. 3. A variable is nullable if the empty string can be derived from it. Find out all nullable variables. For all rules of the form A -> \alpha \beta (i.e., those whose right-hand sides have length 2) do: { if \alpha is a nullable variable, add the rule A -> \beta if \beta is a nullable variable, add the rule A -> \alpha } Delete all epsilon-rules. Add S_0 -> e if S_0 is nullable. 4. For every unmarked unit rule A -> B do { For every rule B -> u do { Add the rule A -> u }; Mark A -> B for deletion; } Delete all unit rules. 5. Create new variables X_a for every symbol a in the alphabet and add the rules X_a -> a If a terminal symbol appears in the RHS of a rule, and this RHS has length = 2, then replace the occurrence with its corresponding (newly created) variable.