Skip to content

Qi Compiler Sync Nov 11 2022

Siddhartha Kasivajhula edited this page Dec 15, 2022 · 4 revisions

The Artist Formerly Known as Bindingspec

Qi Compiler Sync Nov 11 2022

Adjacent meetings: Previous | Up | Next

Summary

We picked up on the implementation of bindings in the compiler, and discussed some syntax considerations in syntax-spec (i.e. the meta-DSL formerly known as bindingspec).

Background

The last time we worked on bindings, there were a few lingering issues, including "anaphoric references" in the implementation and "unbounded nesting" of the bindings transformation. We addressed some of these this time. We also considered a few different alternative syntaxes for declaring the host language interface in syntax-spec.

Bindings Issues

"Anaphoric References"

Previously, we rewrote the compilation of partial application to use lambdas instead of currying, because the latter evaluates its references immediately while the former delays evaluation until invocation time. This was necessary because the bindings are only available at runtime. But the new implementation does not automatically inherit the support for keyword arguments that curry and curryr already have.

We restored support for keyword arguments by modifying the implementation to use make-keyword-procedure and keyword-apply.

"Unbounded nesting"

Not the best name -- better might be "indiscriminate application of bindings transformation" (the bindings transformation being rewriting to let+set! etc. -- covered in previous meeting notes). We didn't get to this one this time, but Michael mentioned he had an idea to make it easier to tackle next time, where the expanded code would include a tag like ($%host-language-expression ...) that we could use to delimit the bindings transformation.

Syntax-spec syntax

Currently, specifying the host interface (i.e. interface macro like flow) is done separately from specifying the nonterminal grammar of the DSL (i.e. a flow expression, what we're calling floe (and pronouncing "flow-e"/"flowy") in the code). Michael brought up some alternatives here, some of which seem cleaner and which allow all the DSL specification to be done using a single syntax-spec macro. Coming soon to a meta-DSL near you!

Next Steps

  • Address the unbounded nesting problem
  • Migrate to the new syntax-spec syntax whenever that's ready

Attendees

Michael, Sid

Clone this wiki locally