Skip to content

Instantly share code, notes, and snippets.

@drkameleon
Created October 21, 2020 10:16
Show Gist options
  • Save drkameleon/64640c164e1a2ac568da952094a2d0f9 to your computer and use it in GitHub Desktop.
Save drkameleon/64640c164e1a2ac568da952094a2d0f9 to your computer and use it in GitHub Desktop.
BF to Arturo transpiler
memSize: 100
interpret: function [code][
m: map 0..memSize []->0
p: 0
continue: true
replace 'code "," "set m p input ------ "
replace 'code ">" "inc 'p "
replace 'code "<" "dec 'p "
replace 'code "+" "set m p (get m p)+1 "
replace 'code "-" "set m p (get m p)-1 "
replace 'code "[" "while {continue}{ "
replace 'code "]" "if (get m p)=0 {continue:false}} "
replace 'code "." "prints to :char (get m p) "
replace 'code "{" "["
replace 'code "}" "]"
do.import code
print ""
]
interpret read arg\0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment