Skip to content

Instantly share code, notes, and snippets.

View SpamixOfficial's full-sized avatar

SpamixOfficial SpamixOfficial

View GitHub Profile
@SpamixOfficial
SpamixOfficial / brainfuck_macro.rs
Last active May 2, 2024 14:17
Brainfuck interpreter as rust macro
/* µ-macro Brainfuck, by _madfrog */
macro_rules!f{($d:tt$f:tt$($p:tt$b:tt)*)=>
{macro_rules!b{(f$i:tt$o:tt$d($d$f:tt)*)=>
{use std::io::*;let mut x=($o,$i,[0u8;8<<9
],0);$d(b!{x$d$f};)*};$(($d$f:tt$p)=>$b;)*
($a:tt$c:tt)=>{}}}}f!($f->(b!($f-);b!($f>)
)<-(b!($f<);b!($f-))<<($f.3-=2)>>($f.3+=2)
..(b!($f.);b!($f.))>($f.3+=1)<($f.3-=1)+($
f.2[$f.3]+=1)-($f.2[$f.3]-=1).($f.0.write(
&[$f.2[$f.3]]).and($f.0.flush()).ok())[$($