C <del>1058</del> 934 chars = #include<math.h> #include<signal.h> #define B break;case #define W write int*s,*t,*i,w,a,c,d;void S(int x){signal(SIGSEGV,S);sbrk(8*8*8);}u(x){*t++=x;}o(){return t>s?*--t:0;}p(x){char b;if(x<0){W(1,"-",1);x=-x;}c=floor(log10(x));for(c=c>=0?c:0;c>=0;c--){b=48+(x/(int)\ pow(10.0,c))%10;W(1,&b,1);}}main(){char b;signal(SIGSEGV,S);t=s=sbrk(8*8*8);while(read(0,&b,1)){switch(b){case '0':w=o();a=o();for(c=ceil(log10(w));c>0;c--)a*=10;u(a+w);B '1':u(o()+1);B '2':u(o()-1);B '3':w=o();u(o()*w);B '4':w=o();u(o()/w);B '5':u(o()+o());B '6':w=o();u(o()-w);B '7':c=o();a=1;for(w=o();c>0;c--)a*=w;u(a);B '8':w=o();u(o()%w);B '9':w=*s;memmove(s,s+1,4*(t-s-1));t[-1]=w;B 'A':w=t[-1];memmove(s+1,s,4*(t-s-1));*s=w;B 'B':w=o();u(w);u(w);B 'C':w=o();a=o();u(a);u(w);u(a);u(w);B 'D':w=o();a=o();u(a);u(w);B 'E':w=o();a=o();c=o();d=o();u(d);u(c);u(a);u(w);B 'F':o();break;}}W(1,"\n",1);W(1,"[",1);i=t;do{p(*--i);}while(i>s&&W(1,",",1));W(1,"]\n",2);} Ungolfed: #include<math.h> #include<signal.h> void S(int x){signal(SIGSEGV,S);sbrk(8*8*8);} int*s,*t,*i,w,a,c,d; u(x){*t++=x;} o(){return t>s?*--t:0;} p(x){ char b[1]; if(x<0){ write(1,"-",1); x=-x; } c=floor(log10(x)); for(c=c>=0?c:0;c>=0;c--){ *b=48+(x/(int)pow(10.0,c))%10; write(1,b,1); } } main(){ char b[1]; signal(SIGSEGV,S); t=s=sbrk(8*8*8); while(read(0,b,1)){ write(1,b,1); switch(*b){ case '0': w=o(); a=o(); for(c=ceil(log10(w));c>0;c--) a*=10; u(a+w); break; case '1': u(o()+1); break; case '2': u(o()-1); break; case '3': w=o(); u(o()*w); break; case '4': w=o(); u(o()/w); break; case '5': u(o()+o()); break; case '6': w=o(); u(o()-w); break; case '7': c=o();a=1; for(w=o();c>0;c--) a*=w; u(a); break; case '8': w=o(); u(o()%w); break; case '9': w=*s; memmove(s,s+1,4*(t-s-1)); t[-1]=w; break; case 'A': w=t[-1]; memmove(s+1,s,4*(t-s-1)); *s=w; break; case 'B': w=o(); u(w); u(w); break; case 'C': w=o(); a=o(); u(a); u(w); u(a); u(w); break; case 'D': w=o(); a=o(); u(a); u(w); break; case 'E': w=o(); a=o(); c=o(); d=o(); u(d); u(c); u(a); u(w); break; case 'F': o(); break; } } write(1,"\n",1); write(1,"[",1); i=t; do { p(*--i); } while(i>s && write(1,",",1)); write(1,"]\n",2); }