Added validation of Backus-Naur inputs