Compiling a Q# Subset to QASM 3.0 in TypeScript via a JSON Based IR

📅 2025-06-29
📈 Citations: 0
Influential: 0
📄 PDF

career value

132K/year
🤖 AI Summary
This work addresses the challenge of executing Q# quantum programs directly in web environments. Methodologically, we design and implement the first TypeScript-based compiler toolchain that translates Q# to QASM 3.0, featuring a complete lexer and an LL(1) parser supporting a core subset of Q# syntax, along with a lightweight, structured JSON intermediate representation (IR) that preserves semantics across platforms and enables portable code generation. Our key contributions are: (1) the first browser-native Q# compilation capability, substantially improving accessibility for quantum programming; and (2) a modular JSON IR design that enhances extensibility and interoperability across heterogeneous platforms. Experimental evaluation demonstrates correct compilation and semantic fidelity for representative Q# programs, with performance comparable to mainstream Q# compilers.

Technology Category

Application Category

📝 Abstract
We implement a compile toolchain from Q# to QASM 3.0 including a full-featured lexer and parser implementation, as well as a compiler that supports a subset of Q# features. The lexer, parser and compiler are shown to work with various input Q# programs and the implementation is compared against existing Q# compile tools. Unlike the Microsoft implementation of the official Q# compile toolchain, our implementation is written in TypeScript in order to port functionality to web environments.
Problem

Research questions and friction points this paper is trying to address.

Compile Q# subset to QASM 3.0
Implement lexer, parser, compiler in TypeScript
Port Q# functionality to web environments
Innovation

Methods, ideas, or system contributions that make the work stand out.

Q# to QASM 3.0 compile toolchain
Lexer and parser in TypeScript
JSON-based IR for web compatibility
🔎 Similar Papers