Unformatted text preview: {0n : n is a prime}. Question 1. [10 marks total] (a) [4 marks] Consider the grammar S → R  T R → aRc  aR  T  ε T → aTb  aT  ε Give a context free grammar in Chomsky normal form for this language. The start variable already does not appear on the RHS of a rule. Eliminate ε rules S → R  T  ε R → aRc  aR  ac  a  T T → aTb  aT  ab  a Eliminate unit rules to get S → aRc  aR  ac  a  aTb  aT  ab  ε R → aRc  aR  ac  a  aTb  aT  ab T → aTb  aT  ab  a Replace terminals in long RHSs with variables S → ARC  AR  AC  a  ATB  AT  AB  ε R → ARC  AR  AC  a  ATB  AT  AB T → a...
View
Full Document
 Fall '08
 lee
 Computer Science, Regular expression, Automata theory, Contextfree grammar, CFL

Click to edit the document details