boot2

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

008-while-break.scm (464B)


      1 ;; tests/cc-cg/08-while-break-continue.scm — loop with break only.
      2 ;; Models: int main(void) { while (1) { break; } return 5; }
      3 ;; Exercises cg-loop's tag return + cg-break with a terminating loop.
      4 
      5 (let ((cg (cg-init)))
      6   (cg-fn-begin cg "main" '() %t-i32)
      7   (cg-loop cg
      8            (lambda () (cg-push-imm cg %t-i32 1))
      9            (lambda (tag) (cg-break cg tag)))
     10   (cg-push-imm cg %t-i32 5)
     11   (cg-return cg)
     12   (cg-fn-end cg)
     13   (write-bv-fd 1 (cg-finish cg)))