All pastes #943970 Raw Edit

ehird

public text v1 · immutable
·published 2008-03-15 19:08 UTC
rendered paste body
# An interpreter for minidei.
# Written by Elliott Hird, 2008.
# Released into the public domain.

$/ = undef;
$_ = <>;
/\[|\]/ and die "[] found in input";
$_ = "[] ".$_;
my $q = qr/\[((?:(?:R)|[^ \[\]]+)*)\]/;
my $w = qr/([^ ]+)/;
{
  s/\s+/ /g;
  s/^\s+|\s+$//g;
  print $_, "\n";
  s/$w dei/$1 [$1]/;
  s/$q wrap/[[$1]]/ and redo;
  s/$q drop// and redo;
  s/$q dup/[$1] [$1]/ and redo;
  s/$q $q swap/[$2] [$1]/ and redo;
  s/$q i/$1/ and redo;
  s/$q $q compose/[$1 $2]/ and redo;
}