#!/usr/local/bin/perl -ws use strict; use Parse::RecDescent; { $| = 1; my $grammar; { local $/; $grammar = ; } my $parser = Parse::RecDescent->new ($grammar); print ">"; while (<>) { print $parser->main ($_), ">" || die "Bad Code"; } } __DATA__ main: /^\s*\Z/ | input_line EOL | EOL: /\s*\Z/ input_line: opcode_8031 # # The opcode code list. Reverse these two to fix, or RET/RETI ordering to break. # opcode_8031: opcode_ret | opcode_reti opcode_ret: OP_RET opcode_reti: OP_RETI # # 8031 opcodes # OP_RET: 'ret' OP_RETI: 'reti'