Acme-Cow-Interpreter
view release on metacpan or search on metacpan
MANIFEST.SKIP view on Meta::CPAN
#!start included /usr/share/perl5/5.30/ExtUtils/MANIFEST.SKIP
# Avoid version control files.
\bRCS\b
\bCVS\b
\bSCCS\b
,v$
\B\.svn\b
\B\.git\b
\B\.gitignore\b
\b_darcs\b
## The Cow Language
The Cow language has 12 instruction. The commands and their corresponding
code numbers are:
- moo (0)
This command is connected to the **MOO** command. When encountered during
normal execution, it searches the program code in reverse looking for a
matching **MOO** command and begins executing again starting from the found
**MOO** command. When searching, it skips the command that is immediately
before it (see **MOO**).
- mOo (1)
Moves current memory position back one block.
- moO (2)
Moves current memory position forward one block.
lib/Acme/Cow/Interpreter.pm view on Meta::CPAN
#printf " %4d", $_ for @$mem;
#print "\n";
#print "mpos ...:", " " x $$mem_pos, " ^^^^\n";
#print "reg ....: ", defined $$reg ? $$reg : "", "\n";
#<STDIN>;
# Code: moo
if ($code == 0) {
# Remember where we started searching for matching 'MOO'.
my $init_pos = $$prog_pos;
# Skip previous instruction when looking for matching 'MOO'.
$$prog_pos --;
my $level = 1;
while ($level > 0) {
lib/Acme/Cow/Interpreter.pm view on Meta::CPAN
$code = $prog -> [$$prog_pos];
}
# Code: MOO
elsif ($code == 7) {
if ($mem -> [$$mem_pos] == 0) {
# Remember where we started searching for matching 'moo'.
my $init_pos = $$prog_pos;
# Skip next instruction when looking for matching 'moo'.
$$prog_pos ++;
my $level = 1;
my $prev_code;
lib/Acme/Cow/Interpreter.pm view on Meta::CPAN
The Cow language has 12 instruction. The commands and their corresponding
code numbers are:
=over 4
=item moo (0)
This command is connected to the B<MOO> command. When encountered during
normal execution, it searches the program code in reverse looking for a
matching B<MOO> command and begins executing again starting from the found
B<MOO> command. When searching, it skips the command that is immediately
before it (see B<MOO>).
=item mOo (1)
Moves current memory position back one block.
=item moO (2)
Moves current memory position forward one block.
( run in 0.362 second using v1.01-cache-2.11-cpan-0d8aa00de5b )