cal.bf

カレンダーを出力するプログラム

 > echo 2008 10 | ./bfi.rb cal.bf
           1  2  3  4
  5  6  7  8  9 10 11
 12 13 14 15 16 17 18
 19 20 21 22 23 24 25
 26 27 28 29 30 31 
 >>>>>>>>>>>>>>>>>>>>
 >
 ,--------------------------------[---------------->,--------------------------------]
 <+
 <[->++++++++++<]
 <<[->++++++++++<]
 <<<
 ,
 ------------------------------------------------
 <,
 +[-----------[-----------------------------[->+<]]]
 >
 [-<+<+>>>>+<<]
 <<
 
 <<------<----<-<------<---<-------<-----<--<-------<----<----<-
 [>]
 >-[-<<[<]>[+]>[>]>]
 -
 <<<[>[+]<<]>
 >+[-<[+>-<]>>+]
 
 >[-<<<<+>>>>]
 <<<<
 
 <<-<--<-<--<-<-<--<-<--<-<----<-
 [>]
 >-[-<<[<]>[+]>[>]>]
 -
 <<[>[+]<<]>
 >+[-<[+>-<]>>+]
 
 <++++++++++++++++++++++++++++++++
 
 >>>
 >>      
 >>>
 
 # 1 *0 y1 0 y2
 >>[-<+>>>>>>>+<<<<<<]
 >>>>>>
 [>[-]>[-]>[-]>[-]<<<<<<++++<+>[->>[>]+[<]>-<<]>>]>[>]<<[>-<[<]>+[>]<<]
 >[-<<<+>>>]
 <<<----[++++<->>]<[<]
 # 1 y1 0 0 y2 y1/4 y1%4
 >-[-<+>>>>>>>+<<<<<<]
 >>>>>>
 ++++
 [>[-]>[-]>[-]>[-]<<<<<<++++<+>[->>[>]+[<]>-<<]>>]>[>]<<[>-<[<]>+[>]<<]
 >[-<<<+>>>]
 <<<----[++++<->>]
 <<<<<<<<<[<]>
 >>>>>>>-
 # 1 y1 0 y2 0 y1/4 y1%4 *y2/4 y2%4
 [-<<+>>]<<
 <<[-<+<<<+>>>>]>>
 [-<<<+>>>]<<<[->+<]
 <
 [->+>+++++<<]
 >>
 
 # 1 0 y1 *wday 0 0 y1%4 0 y2%4
 
 # leap (check y%100)
 <<<<
 <+>
 [<->>>>>>+>>>>[<<<<->>>>[-]]<<<<<<<<<[-]]
 <[->>>>>>+>>[<<->>[-]]<<<<<<<<]>
 >>>>
 
 # 1 0 y1 *wday leap 0 y1%4 0 y2%4
 
 >[-
 <<<<
 ------------[+[+[+[+[+[+[+[+[+[
 >>>-<<<
 ++[<<<<<<<<+>>>>>>>>-]
 [+]
 ]]]]]]]]]]
 >>>>]
 <
 
 -
 <<<<<<<<[+>>>>>>>>+<<<<<<<<]>>>>>>>>
 [->>>>>>>>>+<<<<<<<<<]
 >>>>>>>>>
 
 [>[-]>[-]>[-]>[-]>[-]>[-]>[-]<<<<<<<<<+++++++<+>[->>[>]+[<]>-<<]>>]>[>]<<[>-<[<]>+[>]<<]
 >[-<<<+>>>]
 <<<
 <+>
 # 1 0 y1 0 0 0 y1%4 0 y2%4 ?? *wday
 
 -------
 [+++++++>>+<]
 
 >[<]>[-]<
 <
 
 [->+>+<<]>>
 
 >++++++++++++++++++++++++++++++++<
 [->...<]
 >[-]
 <+<-------
 <[-]>  # unecessary
 
 # 1 0 y1 0 0 0 y1%4 0 y2%4 ?? 0 *(wday minus 7) 0 1
 
 >
 
 <<<<<<<<<<<<<<<<<<<<
 [
 >>>>>>>>>>>>>>>>>>>>
 
 [->+>+>+<<<]>>>
 -[-[-[-[-[-[-[-[-[
 [-]
 <
 
 [->>>+<<<]
 >>>
 [
 >>>>>>>>>>>>>>>>>>>>
 +
 <<<<<<<<<<<<<<<<<<<<
 >[-]>[-]>[-]>[-]>[-]>[-]>[-]>[-]>[-]>[-]<<<<<<<<<<<<++++++++++<+>[->>[>]+[<]>-<<]>>]>[>]<<[>-<[<]>+[>]<<]
 
 >
 
 ----------[++++++++++<
 >>>>>>>>>>>>>>>>>>>>
 -
 <<<<<<<<<<<<<<<<<<<<
 ]
 <<<[>]>>
 >>>>>>>>>>>>>>>>>>>>
 ++++++++++++++++++++++++++++++++++++++++++++++++.[-]
 <<<<<<<<<<<<<<<<<<<<
 >++++++++++++++++++++++++++++++++++++++++++++++++.
 
 [-]<[-]
 <<<[-]
 ]]]]]]]]]
 
 <[<]>>
 [>++++++++++++++++++++++++++++++++.[-]
 <
 # 1 0 y1 0 0 0 y1%4 0 y2%4 ?? 0 (wday minus 7) 0 1 *1
 ++++++++++++++++++++++++++++++++++++++++++++++++.[-]
 ]
 
 <<<
 # 1 0 y1 0 0 0 y1%4 0 y2%4 ?? 0 *(wday minus 7) 0 1
 
 +[>>>++++++++++++++++++++++<<<<]
 >>[<<------->]
 >>++++++++++.[-]
 <[-<+>]<
 +
 
 [->+>+<<]
 >[-<+>]
 >
 [-]
 # implement month
 <<
 
 <<<<<<<<<<<<<<<<<<<<
 -
 
 ]

<< 3/26 >>
First Last