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

Deforest All the Things #179

Merged
merged 113 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
113 commits
Select commit Hold shift + click to select a range
3dc3871
List-ref and cad*r deforestation
dzoep Mar 11, 2024
83384fb
Deforestation of length, empty?, and null?.
dzoep Mar 23, 2024
cf0b178
Deforest filter-map.
dzoep Mar 23, 2024
9d9c064
Pass deforested operation name in cad*r-cstream-next.
dzoep Apr 6, 2024
f315281
Fix failing car-deforested? test.
dzoep Apr 28, 2024
6df1eca
Cleaner syntax matching and production separation.
dzoep Apr 30, 2024
56f880a
Split compiler passes into separate modules.
dzoep May 5, 2024
5813c77
Move deforestation infrastructure into passes subdirectory.
dzoep May 5, 2024
30d812e
Finish fixing all the things broken by the rebase.
dzoep May 5, 2024
8ade245
Improve directory and module naming
dzoep May 24, 2024
04ca289
Deforest take with boxes.
dzoep May 31, 2024
bcb3118
Implement proper state cons-ing for take.
dzoep May 31, 2024
301a542
Add source syntax context to transformer composition.
dzoep May 31, 2024
a0381d7
New qi/list bindings and their literal matching, stateful transformer…
dzoep Jun 14, 2024
6fd8a93
Deforestation: rename all fusable stream syntax classes to fs[PTC]-sy…
dzoep Jun 15, 2024
1975925
Fix tests of qi/list - use the new bindings.
dzoep Jun 15, 2024
0134706
Split bindings module and add appropriate scribblings.
dzoep Jun 14, 2024
3288d0e
Update PR#175 with all the changes agreed upon at the weekly Qi compi…
dzoep Jun 27, 2024
536c75d
Fix phase shifting for fusion.rkt module.
dzoep Jun 28, 2024
ff5a395
Add attach-form-property to both places needed by current deforestati…
dzoep Jun 28, 2024
97a845d
Remove unused `require`
countvajhula Aug 3, 2024
510acb9
Introduce a `#%deforestable` core form
countvajhula Jun 29, 2024
0bed239
support basic cases of filter, map, foldl, foldr and range
countvajhula Jun 29, 2024
c213e80
a couple more tests for `range`
countvajhula Jul 2, 2024
c185564
formatting..
countvajhula Jul 10, 2024
cc8cf45
temporarily comment out some tests
countvajhula Jul 11, 2024
c6ee0b4
register deforestation pass in core
countvajhula Jul 11, 2024
e3eba11
Simplify #%deforestable syntax initially
countvajhula Jul 11, 2024
0dc8fe4
modify benchmarks and tests to work with simplified `range` syntax
countvajhula Jul 11, 2024
b48a276
Match `#%deforestable` in deforesting `map` and `filter`
countvajhula Jul 11, 2024
2d878fb
Remove tests that ensure only right-threading is deforested
countvajhula Jul 11, 2024
580b380
Match `#%deforestable` in `foldl` and `foldr`
countvajhula Jul 11, 2024
0269159
Match `#%deforestable` in deforesting `car`
countvajhula Jul 11, 2024
c6dfd57
Use `#%deforestable` in `cadr`, `caddr`, `cadddr`
countvajhula Jul 11, 2024
33f2b58
Use `#%deforestable` in `list-ref`
countvajhula Jul 11, 2024
9c9ff0a
Use `#%deforestable` in `length`
countvajhula Jul 11, 2024
208aa1b
Use `#%deforestable` in `empty?` and `null?`
countvajhula Jul 11, 2024
d3535b5
Write `filter-map` as a macro expanding to `#%deforestable`
countvajhula Jul 11, 2024
a890931
Match `#%deforestable` in deforesting take instead of a host expression
countvajhula Jul 11, 2024
1130b8d
simplify `range` syntax matching for now
countvajhula Jul 11, 2024
11eef9e
mysterious fix for test errors
countvajhula Jul 11, 2024
78e57c5
lint..
countvajhula Jul 12, 2024
5314024
A few basic tests for deforested forms
countvajhula Jul 12, 2024
cecd4e1
Codegen floe positions in #%deforestable
countvajhula Aug 2, 2024
28c2408
New syntax for `#%deforestable` distinguishing `floe` positions
countvajhula Aug 2, 2024
c3e099f
Use the new `#%deforestable` syntax
countvajhula Aug 2, 2024
03cc55c
Compile higher-order `floe` positions in deforestation pass
countvajhula Aug 2, 2024
50974c1
Surface tests for `qi/list` forms
countvajhula Aug 8, 2024
e117146
Incorporate deforestation semantics tests into surface qi/list tests
countvajhula Aug 8, 2024
81184e7
remove copypasta test
countvajhula Aug 8, 2024
3360d42
Test list forms using higher-order Qi syntax
countvajhula Aug 8, 2024
f7d5e30
Remove unused module providing bindings for deforestation
countvajhula Aug 8, 2024
7f87f94
Fix syntax error in benchmarks
countvajhula Aug 8, 2024
617858a
Remove Racket `range` import in benchmarks
countvajhula Aug 8, 2024
81c9f5d
test the expansion of `#%deforestable`
countvajhula Aug 9, 2024
b6d3a7f
Test syntax error using `range` with no arguments
countvajhula Aug 9, 2024
1140870
Tests for `list-ref`
countvajhula Aug 9, 2024
f439d08
Add a test for a syntax error utility
countvajhula Aug 9, 2024
eb5e395
Modify a `range` test to use syntax with an explicit bound argument
countvajhula Aug 9, 2024
48cdb8e
Update deforestation rules tests
countvajhula Aug 9, 2024
ecb5856
Add a commented-out failing test for a case of desired deforestation
countvajhula Aug 11, 2024
14c41d9
refile the failing test (it now passes)
countvajhula Aug 11, 2024
9d72acd
Use `define-dsl-syntax` instead of `define-qi-syntax`
countvajhula Nov 16, 2024
0ee3d18
Integrate POC extension of deforestation to implement `map`
countvajhula Nov 22, 2024
e84d87f
Add a `name` argument to `define-deforestable`
countvajhula Nov 22, 2024
39d0aba
`make` target to run just `qi/list` tests
countvajhula Nov 22, 2024
4d29ede
translate `filter` to use `define-deforestable`
countvajhula Nov 22, 2024
ce964f0
translate `filter-map` to use `define-deforestable`
countvajhula Nov 22, 2024
0db81b0
translate `foldl` and `foldr`
countvajhula Nov 22, 2024
1a5e4d1
translate `take` to use `define-deforestable`
countvajhula Nov 22, 2024
ae06392
format like ordinary definitions
countvajhula Nov 23, 2024
2e376f9
fix ignored variable name
countvajhula Nov 23, 2024
45f29ec
adopt style suggestion from Ben / resyntax (cr)
countvajhula Nov 23, 2024
19d5068
translate `car`, `cad*r` etc., and `list-ref`
countvajhula Nov 23, 2024
a5f2652
declare `deforestable2` as a datum literal
countvajhula Nov 23, 2024
8a5d650
translate `length` to use `define-deforestable`
countvajhula Nov 23, 2024
f6cecbb
translate `empty?` and (its alias) `null?` to `define-deforestable`
countvajhula Nov 23, 2024
c047a01
Use the "clever hack" to translate `range`
countvajhula Nov 23, 2024
0df7823
Be cleverer in hiding the "clever hack"
countvajhula Nov 23, 2024
3f8a7c4
adopt `syntax-parse` idiom for errors (cr)
countvajhula Nov 23, 2024
c9db34c
Fully replace `#%deforestable` with the new implementation
countvajhula Nov 23, 2024
607bd65
Improve handling of identifier forms of deforestable syntax
countvajhula Nov 29, 2024
85ef9e7
declare `#%deforestable` as a literal in `fs-literals` (cr)
countvajhula Nov 30, 2024
61f6561
Improve error message when a form is used as an identifier
countvajhula Nov 30, 2024
4d6ed0d
Merge pull request #185 from countvajhula/defining-deforestable-opera…
countvajhula Dec 6, 2024
186841d
Support `lambda` (and `λ`) as a core form
countvajhula Jun 29, 2024
0c504f2
Remove unused utility
countvajhula Jun 29, 2024
72f8031
doc: the new `lambda` form
countvajhula Aug 9, 2024
4a45a19
Merge pull request #177 from countvajhula/lambda-core-form
countvajhula Dec 7, 2024
ccb54b4
formally document the syntax
countvajhula Dec 17, 2024
9e7f781
distinguish core and macro forms in full syntax
countvajhula Dec 17, 2024
d6d43aa
link `floe` to the tech definition instead of the containing section
countvajhula Dec 17, 2024
723352f
update intro in qi/list docs
countvajhula Dec 20, 2024
9dd488c
Merge pull request #186 from countvajhula/update-docs-for-deforestable
countvajhula Dec 20, 2024
7e94a65
Update list-operations scribblings.
dzoep Dec 27, 2024
00e1da6
Merge pull request #187 from dzoep/deforest-all-the-things
dzoep Dec 27, 2024
62cdc19
address code review comments re: docs
countvajhula Dec 27, 2024
8b71624
doc: distinguish `floe` from `flow`
countvajhula Dec 28, 2024
9dff1ae
cr: add `range` syntax variants that were missing
countvajhula Dec 28, 2024
efe3268
change deforestable "spec" syntax
countvajhula Dec 28, 2024
760f517
Merge pull request #188 from countvajhula/address-code-review
countvajhula Dec 28, 2024
db48273
Add Makefile target to use the "preview" profile in `vlibench`
countvajhula Dec 14, 2024
db7fe61
Improve Makefile targets for testing
countvajhula Dec 14, 2024
6797eb3
test a few cases that weren't covered
countvajhula Jan 1, 2025
04589f2
Add `#%deforestable` to the de-expander
countvajhula Jan 1, 2025
17fafe7
test for de-expanding `#%deforestable`
countvajhula Jan 2, 2025
6bf3e07
wrap benchmarks with lambda to accommodate new `range`
countvajhula Jan 3, 2025
ffc767e
Address "unused dependencies" warnings (fix #174)
countvajhula Jan 3, 2025
4b1ba3f
Use of left-threading for list operations in docs
countvajhula Jan 6, 2025
07ecec5
Add competitive benchmark for take of 1/3 the input size.
dzoep Jan 11, 2025
1753277
rename "impl" modules to "runtime", as discussed some time ago
countvajhula Jan 14, 2025
3d661fb
add back symbolic aliases that got dropped at some point
countvajhula Jan 16, 2025
f84dc92
Add COPYING file containing public domain dedication
countvajhula Jan 16, 2025
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
15 changes: 15 additions & 0 deletions qi-lib/flow/core/compiler/1000-qi0.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,21 @@
;;;; Core language forms ;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; A note regarding symbolic aliases like ~>, ⏚ and △:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RE: dropping symbolic aliases in 3d661fb (add back symbolic aliases that got dropped at some point, 2025-01-15), I think they disappeared in c609625 (extract more non-core forms as macros, 2022-08-25), which is contained in v4.0!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least, git log -S <alias> upstream/deforest-all-the-things finds that commit for both AND and OR; for NOT, I haven't managed to find the removal yet.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, guess they've been gone quite a while 😬 Actually, they might have slipped out as early as the addition of Syntax Spec (was that 3.0?), as it's quite possible we just neglected to add the aliases to the provide form in the expander at the time. Prior to that, just having the datum matching of the symbolic variants in the original flow macro was sufficient for them to be part of the "core"/flat language. While the rules of that original macro carried over to qi0->racket, the ground truth for the core language switched to being the syntax spec in the expander, and it just might have slipped through the cracks then.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That explains why the "pair with MB" commit came up a few times in my search. I definitely wasted too much time looking though: I probably should have tried git bisect.

;;
;; These aren't technically part of the core language
;; as they aren't directly part of the syntax
;; spec in the expander (which includes only, e.g.,
;; thread and tee and so on). Instead, they are simply
;; aliased at the module level there when provided.
;; Yet, during code generation in the present module,
;; it's more convenient to express expansions
;; using these symbolic aliases, and that's the
;; reason we retain these in the patterns below. As
;; these patterns are matched as _datum literals_,
;; it doesn't matter that they aren't actually the
;; literal core forms declared in the expander.

[((~datum gen) ex:expr ...)
#'(λ _ (values ex ...))]
;; pass-through (identity flow)
Expand Down
3 changes: 2 additions & 1 deletion qi-lib/flow/extended/expander.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
[tee -<]
[amp ><]
[sep △]
[collect ▽])))
[collect ▽]
[NOT !])))

