#!/bin/perl -w #Underload interpreter in Perl. By ais523 use strict; my $prog=""; my @stack=(); while($prog||(defined($_=<>)&&($prog.=$_))) { my $f=substr $prog,0,1; $prog=substr $prog,1; $f eq 'S' and print shift @stack; $f eq 'a' and $stack[0]='('.$stack[0].')'; $f eq '^' and $prog=$prog.shift @stack; $f eq ':' and unshift @stack, $stack[0]; $f eq '*' and do{$stack[1].=$stack[0]; shift @stack;}; $f eq '!' and shift @stack; $f eq '~' and do{my $t=$stack[0]; $stack[0]=$stack[1]; $stack[1]=$t}; $f eq '(' and do{ my $t=''; my $n=1; while($n) { $f=substr $prog,0,1; $prog=substr $prog,1; $f eq '(' and $n++; $f eq ')' and $n--; $n and $t.=$f; } unshift @stack, $t; }; }