Skip to content

Qi Compiler Sync Nov 29 2022

Siddhartha Kasivajhula edited this page Nov 29, 2022 · 6 revisions

Summary

We declared some scoping rules for bindings in the expander.

Background

Last time, we discussed possible scoping rules for the language. We decided to start with conservative scoping rules that signal an error if we cannot guarantee at compile-time that bindings will be defined at the site where they're used.

Declaring Scoping Rules

We declared the rules in Qi's syntaxspec (the artist formerly known as bindingspec) grammar. To do this, we defined a binding-floe nonterminal to define the scoping rules for bindings. Currently, the only Qi form that needs to declare scoping rules is ~> -- the rule being that bindings in earlier flows in the sequence bind identifiers in later flows in the sequence. All of the other forms besides ~> were placed in a new simple-floe nonterminal, which doesn't declare any special scoping rules. The original floe nonterminal could be either of these (though for implementation reasons it is the former which has the latter as a fallback case).

This commit shows the changes that we made today, and contains some explanatory comments.

Next Steps

  • Michael will be adding a new (host ...) form to syntaxspec to declare subexpressions in the DSL that are host language expressions. This will allow us to leverage this information in the compiler to solve the "unbounded nesting" problem (mentioned in previous meeting notes).
  • Implement support in the compiler for binding multiple values using the as form.

Attendees

Michael, Sid

Clone this wiki locally