Talk:Malbrain

From Esolang
Jump to navigation Jump to search

Much prefer this syntax ...

.::.........::::.:::.:........::::::.:::.::::.::.:::.::::.
::.......::::.:::.:....::::::.:::.::::.::.:.::.::::::.......
::..::::::...::.::::...::........::::.:::.:....::::::.:::.::::.
::.:::.::::...::..........::::.:::.:.........::::::.:::.::::.::.
::...:.:::::....:::.::::::...::.:::::::......:.:::::::........:.
::::..::.::.

--(this comment by Rdebath at 13:54, 25 August 2013‎ UTC; please sign your comments with ~~~~)

External Links broken

All the external links are broken, and unavailable via archive.org. - Paul2520 (talk) 03:18, 14 May 2015 (UTC)

Okay, here's a compiler implementation, it converts malbrain to C (ish!!) ...
1i\
#include<stdio.h>\
#define b while(*m) {\
#define i {int (_c) = getchar(); if(_c!=EOF) *m=_c; }\
#define o putchar(*m);\
#define d --*m;\
#define u ++*m;\
#define l m-=1;\
#define r m+=1;\
#define e }\
#define _ return 0;}\
int mem[30000];int main(){register int*m=mem;
$a\
_
s/[^>.]//g
y/>./NE/
H
g
s/\n//g
s/^N/l/
s/^E/rE/
t nxtl
:nxtl
s/^rN/l/
s/^lN/u/
s/^uN/d/
s/^dN/o/
s/^oN/i/
s/^iN/b/
s/^bN/e/
s/^eN/r/
t nxtl
h
s/^\(.\)E.*/\1/
t prti
b dele
:prti
p
g
s/^\(.\)E/\1/
t nxtl
:dele
d
Rdebath (talk) 07:08, 15 August 2015 (UTC)
Cool. How do you compile it? I tried with gcc, but that didn't seem to work. Paul2520 (talk) 12:50, 5 September 2015 (UTC)
Heh, heh. Okay, it's a sed script. Use it like this ...
$ sed -f malbrain.sed HellowWorld.mb > hw.c
$ gcc -o hw hw.c
$ ./hw
Hello World!
Rdebath (talk) 17:07, 5 September 2015 (UTC)