Created
March 29, 2016 09:34
-
-
Save pendingchaos/d7f8d6a92d3c64359179 to your computer and use it in GitHub Desktop.
An extremely compact PATH implementation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#define A while((z=getc(f))^EOF)if(z=='\n')++Y,X=0;else{if | |
#define Z x+=(K&3)-1,y+=(K>>3)-1 | |
#define J :z== | |
#define v m[C] | |
int m[30000];size_t s,C,r=1,K=10,x,y,X,Y=1;int main(int l,char**u){FILE*f=fopen(u[1],"r");char z;A(z=='$')break;++X;}x=X;y=Y;while(r){rewind(f);X=0,Y=1;A(X==x&Y==y)break;++X;}z=='#'?r=0 J'+'?v++J'-'?v--J'}'?C++J'{'?C--J','?v=getchar()J'.'?putchar(v)J'/'?K=K==10?1:K==17?8:K==8?17:10 J'\\'?K=K==10?17:K==17?10:K==8?1:8 J'^'?K=v?1:K J'<'?K=v?8:K J'>'?K=v?10:K J'v'?K=v?17:K J'!'?Z:0;Z;}return fclose(f);} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment