#!/usr/bin/perl -w

# $Id: sac,v 1.3 2006/11/03 13:50:25 mike Exp $


=head1 NAME

sac - the Scott Adams Compiler

=head1 SYNOPSIS

	sac crystal.sac > crystal.sao
	scottfree crystal.sao

=head1 DESCRIPTION

C<sac> compiles the Scott Adams source-file named on the command-line,
writing the resulting TRS-80 format game file on standard output.
This should usually be redirected to a file, often with a C<.sao>
(Scott Adams Object) extension, from where it can be run using an
interpreter such as C<scottfree>.

Any error messages are written onto standard error.

=head1 SEE ALSO

C<sad>, the Scott Adams Decompiler.

C<Games::ScottAdams>, the CPAN distribution containing this program.

=head1 AUTHOR

Mike Taylor E<lt>mike@miketaylor.org.ukE<gt>

First version Wednesday 1st November 2006.

=cut


use Games::ScottAdams;
use strict;

if (@ARGV != 1) {
    print STDERR "Usage: $0 <sa-source-file>\n";
    exit 1;
}

my $game = new Games::ScottAdams::Game()
    or die "can't create game";
my $fn = $ARGV[0];
$game->parse($fn)
    or die "can't parse SAC file '$fn'";
$game->compile();