# Context free grammar for language with even number of $0$’s and $1$’s

I want to create a Context-Free grammar that generates the language

$$L = \{ w \in \{0, 1\}^* |\ \text{number of 0 ‘s is even, and number of 1 ‘s is also even} \}.$$

I came up with

$$S \rightarrow 0S0S\ |\ 1S1S\ |\ ABABS\ |\ BABAS\ |\ \epsilon \ A \rightarrow 0A0A\ |\ 1A1A\ |\ 0\ B \rightarrow 0B0B\ |\ 1B1B\ |\ 1\$$

Looks like it does the job, but how can I be sure that it does indeed generate L.

Any help would be appreciated.