Chomsky normal form: Difference between revisions

Jump to navigation Jump to search
imported>TheUbMunster
m Corrected grammar language viz. summary
 
imported>Jochen Burghardt
DEL: Eliminate ε-rules: suggest to underline kept nonterminals in addition (e.g. for colorblind people and greyscale printouts); not sure anymore that coloring was a good idea at all, when it needs that much advanced programming
 
Line 68: Line 68:
: ''A'' → ''a'' | ε
: ''A'' → ''a'' | ε
the nonterminal ''A'', and hence also ''B'', is nullable, while neither ''C'' nor ''S''<sub>0</sub> is.
the nonterminal ''A'', and hence also ''B'', is nullable, while neither ''C'' nor ''S''<sub>0</sub> is.
Hence the following intermediate grammar is obtained:<ref group=note>indicating a kept and omitted nonterminal ''N'' by ''{{color|#006000|N}}'' and ''{{color|#ffc0c0|<s>N</s>}}'', respectively</ref>
Hence the following intermediate grammar is obtained:<ref group=note>indicating a kept and omitted nonterminal ''N'' by ''{{color|var(--color-content-added, #006400)|<u>N</u>}}'' and ''{{color|var(--color-content-removed, #8B0000)|<s>N</s>}}'', respectively</ref>
: ''S''<sub>0</sub> → ''{{color|#006000|A}}b{{color|#006000|B}}'' | ''{{color|#006000|A}}b{{color|#ffc0c0|<s>B</s>}}'' | ''{{color|#ffc0c0|<s>A</s>}}b{{color|#006000|B}}'' | ''{{color|#ffc0c0|<s>A</s>}}b{{color|#ffc0c0|<s>B</s>}}'' &nbsp; | &nbsp; ''C''
: ''S''<sub>0</sub> → ''{{color|var(--color-content-added, #006400)|<u>A</u>}}b{{color|var(--color-content-added, #006400)|<u>B</u>}}'' | ''{{color|var(--color-content-added, #006400)|<u>A</u>}}b{{color|var(--color-content-removed, #8B0000)|<s>B</s>}}'' | ''{{color|var(--color-content-removed, #8B0000)|<s>A</s>}}b{{color|var(--color-content-added, #006400)|<u>B</u>}}'' | ''{{color|var(--color-content-removed, #8B0000)|<s>A</s>}}b{{color|var(--color-content-removed, #8B0000)|<s>B</s>}}'' &nbsp; | &nbsp; ''C''
: ''B'' → ''{{color|#006000|AA}}'' | ''{{color|#ffc0c0|<s>A</s>}}{{color|#006000|A}}'' | ''{{color|#006000|A}}{{color|#ffc0c0|<s>A</s>}}'' | ''{{color|#ffc0c0|<s>A</s>}}ε{{color|#ffc0c0|<s>A</s>}}'' &nbsp; | &nbsp; ''{{color|#006000|A}}C'' | ''{{color|#ffc0c0|<s>A</s>}}C''
: ''B'' → ''{{color|var(--color-content-added, #006400)|<u>AA</u>}}'' | ''{{color|var(--color-content-removed, #8B0000)|<s>A</s>}}{{color|var(--color-content-added, #006400)|<u>A</u>}}'' | ''{{color|var(--color-content-added, #006400)|<u>A</u>}}{{color|var(--color-content-removed, #8B0000)|<s>A</s>}}'' | ''{{color|var(--color-content-removed, #8B0000)|<s>A</s>}}ε{{color|var(--color-content-removed, #8B0000)|<s>A</s>}}'' &nbsp; | &nbsp; ''{{color|var(--color-content-added, #006400)|<u>A</u>}}C'' | ''{{color|var(--color-content-removed, #8B0000)|<s>A</s>}}C''
: ''C'' → ''b'' | ''c''
: ''C'' → ''b'' | ''c''
: ''A'' → ''a'' | ε
: ''A'' → ''a'' | ε