NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Quantum Programming Language NDQJava-2

Ling Liu, Jiafu XuJournal of Software 2011

Abstract

This paper presents an overview of the quantum programming language NDQJava-2, an extension of the original NDQJava. By incorporating high-level components such as quantum conditional statements, loop statements, subprograms, modules, and an exception handling mechanism, NDQJava-2 transitions quantum programming into a structured paradigm. Comparative analysis suggests that NDQJava-2 offers a more practical, readable, and suitable environment for developing complex quantum algorithms than its predecessor.

Introduction

The evolution of quantum computing necessitates a parallel evolution in how we write quantum software. While early quantum algorithms like Shor’s and Grover’s demonstrated theoretical speedups, their implementation was often hindered by low-level, "unstructured" programming environments. NDQJava-2, introduced in the Journal of Software (2011), addresses these challenges by applying classical software engineering principles to the quantum domain.

Moving Beyond Gate-Level Programming

Early quantum programming often resembled assembly language, where developers manually managed individual qubits and gates. While functional for simple circuits, this approach becomes unmanageable for complex routines. NDQJava-2 aims to provide a "Java-like" experience, bridging the gap between abstract algorithmic logic and executable code.

Key Technical Enhancements

NDQJava-2 introduces several high-level constructs designed to manage the unique constraints of quantum mechanics:

  • Structured Control Flow: The language introduces native quantum if, while, until, and for statements. These allow for logic that branches or iterates based on quantum states.
  • The "Energy-Qubit" Concept: To handle quantum conditionals without causing premature decoherence or collapse, NDQJava-2 utilizes "energy-qubits" (使能量子). These ancilla qubits track state conditions, allowing the system to trigger operations while maintaining quantum superposition.
  • Modularity via qumodule: Borrowing from modern encapsulation techniques, the qumodule allows programmers to define private variables and clear import/export interfaces. This prevents the "spaghetti code" often found in flat gate sequences.
  • Subprograms and Exception Handling: The language distinguishes between qufunction (returning values) and quprocedure (performing operations). Furthermore, a dedicated exception handling mechanism (edef, raise) allows developers to manage quantum-specific errors, such as illegal state assignments.

Case Study: Grover’s Algorithm

The expressiveness of NDQJava-2 is best demonstrated through its implementation of Grover’s search algorithm. In traditional gate-based languages, Grover's iterative process requires repetitive manual gate application. In NDQJava-2, the entire process is encapsulated within a concise while loop inside a qumodule. This modular approach significantly improves the readability and maintainability of the code.

Conclusion and Future Outlook

NDQJava-2 represents a significant step toward making quantum programming accessible to classical software engineers. By providing a structured framework, it lowers the barrier to entry and improves the reliability of quantum software development. While the authors noted that practical hardware was still decades away at the time of publication, the linguistic foundations laid by NDQJava-2 remain relevant as the industry moves toward fault-tolerant quantum computing.

Summary updated

BibTeX
@article{liu2011quantum,
  author = {Ling Liu and Jiafu Xu},
  title = {{Quantum Programming Language NDQJava-2}},
  journal = {Journal of Software},
  year = {2011},
  doi = {10.3724/sp.j.1001.2011.03979},
}
Figure