openqasm/source/language/comments.rst

53 lines
1.4 KiB
ReStructuredText
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Comments
========
Comments begin with a pair of forward slashes ``//`` and end with a new line:
.. code-block::
// A comment line
A comment block begins with ``/*`` and ends with ``*/``:
.. code-block::
/*
A comment block
*/
.. _version-string:
Version string
==============
The first non-comment line of an OpenQASM program may optionally be
``OPENQASM`` *M.m* ``;`` indicating a major version *M* and minor version *m*.
More details on versioning and the release cycle for OpenQASM may be found
`here <https://github.com/openqasm/openqasm/blob/main/CONTRIBUTING.md>`_.
The minor version number, expressed as a decimal point after the major version
number followed by a number, is optional. If not present, the minor version
number is assumed to be zero.
Multiple occurrences of the version string (outside of comments) are not
permitted, nor may it appear elsewhere than the first non-comment line.
Included files
==============
The statement ``include "filename";`` continues parsing ``filename`` as if the
contents of the file were inserted at the location of the ``include`` statement.
This statement can only be used at the global scope.
.. code-block::
// First non-comment is a version string
OPENQASM 3.0;
include "stdgates.inc";
// Rest of QASM program
The file ``stdgates.inc`` itself is :ref:`the standard library of OpenQASM 3 <standard-library>`.