; Jonathan Frech, 2021-12-22 ; see: https://blog.jfrech.com/248/ ; compilation one-liner (zsh): ; % sh =(curl -fsSL blog.jfrech.com/248/run.sh) "$(realpath tree.ma)" ; compiled brainfuck: ; >[-]+++++>[-]>[-]<<[->+>+<<]>>[-<<+>>]<[->[-]>[-]<<<[->>+>+<<<]>>>[-<<<+>> ; >][-]>[-]<<<[->>+>+<<<]>>>[-<<<+>>>]<[-<->][-]>[-]<<[->+>+<<]>>[-<<+>>]<<[ ; ->+<]>->[-]>[-]<<<<[->>>+>+<<<<]>>>>[-<<<<+>>>>][-]>[-]<<<[->>+>+<<<]>>>[- ; <<<+>>>]<<[>>[-]++++++++++++++++++++++++++++++++.<<-]>[>[-]+++++++++++++++ ; +++++++++++++++++++++++++++.<-]>[-]++++++++++.<<<<<]<+>[-]<[-->+<]>>[-]>[- ; ]<<[->+>+<<]>>[-<<+>>][-]>[-]<<<[->>+>+<<<]>>>[-<<<+>>>]<<[>>[-]++++++++++ ; ++++++++++++++++++++++.<<-]>[>[-]+++++++++++++++++++++++++++++++++++++++++ ; +.<-]>[-]++++++++++. (macro line:zz (w s) ( (while:re w ( (putc:v ' ') (dec:a w))) (while:re s ( (putc:v '*') (dec:a s))) (putc:v '\n'))) (derive line:zz line:rr) (derive divmod:arw divmod:avw) ; `height` ought to be odd (macro main:v (height) ( (let:nve $height height ( (let:nre $w $height ( (while:re $w ( (dec:a $w) (let:nre $height-w $height ( (sub:ra $w $height-w) (let:nre $s $height-w ( (add:za $height-w $s) (dec:a $s) (line:rr $w $s))))))))) ; `$height` is odd (inc:a $height) (let:nve $height/2 0 ( (while:re $height ( (dec:a $height) (dec:a $height) (inc:a $height/2))) (line:rr $height/2 $height/2))))))) (main:v 5)