require "/usr/lib/perl5/5.6.1/getopts.pl"; #[...] use mach_grammar; our @prog_src; our $src_code; our $opt_i; use vars qw($opt_l); # L is used in actions inside the grammar # the machine has 48 bit instruction words, which are built up # in two halves. use vars qw($Instruction_upper); use vars qw($Instruction_lower); use vars qw($Instruction_address); use vars qw($LastPrintedLine); use vars qw($LineToPrint); use vars qw($LastSuccess); use vars qw($LookingFor); # # main program follows # { my $mach_parser = mach_grammar->new(); #[...] # acquire @prog_src if ($debug == 1) { @prog_src = or die "ERROR: cannot read input data."; } else { # open the input file open(INFILE, "$opt_i") || die "ERROR: Cannot open $opt_i"; @prog_src = or die "ERROR: cannot read input file."; close(INFILE); } # # mash all the source together and remove all the newlines. # foreach (0 .. scalar(@prog_src) - 1) { $prog_src[@_] =~ s/\\r/\$\//g ; } push @prog_src, "\n__EOF__"; $src_code = join " ", @prog_src; defined $mach_parser->program_body($src_code) or die "bad grammar!"; } # # ****************************************************************** # main program section has ended, debug data section follows. # ****************************************************************** # __DATA__ // test cases. // repeat instruction repeat = 0x0001; repeat = 0x0002; repeat = 0xfade; //[...rest of test cases removed...] /* that's all folks.... */ __EOF__