Changed accumulator test/bind order to bind/test

This means vectoring exits directly when the index loop variable =
:length.

It also means :final has to change.
This commit is contained in:
Linus 2021-05-18 19:57:02 +02:00
parent aa77fef2ad
commit 7a1137e579
3 changed files with 71 additions and 66 deletions

View file

@ -54,6 +54,7 @@
((loop . rest)
(%loop (loop . rest) . rest))))
(define-syntax %loop
(syntax-rules (=>)
((%loop o () => expr body ...)
@ -142,9 +143,8 @@
((_ orig name l a v c r f ff ((cur-ub ...) . ub-rest) ((:break expr) clauses ...) . body)
(cl orig name l a v c r f ff ((cur-ub ... (:break expr)) . ub-rest) (clauses ...) . body))
;; user final
;; This pushes a #t to the user when expression, thus forcing a subloop if a for-clause is found afterwards.
((_ orig name l a v c r f ff user ((:final expr) clauses ...) . body)
(final :acc ((_) (expr)) cl-next/acc orig name l a v c r f ff user (clauses ...) . body))
((_ orig name l a v c r f ff ((cur-user ...) . user-rest) ((:final expr) clauses ...) . body)
(final :acc ((fin) (expr)) cl-next/acc orig name l a v c r f ff ((cur-user ... (:break fin)) . user-rest) (clauses ...) . body))
;; User do - sideffecting stuff.
((_ orig name l a v c r f ff ((cur-uw ...) . uw-rest) ((:do expr ...) clauses ...) . body)
@ -196,7 +196,7 @@
checks
((refs ... new-refs ...))
(finals ... new-finals ...)
ff ((cur-ub ... (:break new-checks) ... (:bind (accvar accupdate) ...)) . ub-rest) clauses . body))
ff ((cur-ub ... (:bind (accvar accupdate) ...) (:break new-checks) ... ) . ub-rest) clauses . body))
;; We have ONE subloop!
((_ (new-lets ...) ((accvar accinit accupdate) ...) (new-checks ...) (new-refs ...) (new-finals ...)
orig name