(require syntax-spec-v2
"../space.rkt"
Expand Down
4 changes: 3 additions & 1 deletion qi-lib/flow/extended/forms.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
(rename-out [thread-right ~>>]
[crossover X]
[relay* ==*]
[effect ε])))
[effect ε]
[AND &]
[OR ∥])))

(require (for-syntax racket/base
"syntax.rkt"
Expand Down
3 changes: 3 additions & 0 deletions qi-test/tests/flow.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@
"elementary boolean gates"
(test-suite
"AND"
(check-equal? ((☯ &) 3 5 7) 7)
(check-equal? ((☯ AND) #f) #f)
(check-equal? ((☯ AND) 3) 3)
(check-equal? ((☯ AND) 3 5 7) 7)
Expand All @@ -302,6 +303,7 @@
(check-equal? ((☯ AND) #f #f #f) #f))
(test-suite
"OR"
(check-equal? ((☯ ∥) 3 5 7) 3)
(check-equal? ((☯ OR) #f) #f)
(check-equal? ((☯ OR) 3) 3)
(check-equal? ((☯ OR) 3 5 7) 3)
Expand All @@ -310,6 +312,7 @@
(check-equal? ((☯ OR) #f #f #f) #f))
(test-suite
"NOT"
(check-false ((☯ !) 3))
(check-false ((☯ NOT) 3))
(check-true ((☯ NOT) #f)))
(test-suite
Expand Down
Loading