https://github.com/akkartik/mu/blob/main/linux/raytracing/1.mu

     1 # Listing 1 of https://raytracing.github.io/books/RayTracingInOneWeekend.html
     2 # (simplified)
     3 #
     4 # To run (on Linux):
     5 #   $ git clone https://github.com/akkartik/mu
     6 #   $ cd mu
     7 #   $ ./translate raytracing/1.mu
     8 #   $ ./a.elf > 1.ppm
     9
    10 fn main -> _/ebx: int {
    11   print-string 0, "P3\n256 256\n255\n"
    12   var j/ecx: int <- copy 0xff
    13   {
    14     compare j, 0
    15     break-if-<
    16     var i/eax: int <- copy 0
    17     {
    18       compare i, 0xff
    19       break-if->
    20       print-int32-decimal 0, i
    21       print-string 0, " "
    22       print-int32-decimal 0, j
    23       print-string 0, " 64\n"
    24       i <- increment
    25       loop
    26     }
    27     j <- decrement
    28     loop
    29   }
    30   return 0
    31 }