--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/parser Fri Nov 06 13:59:00 2009 +0100
@@ -0,0 +1,43 @@
+#!/usr/bin/perl -w
+
+use strict;
+use Parse::RecDescent;
+use Data::Dumper;
+
+my $grammar_file = shift;
+unless (defined $grammar_file) {
+ print "Usage: $0 grammar_file\n";
+ exit 1;
+}
+
+unless (-f $grammar_file) {
+ die "Grammar file $grammar_file does not exit";
+}
+
+my $grammar = '';
+{
+ open G, $grammar_file;
+ local $/;
+ $grammar = <G>;
+ close G;
+}
+
+# Enable warnings within the Parse::RecDescent module.
+$::RD_ERRORS = 1; # Make sure the parser dies when it encounters an error
+$::RD_WARN = 1; # Enable warnings. This will warn on unused rules &c.
+$::RD_HINT = 1; # Give out hints to help fix problems.
+
+my $parser = Parse::RecDescent->new($grammar);
+
+my $content = '';
+{
+ local $/;
+ $content = <>;
+}
+
+$::res = {};
+my $p_res = $parser->file($content);
+
+#print Dumper $p_res;
+
+print Dumper $::res;