Is the language of words having same number of a's and b's context-free? I'm trying to use the pumping lemma, to show that the language $$L = \{w \in \{a, b\}^+: na(w) = nb(w)\}$$ is not context free, where $na(w)$ is the number of $a$'s in $w$ and $nb(w)$ is the number of $b$'s in $w$.
I have this: By contradiction, if $L$ is context free, we use the pumping lemma, then let $N$, and $w = a^{floor(N/2)}*b^{floor(N / 2)}$, with $|w| = N$. Then if we divide $w = uvxyz$, with $v \not = \epsilon$ and $x = \epsilon$, we see that when repeating v there appear more a's than b's, then $uv ^ kxy ^ kz$ $\notin$ L. Contradiction.
Is this right or am I missing something?
This language L = { w | w has equal number of as and bs and w≠ ε (since you put a +)  } is a CFL
A PDA would work as follows :
On reading a :
If the stack is empty or the top of the stack is a push a
If the top of stack is b pop b push nothing
On reading b :
If the stack is empty or the top of the stack is b push b
If the top of stack is a pop a push nothing
At the end of input if stack is empty accept else reject