# US 2020/0394027 A1 · Quantum compiler

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2020/0394027 A1
- Document ID: US20200394027A1
- Status: Published application
- Kind: A1
- Application number: 16/437,212
- Filed: 2019-06-11
- Published: 2020-12-17
- Earliest claimed: 2019-06-11
- Assignees: IonQ, Inc.
- Applicants: IonQ, Inc.
- Inventors: Andrew Maps Ducore; Omar Shehab; Matthew Joseph Keesan
- Web page: https://patentgrep.com/patent/US20200394027A1

## CPC

- G06F 8/427: {Parsing}
- G06F 8/437: {Type checking}
- G06N 10/20: Models of quantum computing, e.g. quantum circuits or universal quantum computers
- G06N 10/80: Quantum programming, e.g. interfaces, languages or software-development kits for creating or handling programs capable of running on quantum computers; Platforms for simulating or accessing quantum computers, e.g. cloud-based quantum computing
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- G06N: COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS

## Abstract

Technologies are described herein to compile a Turing-complete quantum programming language program into a quantum circuit. The techniques described and recited herein include compiling TCQPL source code to generate a quantum circuit by generating a function object ensemble, generating an abstract syntax tree from received source code, and annotating nodes corresponding to the abstract syntax tree with corresponding function objects.

## Claims

### Claim 1

A non-transitory computer-readable medium storing executable instructions that, upon execution, cause a digital computing processor to compile source code to generate a quantum circuit by performing functions comprising:
generating a function object ensemble;
generating an abstract syntax tree from received source code, the source code being written in a Turing complete quantum programming language; and
annotating nodes corresponding to the abstract syntax tree with each respective function object from the function object ensemble.

### Claim 2 (depends on 1)

The computer-readable medium of claim 1, wherein the generating of the function object ensemble is executed before the source code is received.

### Claim 3 (depends on 1)

The computer-readable medium of claim 1, wherein function objects included in the function object ensemble are functions written in a same language as the executable instructions.

### Claim 4 (depends on 1)

The computer-readable medium of claim 1, wherein the generating includes loading function objects into memory.

### Claim 5 (depends on 4)

The computer-readable medium of claim 4, wherein the annotating includes annotating respective nodes corresponding to the abstract syntax tree with corresponding function objects loaded into memory.

### Claim 6 (depends on 5)

The computer-readable medium of claim 5, wherein a root node of the abstract syntax tree is executable to recursively execute child nodes thereof.

### Claim 7 (depends on 5)

The computer-readable medium of claim 5, wherein a sequence of an execution of the annotated nodes is variable.

### Claim 8

A digital processor, comprising:
a compiler to:
load into memory function objects corresponding, respectively, to all potential nodes of a parse tree,
receive source code, the source code being written in a Turing complete quantum programming language,
generate a parse tree from the received source code, and
annotate nodes of the generated parse tree with corresponding function objects loaded into the memory; and
a runtime to execute the annotated nodes of the parse tree.

### Claim 9 (depends on 8)

The digital processor of claim 8, wherein the compiler is to generate respective nodes of the parse tree based on each statement included in the received source code.

### Claim 10 (depends on 8)

The digital processor of claim 8, wherein the compiler is to annotate nodes of the generated parse tree by:
performing a type-check each node of the generated parse tree, and
binding respective function objects loaded into the memory to a corresponding node of the parse tree, in accordance with results of the type-check.

### Claim 11

A compiling method, comprising:
loading function objects into memory;
receiving source code, the source code being written in a Turing complete quantum programming language;
loading compiler plugins;
generating a parse tree based on each statement included in the received source code;
resolving each statement included in the received source code;
hoisting the source code; and
annotating the generated parse tree by binding respective function objects loaded into the memory to a corresponding node of the parse tree, in accordance with results of a type-check.

### Claim 12 (depends on 11)

The method of claim 11, wherein the source code is received as a text string.

### Claim 13 (depends on 11)

The method of claim 11, wherein the resolving of imported statements is a recursive operation.

### Claim 14 (depends on 13)

The method of claim 13, wherein the resolving of imported statements includes compiling nested programs.

### Claim 15 (depends on 11)

The method of claim 11, wherein the hoisting includes:
resolving function declarations, and
resolving compile time constraints.

### Claim 16 (depends on 11)

The method of claim 11, wherein the annotating includes:
performing a type-check each node of the generated parse tree, and
binding respective function objects loaded into the memory to a corresponding node of the parse tree, in accordance with results of the type-check.

### Claim 17 (depends on 16)

The method of claim 16, wherein the function objects corresponding to the nodes of the parse tree are independently executed.

### Claim 18 (depends on 16)

The method of claim 16, wherein the function objects corresponding to the nodes of the parse tree are executable in variable order.
