#!/usr/bin/env perl
use utf8;
q{
=pod
=encoding UTF8
=head1 NAME
7 - an esoteric programming language
=head1 SYNOPSIS
./7 program.7 # run
./7 -d program.7 # debug
=head1 DESCRIPTION
7 is an esoteric programming language, inspired by Underload (although
it has diverged somewhat), but aiming for small source code
representation.
The language operates using two main pieces of internal state: the
I, which is a vaguely stack-like construct that holds data; and
the I. The frame consists of a sequence of commands
separated by I; the command list is also a sequence of commands.
The program operates by repeatedly removing the first command from the
command list, then performing the action specified by that command on
the frame. Once the command list is empty, the portion of the frame
to the right of the last bar is copied to the start of the command
list; this operation is called "cycling". (Cycling exits the program
if the frame is completely empty, and is an error if the frame is
nonempty but has no bars; also, as a special case, it deletes the
rightmost bar if nothing is to its right, in order to avoid a trivial
infinite loop.) These are the only ways in which the command list can
be modified.
The frame is a "working space" for the program, and so can be modified
in rather more interesting ways than the command list. However,
typically only the section to the right of the rightmost bar is
modified, so operations tend to be fairly local and self-contained.
=head2 Frame operations
There is a range of basic operations that can be performed on the
frame:
=over 4
=item *
You can I something to the frame, either a bar or a command.
This adds the bar or command in question to the right of the frame.
=item *
You can I the frame, removing the rightmost bar ("closing the
gap" where the bar was in the process).
=item *
You can I a section of the frame to the end. A section is the
region of the frame between two bars, or from a bar to an end of the
frame. When copying a section, a bar is placed to separate the copy
from the rest of the frame.
=item *
You can I a section of the frame to the end. This is like
copying, except that original section (together with one of the bars
between it and the adjacent sections) is removed.
=item *
You can I the end of the frame, again from the rightmost bar
onwards. This will delete the bar in the process.
=item *
You can I