I would first try to understand what you are trying to achieve. JUNOS is very flexible on this front and I am wondering why you think yacc is the right way to achieve what you are trying to do.
If no one (or very few) these days is using yacc grammar for parsing router configs, that should be a good indication whether you are on the right path or not.
As already pointed out, navigating the XML trees or JSON structures would be much easier than writing a yacc grammar parser.
But without understanding what you are trying to do, this is just another suggestion.
./diogo -montagner
JNCIE-SP 0x41A