quil-lang / quilc

The optimizing Quil compiler.
Apache License 2.0
454 stars 73 forks source link

Defgate as sequence with alternative definitions #793

Open Spin1Half opened 2 years ago

Spin1Half commented 2 years ago

https://github.com/quil-lang/quilc/pull/785 adds the defgate as sequence feature to the quil language.

One drawback of the existing implementation is that quilc is constricted in how it utilizes sequence gate definitions. There is a strict injective mapping for how a sequence gate is implemented. For this reason, any circular references within the family of sequence defgates for any parsed quil program must result in an error.

We might like to consider allowing for alternative definitions. Giving the compiler room for optimizations if any such alternatives in a parsed program allow for it.