rendered paste body# ksh93 brainfuck compilertypeset -T countcache_t=( typeset op="" integer count=0 function flush { printf "${_.op}\n" "${_.count}" (( _.count=0 )) _.op="" return 0 } function write_op { typeset wop="$1" if [[ "${wop}" != "${_.op}" ]] ; then _.flush fi (( _.count++ )) _.op="${wop}" return 0 })function write_bf_head{cat <<EOF function pc # putchar { nameref x=\$1 typeset c c=\$(printf "%x\n" "\$x") printf "\u[\${c}]" } function gc # getchar { nameref x="\$1" typeset c if read -N1 c ; then (( x='\${c} )) else (( x=0 )) # EOF fi } set -o noglob IFS='' integer -a t integer p (( p=2**16 )) # tape start positionEOF return 0}# mainset -o noglobIFS=''countcache_t ccwrite_bf_headwhile read -N1 c ; do case "$c" in '>') cc.write_op "(( p+=%d ))" ;; '<') cc.write_op "(( p-=%d ))" ;; '+') cc.write_op "(( t[p]+=%d ))" ;; '-') cc.write_op "(( t[p]-=%d ))" ;; '.') cc.flush ; print 'pc t[p]' ;; ',') cc.flush ; print 'gc t[p]' ;; '[') cc.flush ; print 'while (( t[p] != 0 )) ; do' ;; ']') cc.flush ; print 'done' ;; esacdoneprint "exit 0"exit 0