Created
March 16, 2013 17:21
-
-
Save jddurand/5177371 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!env perl | |
use strict; | |
use diagnostics; | |
use POSIX; | |
use MarpaX::Import; | |
use Log::Log4perl qw /:easy/; | |
use Log::Any::Adapter; | |
my $conf = q( | |
log4perl.rootLogger = WARN, Screen | |
log4perl.appender.Screen = Log::Log4perl::Appender::Screen | |
log4perl.appender.Screen.stderr = 1 | |
log4perl.appender.Screen.layout = PatternLayout | |
log4perl.appender.Screen.layout.ConversionPattern = %d %-5p %6P %m{chomp} [%C:%L]%n | |
); | |
Log::Log4perl::init(\$conf); | |
Log::Any::Adapter->set('Log4perl'); | |
my $any = MarpaX::Import->new({startrules => [qw/dateTimeLexicalRep/], bnf2slif => 1}); | |
my $data = do { local $/; <DATA> }; | |
my $grammar = $any->grammar($data); | |
print $grammar->rules_as_string(1); | |
exit(EXIT_SUCCESS); | |
__DATA__ | |
dateTimeLexicalRep ::= yearFrag '-' monthFrag '-' dayFrag 'T' ((hourFrag ':' minuteFrag ':' secondFrag) | endOfDayFrag) timezoneFrag? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment