Acme-Cow-Interpreter
view release on metacpan or search on metacpan
lib/Acme/Cow/Interpreter.pm view on Meta::CPAN
# -*- mode: perl; coding: us-ascii-unix; -*-
=pod
=head1 NAME
Acme::Cow::Interpreter - Cow programming language interpreter
=head1 SYNOPSIS
use Acme::Cow::Interpreter;
my $cow = Acme::Cow::Interpreter -> new();
$cow -> parse_file($file);
$cow -> execute();
=head1 ABSTRACT
This module implements an interpreter for the Cow programming language.
=head1 DESCRIPTION
This module implements an interpreter for the Cow programming language. The
Cow programming language is a so-called esoteric programming language, with
only 12 commands.
=cut
package Acme::Cow::Interpreter;
use strict; # restrict unsafe constructs
use warnings; # control optional warnings
use Carp;
our $VERSION = '0.02';
# This hash maps each of the 12 command (used in the source code) to the
# corresponding numerical code, from 0 to 11.
my $cmd2code =
{
moo => 0,
mOo => 1,
moO => 2,
mOO => 3,
Moo => 4,
MOo => 5,
MoO => 6,
MOO => 7,
OOO => 8,
MMM => 9,
OOM => 10,
oom => 11,
};
# This array maps each of the 12 numerical codes to the corresponding
# command (used in source code).
my $code2cmd =
[
( run in 1.930 second using v1.01-cache-2.11-cpan-df04353d9ac )