#!/usr/bin/perl -w

$dir = shift;
while (<>) {
	push @th, $1 if /^([\w\d]+).*:.*Theory/i
}

print "\%\% top level theory for context $dir
\%\% file generated by theories.pl - do not edit !

$dir: Theory
Begin

  Importing
    ";

print join ",\n    ", @th;

print "

End $dir
";
