Vegetarianboy30

hello world test programs in branflakes compilation

Jan 17th, 2021
1,739
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. This program prints out the words Hello World!:
  2. 1 +++++ +++               Set Cell #0 to 8
  3. 2 [
  4. 3     >++++               Add 4 to Cell #1; this will always set Cell #1 to 4
  5. 4     [                   as the cell will be cleared by the loop
  6. 5         >++             Add 4*2 to Cell #2
  7. 6         >+++            Add 4*3 to Cell #3
  8. 7         >+++            Add 4*3 to Cell #4
  9. 8         >+              Add 4 to Cell #5
  10. 9         <<<<-           Decrement the loop counter in Cell #1
  11. 10     ]                   Loop till Cell #1 is zero
  12. 11     >+                  Add 1 to Cell #2
  13. 12     >+                  Add 1 to Cell #3
  14. 13     >-                  Subtract 1 from Cell #4
  15. 14     >>+                 Add 1 to Cell #6
  16. 15     [<]                 Move back to the first zero cell you find; this will
  17. 16                         be Cell #1 which was cleared by the previous loop
  18. 17     <-                  Decrement the loop Counter in Cell #0
  19. 18 ]                       Loop till Cell #0 is zero
  20. 19
  21. 20 The result of this is:
  22. 21 Cell No :   0   1   2   3   4   5   6
  23. 22 Contents:   0   0  72 104  88  32   8
  24. 23 Pointer :   ^
  25. 24
  26. 25 >>.                     Cell #2 has value 72 which is 'H'
  27. 26 >---.                   Subtract 3 from Cell #3 to get 101 which is 'e'
  28. 27 +++++ ++..+++.          Likewise for 'llo' from Cell #3
  29. 28 >>.                     Cell #5 is 32 for the space
  30. 29 <-.                     Subtract 1 from Cell #4 for 87 to give a 'W'
  31. 30 <.                      Cell #3 was set to 'o' from the end of 'Hello'
  32. 31 +++.----- -.----- ---.  Cell #3 for 'rl' and 'd'
  33. 32 >>+.                    Add 1 to Cell #5 gives us an exclamation point
  34. 33 >++.                    And finally a newline from Cell #6
  35. The same program in minimised form:
  36. ++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.
  37. This is a slightly more complex variant that often triggers interpreter bugs. This uses cell values below zero and so doesn't work on fascist, score-computing interpreters.
  38. >++++++++[-<+++++++++>]<.>>+>-[+]++>++>+++[>[->+++<<+++>]<<]>-----.>->
  39. +++..+++.>-.<<+[>[+>+]>>]<--------------.>>.+++.------.--------.>+.>+.
  40. Short program printing Hello, World! by primo from http://codegolf.stackexchange.com/a/68494/6691. This program needs four cells to the left of the starting point (so standard scoring would give it an adjustment of four instructions and four ticks) and requires wrapping byte sized cells.
  41. --<-<<+[+[<+>--->->->-<<<]>]<<--.<++++++.<<-..<<.<+.>>.>>.<<<.+++.>>.>>-.<<<+.
  42. Currently, the shortest known program printing Hello, World! is written by KSab from https://codegolf.stackexchange.com/a/163590/59487:
  43. +[-->-[>>+>-----<<]<--<---]>-.>>>+.>>..+++[.>]<<<<.+++.------.<
RAW Paste Data