--- /dev/null
+#!/usr/bin/perl -w
+
+
+use IO::File;
+use strict;
+
+$ENV{CLASSPATH} .= ":../../lib/cql-java.jar";
+
+if (@ARGV != 1) {
+ print STDERR "Usage: $0 <trusted-CQL-compiler>\n";
+ exit(1);
+}
+my $compiler = $ARGV[0];
+
+while (<sections/*>) {
+ my $sdir = $_;
+ s@sections/@@;
+ next if /^CVS$/ || /^10$/; # I _can't_ get CVS to stop extracting "10"
+ print "answering section $_ - ", read_file("$sdir/name"), "\n";
+
+ while (<$sdir/*.cql>) {
+ my $qfile = $_;
+ s@sections/([0-9]+/.*)\.cql@$1@;
+ my $query = read_file($qfile);
+ my $afile = $qfile;
+ $afile =~ s/\.cql$/.xcql/;
+ print " wrote $_ - $query\n";
+ my $fh = new IO::File("| $compiler > $afile")
+ or die "can't run compiler '$compiler': $!";
+ print $fh $query;
+ $fh->close();
+ }
+}
+
+sub read_file {
+ my($name) = @_;
+
+ my $fh = new IO::File("<$name")
+ or die "can't read '$name': $!";
+ my $contents = join('', <$fh>);
+ $fh->close();
+ return $contents;
+}