Skip to content

Instantly share code, notes, and snippets.

@ilyakurdyukov
Created December 12, 2020 04:30
Show Gist options
  • Save ilyakurdyukov/3f08160450a1d6c471c7712029886f09 to your computer and use it in GitHub Desktop.
Save ilyakurdyukov/3f08160450a1d6c471c7712029886f09 to your computer and use it in GitHub Desktop.
That's just another Hello World. But with heavy restrictions, no keywords, no numbers, no strings or literals, only 3 operations: x(!=0), x++, x+=y. Inspired by the "addleq" OISC.
P,o,S,i,t,I,v,E;
main(){v?(o+=o)?i+=i,i++:(
o+=t,S?E? P?i+=v:(o
+=i,o+= o,o+=o)
,o++:( (I?P?o
+=i:o ,o+=o
,o+=t ,o+=o
,o+=o :(o+=
o,o+= t,P?++ o,o+=o ,o++,
o+=o: (o+=o,++ o,o+=o,o ++)))
):(E ?(I?P?++ o,o+=o,o ++,o
+=o,o ++,o+= o,o++, S++:(
o+=i ,o+=
o,(o +=o)
):(o +=o,
P?(o +=o,
o+=t, o+=i)
:((o +=t, o+=o ,o++
,o+=o ),o++ ))):( I?o+=
o,o+= t,(o+= o,o+=o ):(P?
o+=i, o+=o,o+=t,o+=o,o +=o,o
++:(o +=o,o+=o ,o+=o
)))), P+=(P
)?I+=( I?E+=E
?i:v,i: v),i:v,
putchar(o )):(t++,v
+=++o,t+=t,t+=t,t+=t,t++,i
++),i?main():o;}
@ilyakurdyukov
Copy link
Author

You can suppress compiler warnings by replacing the first line with this:

unsigned              P,o,S,i,t,I,v,E;                   int

Also the square version:

  P,o,S,i,t,I,v,E;main(){(v?(o+=
  o)?o:(o+=t,S?E?P?v+=i,o++:(o+=
  i,o+=o,o+=o,o++):(I?P?o+=i:o,o
  +=o,o+=t,o+=o,o+=o:(o+=o,o+=t,
  P?o++,o+=o,o++,o+=o:(o+=o,o++,
  o+=o,o++))):(E?I?P?o++,o+=o,++
  o,o+=o,o++,o+=o,o++,S++:(o+=i,
  o+=o,o+=o):(o+=o,P?o+=o,o+=t,o
  +=i:(o+=t,o+=o,o++,o+=o,o++)):
  (I?o+=o,o+=t,o+=o,o+=o:(P?o+=i
  ,o+=o,o+=t,o+=o,o+=o,o++:(o+=o
  ,o+=o,o+=o)))),P+=P?I+=I?E+=E?
  i:v,i:v,i:v,putchar(o),v):(i?i
  +=i:o++,o+=o?o:(v++,t++,t+=t,t
  +=t,t+=t,++t),++i))?main():o;}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment