Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate tuple helpers from always-run #673

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 1 addition & 16 deletions dag_in_context/src/schedule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,8 @@ pub(crate) fn helpers() -> String {
"
;; first, run substitution and drop to saturation
;; these depend on type analysis, always-run, and context
;; (saturate
;; (saturate
;; type-analysis
;; (saturate type-helpers)
;; error-checking
;; always-run
;; context)

;; (saturate drop)
;; apply-drop-unions
;; cleanup-drop

;; (saturate subst)
;; apply-subst-unions
;; cleanup-subst)

;; first, saturate always run
(saturate tuple-helpers)
(saturate
(saturate
(saturate type-helpers)
Expand Down
1 change: 1 addition & 0 deletions dag_in_context/src/schema.egg
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@
; Rulesets
(ruleset always-run)
(ruleset is-resolved)
(ruleset tuple-helpers)
(ruleset error-checking)
(ruleset memory)
(ruleset memory-helpers)
Expand Down
6 changes: 3 additions & 3 deletions dag_in_context/src/utility/canonicalize.egg
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@
; Make Concats right-deep
(rewrite (Concat (Concat a b) c)
(Concat a (Concat b c))
:ruleset always-run)
:ruleset tuple-helpers)
; Simplify Concat's with empty
(rewrite (Concat (Empty ty ctx) x)
x
:ruleset always-run)
:ruleset tuple-helpers)
(rewrite (Concat x (Empty ty ctx))
x
:ruleset always-run)
:ruleset tuple-helpers)

; Make a tuple that is a sub-range of another tuple
; tuple start len
Expand Down
10 changes: 5 additions & 5 deletions dag_in_context/src/utility/util.egg
Original file line number Diff line number Diff line change
Expand Up @@ -26,33 +26,33 @@
((set (tuple-length expr) len)) :ruleset always-run)

;; Create a Get for every index, and rewrite it to see through Concat
(rule ((Single expr)) ((union (Get (Single expr) 0) expr)) :ruleset always-run)
(rule ((Single expr)) ((union (Get (Single expr) 0) expr)) :ruleset tuple-helpers)
;; initial get
(rule ((> (tuple-length tuple) 0))
((Get tuple 0))
:ruleset always-run)
:ruleset tuple-helpers)
;; next get
(rule ((= len (tuple-length tuple))
(= ith (Get tuple i))
(< (+ i 1) len)
)
((Get tuple (+ 1 i)))
:ruleset always-run)
:ruleset tuple-helpers)

;; descend left
(rule ((Get (Concat expr1 expr2) i)
(= (tuple-length expr1) len1)
(< i len1))
((union (Get (Concat expr1 expr2) i)
(Get expr1 i)))
:ruleset always-run)
:ruleset tuple-helpers)
;; descend right
(rule ((Get (Concat expr1 expr2) i)
(= (tuple-length expr1) len1)
(>= i len1))
((union (Get (Concat expr1 expr2) i)
(Get expr2 (- i len1))))
:ruleset always-run)
:ruleset tuple-helpers)


;; A temporary context.
Expand Down
Loading