Skip to content

Commit

Permalink
Adds a coalton AST for Quil
Browse files Browse the repository at this point in the history
  • Loading branch information
macrologist committed Sep 24, 2024
1 parent 2a9fdf7 commit 28e9b82
Show file tree
Hide file tree
Showing 2 changed files with 683 additions and 0 deletions.
44 changes: 44 additions & 0 deletions src/coalton/ast/raw.lisp
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
(defpackage #:quil/ast/raw
(:use #:coalton)
(:documentation "Native Cl-QUIL and CL-QUIL.FRONTEND Types")
(:export
#:Program
#:Instruction
#:QubitArg
#:Param
#:MRef
#:RefArg
#:QuilType))

(in-package #:quil/ast/raw)

(named-readtables:in-readtable coalton:coalton)

(coalton-toplevel

(repr :native cl-quil:quil-type)
(define-type QuilType)

(repr :native cl-quil:parsed-program)
(define-type Program)

(repr :native (cl:or cl-quil:qubit cl-quil:formal))
(define-type QubitArg)

(repr :native (cl:or cl-quil:formal cl-quil:memory-ref))
(define-type RefArg)

(repr :native cl-quil:memory-ref)
(define-type MRef)

(repr :native (cl:or cl-quil:param
cl-quil.frontend:delayed-expression
cl-quil:constant cl:null))
(define-type Param)

(repr :native (cl:or cl-quil:instruction
cl-quil:memory-descriptor
cl-quil:jump-target
cl-quil:gate-definition
cl-quil:circuit-definition))
(define-type Instruction))
Loading

0 comments on commit 28e9b82

Please sign in to comment.