root/trunk/spec/verify_lhs.pl

Revision 7, 482 bytes (checked in by oren, 8 months ago)

April 06, 2008 draft.

Implemented by YamlReference? 0.9.

Contains new productions, new examples, all the changes collected throughout
the last 3 years, and of course JSON compatibility.

  • Property svn:executable set to *
Line 
1#!/usr/bin/perl -w
2
3use strict;
4
5my $lino = 0;
6my $production = 0;
7my $bad_productions = 0;
8while (my $line = <>) {
9  $lino++;
10  if ($line =~ /<production id="(.*)"/) {
11    $production = $1;
12    next;
13  }
14  if ($line =~ /<lhs>(.*)<\/lhs>/) {
15    my $lhs = $1;
16    next if ($lhs eq $production);
17    warn "Line $lino: Production $production != lhs $lhs\n";
18    $bad_productions++;
19  }
20}
21
22die("There were production/lhs mismatches\n") if ($bad_productions > 0);
Note: See TracBrowser for help on using the browser.