Skip to content

Commit

Permalink
Compile higher-order floe positions in deforestation pass
Browse files Browse the repository at this point in the history
As the deforestation pass generates escaped Racket, we need to compile
any higher-order `floe` positions in the fusable list operations at
this stage, since the regular code generation step at the end of
compilation would not operate on these resultant escaped expressions.
  • Loading branch information
countvajhula committed Aug 3, 2024
1 parent 958fe14 commit 6efff74
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions qi-lib/flow/core/compiler/deforest/syntax.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -80,19 +80,21 @@
#:attributes (f)
#:literal-sets (fs-literals)
#:datum-literals (filter)
(pattern (#%deforestable filter (f))))

(pattern (#%deforestable filter (f-uncompiled))
#:attr f (run-passes #'f-uncompiled)))
(define-syntax-class fst-map
#:attributes (f)
#:literal-sets (fs-literals)
#:datum-literals (map)
(pattern (#%deforestable map (f))))
(pattern (#%deforestable map (f-uncompiled))
#:attr f (run-passes #'f-uncompiled)))

(define-syntax-class fst-filter-map
#:attributes (f)
#:literal-sets (fs-literals)
#:datum-literals (filter-map)
(pattern (#%deforestable filter-map (f))))
(pattern (#%deforestable filter-map (f-uncompiled))
#:attr f (run-passes #'f-uncompiled)))

(define-syntax-class fst-take
#:attributes (n)
Expand Down Expand Up @@ -124,17 +126,19 @@
#:datum-literals (foldr)
(pattern (#%deforestable
foldr
(op)
((#%host-expression init)))))
(op-uncompiled)
((#%host-expression init)))
#:attr op (run-passes #'op-uncompiled)))

(define-syntax-class fsc-foldl
#:attributes (op init)
#:literal-sets (fs-literals)
#:datum-literals (foldl)
(pattern (#%deforestable
foldl
(op)
((#%host-expression init)))))
(op-uncompiled)
((#%host-expression init)))
#:attr op (run-passes #'op-uncompiled)))

(define-syntax-class cad*r-datum
#:attributes (countdown)
Expand Down

0 comments on commit 6efff74

Please sign in to comment.