#!/usr/bin/perl -w use Parse::BNF; my $grammar = do { local $/; <> }; my $bnf = Parse::BNF->grammar( $grammar ); print((defined($bnf) ? $bnf : "Failed"), "\n");