This preview shows page 1. Sign up to view the full content.
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
This note was uploaded on 01/16/2014 for the course CSE 355 taught by Professor Lee during the Fall '08 term at ASU.
 Fall '08
 lee
 Computer Science

Click to edit the document details