Bad example. This has been done before, only with the C compiler not yacc.
But the effectiveness of this kind of 'sploit, like every other kind, is limited by the diversity of implementations out there. There is no mother of all protocol compilers that could have been infected with a trojan, and that one could use to bring down all networks. Nor is there any other one-size-fits-all exploit, nor even a manageable collection of them that any group short of an NSA or GCHQ type government agency could possibly make any practical use of.