boot2

Playing with the boostrap
git clone https://git.ryansepassi.com/git/boot2.git
Log | Files | Refs | README

006-if.scm (385B)


      1 ;; tests/cc-cg/06-if.scm — `if (1) return 7;` shape.
      2 ;; Exercises cg-if + thunk-driven body emission.
      3 
      4 (let ((cg (cg-init)))
      5   (cg-fn-begin cg "main" '() %t-i32)
      6   (cg-push-imm cg %t-i32 1)
      7   (cg-if cg
      8          (lambda ()
      9            (cg-push-imm cg %t-i32 7)
     10            (cg-return cg)))
     11   (cg-push-imm cg %t-i32 0)
     12   (cg-return cg)
     13   (cg-fn-end cg)
     14   (write-bv-fd 1 (cg-finish cg)))