# Showing $A-B$ is a CFL where $A$ is a CFL and $B$ is finite

Show that if $A$ is a context-free language and $B$ is finite, then $A - B$ is a context-free language.

I'm just not sure how to use their properties to formally show this. Thanks for all the help in advance.

• If A is context-free, there is a push down automaton that accepts A. Try to modify this automaton such that it accepts A-B. – A.Schulz Jul 20 '12 at 18:08
• What have you tried? Do you want a full solution or only hints (the only reason I ask is that the way you phrase the question, one might reasonably assume the latter, as did @YuvalFilmus below). – Patrick87 Jul 20 '12 at 19:44

Hint: If $A$ is context-free and $R$ is regular then $A \cap R$ is context-free.
• Hint+1: if $R$ is regular, so is $\bar{R}$. – Luke Mathieson Jul 21 '12 at 2:47