We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.
User:C0ffee/bf.sed
Jump to navigation
Jump to search
I learned sed so I made a brainfuck interpreter
, (input) is not impletemented
# 8-bit brainfuck interpreter in sed
# 13 cells (this can be changed)
# Please do not input multiple lines of BF code
s/[{}]//g
y/[]/{}/
s/[^-+<>{},.]//g
s/.*/00 00 00 00 00 00 00< 00 00 00 00 00 00:!&:/
:)
# p # debug
/!+/{
s/0</1;/
s/1</2;/
s/2</3;/
s/3</4;/
s/4</5;/
s/5</6;/
s/6</7;/
s/7</8;/
s/8</9;/
s/9</a;/
s/a</b;/
s/b</c;/
s/c</d;/
s/d</e;/
s/e</f;/
s/f</<0;/
s/0</1/
s/1</2/
s/2</3/
s/3</4/
s/4</5/
s/5</6/
s/6</7/
s/7</8/
s/8</9/
s/9</a/
s/a</b/
s/b</c/
s/c</d/
s/d</e/
s/e</f/
s/f</0/
s/;/</
}
/!-/{
s/1</0;/
s/2</1;/
s/3</2;/
s/4</3;/
s/5</4;/
s/6</5;/
s/7</6;/
s/8</7;/
s/9</8;/
s/a</9;/
s/b</a;/
s/c</b;/
s/d</c;/
s/e</d;/
s/f</e;/
s/0</<f;/
s/0</f/
s/1</0/
s/2</1/
s/3</2/
s/4</3/
s/5</4/
s/6</5/
s/7</6/
s/8</7/
s/9</8/
s/a</9/
s/b</a/
s/c</b/
s/d</c/
s/e</d/
s/f</e/
s/;/</
}
/!>/{
s/<\( ..\)/\1</
}
/!</{
s/\( ..\)</<\1/
}
/!{/{
/00</{
s/!{/{c!/
:D
s/\(c*\)!\([-+<>.,]\)/\2\1!/
s/\(c*\)c!}/}\1!/
s/\(c*\)!{/{\1c!/
/c!/bD
s/}!/!}/
}
}
/!}/{
/00</!{
s/!}/c!}/
:P
s/\([-+<>.,]\)\(c*\)!/\2!\1/
s/{\(c*\)c!/\1!{/
s/}\(c*\)!/\1c!}/
/c!/bP
}
}
/!\./{
s/\([0-9a-f]*\)<\(.*\)$/&\1/
}
s/!\(.\)/\1!/
/!:/!b)
s/^.*:\([0-9a-f]*\)$/\1/
s/../\\x&/g
s/.*/echo -e "&"/e