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

Adds a coalton AST for Quil #925

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Next Next commit
Adds a coalton AST for Quil
  • Loading branch information
macrologist committed Sep 24, 2024
commit 28e9b82a1293597ebac2fb892f3e3b00f1968f47
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
Loading