Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- S
- ABCD
- EFGHJK
- LMNP
- Given the alphabet {a,b,c,d}, define a context-free grammar for the language of words that contain exactly three unique symbols. For example, "abc" and "dcccaca" are both okay but neither of "abdc", "daaaad" are.
- S>aA
- S>bB
- S>cC
- S>dD
- ----------------
- A>aA
- A>bE
- A>cF
- A>dG
- B>aE
- B>bB
- B>cH
- B>dJ
- C>aF
- C>bH
- C>cC
- C>dK
- D>aG
- D>bJ
- D>cK
- D>dD
- ----------------
- E>aE
- E>bE
- E>cL
- E>dM
- F>aF
- F>bL
- F>cF
- F>dN
- G>aG
- G>bM
- G>cN
- G>dG
- H>aL
- H>bH
- H>cH
- H>dP
- J>aM
- J>bJ
- J>cP
- J>dJ
- K>aN
- K>bP
- K>cK
- K>dK
- ----------------
- L>aL
- L>bL
- L>cL
- L>_
- M>aM
- M>bM
- M>dM
- M>_
- N>aN
- N>cN
- N>dN
- N>_
- P>bP
- P>cP
- P>dP
- P>_
Advertisement
Add Comment
Please, Sign In to add comment