Generate Brainfuck for the numbers 1–255 Write a program that, for the numbers 1 through 255, prints out BF code that will produce the given number in some byte of the array, plus a newline.

For example, the first four lines of the output could (and most likely will) be:

+
++
+++
++++


The winner will be the smallest: source code + output (in bytes).

Clarifications &amp; Revisions:


BF programs use wrapping cells.
The output BF program must terminate with the only non-zero cell being the cell containing the number.
Programs must be output in ascending order.
Outputting a program for 0 is optional.
Negative data pointers are not allowed. &lt; at the first pointer will do nothing. (leave a comment if it would be more appropriate to have it throw)
Perl 6, 224 + 3964 = 5834 4188 bytes



map {say (.[0]~'['~.[3]~'&gt;'~.[1]~'&lt;]')x?.[1],'&gt;'x?.all,.[2]}o*.min({$_&gt;&gt;.abs.sum+6*?.[1]})&gt;&gt;.&amp;{&lt;- +&gt;[.sign&gt;0]x.abs},classify({0+|(grep(*%%1,(((256 X*^4)X+.[0]%256)X/-.[3]))[0]*.[1]+.[2])%256},[X] |(^27-13 xx 3),-7..-1){^256}


Try it online! (may timeout. Change the ^27-13 to ^25-12 to speed up slightly at the cost of some extra output)

Outputs the shortest code in the form *&gt;[*&gt;*&lt;]&gt;*, where each * is a certain number of +s or -s. There are some extra tweaks like removing the loop if it is not needed, as well as trailing &gt;s.

As far as I can tell, the output is the most golfed for this particular format.

Explanation:

([X] |(^27-13 xx 3),-7..-1)        # Define the search space as the cross product of:
                                        # -13 to 13 for:
                                            # Initialisation     +++&gt;
                                            # Change in target   [*&gt;+++&lt;]
                                            # Last change        &gt;+++
                                        # And -7 to -1 for the change in start [--&gt;*&lt;]
  .classify({                  })  # Group them by calculating
                  (256 X*^4)                         # Each of the multiples of 256
                 (          X+.[0]%256)              # Plus the initialisation
                (                      X/-.[3])      # Divided by the change in start
      grep(*%%1,                               )     # Filter out the whole numbers
                                                [0]  # And take the first value
          # This is the amount of times the inner loop will execute
          # Being Nil, converted to 0 if it is an infinite loop
      *.[1]              # Multiply by the change to the target cell
           +.[2]         # And add the final section
     (          )%256    # And modulo the whole lot by 256
                     +|0 # And floor it just to keep the .0 out
classify(                   ){^256}     # Take the corresponding groups in order
   .map(                             )  # And map each to
        *.min({                    })   # Find the minimum by:
               $_&gt;&gt;.abs.sum             # The sum of the absolute values    
                           +6*?.[1]     # Plus 6 if it loops
      &gt;&gt;.*{                   }    # Then map each value to
           &lt;- +&gt;[.sign&gt;0]          # + or - depending on the sign
                         x.abs     # Repeated by the absolute value 
   {                    }o              # And pass this to the next code block
    say                       # Print
        (.[0]~'['~.[3]~'&gt;'~.[1]~'&lt;]')             # The loop section
                                     x?.all       # If it is needed
                                           ,.[2]  # And the final part