| Filename | Latest commit message | Latest commit date |
|---|---|---|
Generated on the final tree: the views page, rebuilt (802 495 bytes, under 1 MiB) from its sources; the notebooks' stored outputs; the agent docs. The pins that move: wai-web's course check names its engine now, so its digest moves (374b400e... to 969b2c1c..., and with every release from here), and the page's wasm32 count is 18 (native 26, as pinned). wai-quantum-qpu's library count is 34, as the cherry-picked pin says. What replaying each workflow's jobs found, each fixed here: - the views page's one line carried the estimate pane's English note, "no other beats on both", which the comparative-prose check reads across the line; the note says "none of the others beats on both"; - the docs runner's broken.qasm is broken on purpose, so the editors check requires it to fail to parse, as the intent set's broken programs; - the command line's parse test named the service's submit and task in a build without the service; those checks are a test of their own, built with it; - the set-only Merkle helpers warned in a build without receipts; - a one-element loop in the service's strict test; - the energy job looked for the live counter's line at the start of a line, where --nocapture puts it after the test's name; - the Python test comparing a run on the service with one here now leaves out the provenance the service adds, and checks it is there. The release heading's caller list is the final API check's: the frame text's new fields and variant, and the request's compile passes and mitigation. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
| .. | ||
| queries | ||
| script | ||
| src | ||
| test | ||
| .gitignore | ||
| grammar.js | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
| tree-sitter.json | ||
tree-sitter-openqasm
OpenQASM 3, and the OpenQASM 2 forms in common use, as a tree-sitter grammar:
for highlighting, folding and structural selection in any editor that reads
tree-sitter grammars. The language service (wai-quantum lsp) gives the
engine's diagnostics, completion, hover and renames; this grammar gives the
editor the program's structure as it is typed.
| Path | What it is |
|---|---|
grammar.js |
The grammar: every statement of OpenQASM 3.1 (declarations of every type, gates, subroutines, modifiers, control flow, timing, calibrations kept as text, pragmas, annotations) and OpenQASM 2's qreg, creg, opaque, measure q -> c and if(c==1) |
src/ |
The parser generated from it (ABI 14), committed so that an editor builds it with a C compiler alone |
queries/highlights.scm |
Highlighting, in the common capture names (@keyword, @type, @function, @number, …) |
queries/locals.scm |
Scopes, definitions and references |
queries/folds.scm |
Foldable blocks |
test/corpus/ |
The parse of every construct, checked tree for tree |
test/highlight/ |
Highlighting checked capture by capture |
script/check-programs.mjs |
Parses every program in the repository's conformance material and examples, and fails on any error |
The grammar reads what is written. It does not say what a program means: the engine's reader decides that, and the language server reports it.
Building and testing
With Node.js 22 and a C compiler:
npm ci # the pinned tree-sitter command line
npx tree-sitter generate --abi 14 # src/ from grammar.js
npx tree-sitter test # the corpus and the highlighting
node script/check-programs.mjs # every program in the repository
src/ must be regenerated and committed with any change to grammar.js; CI
regenerates it and fails if the committed parser differs.
Versions
The names of the grammar's nodes and fields are what queries name, so they are its public surface: one is renamed or removed only in a major release, as WAI Quantum's policy says, and listed in the deprecations at least one minor release before.
Using it in an editor
The editor configurations in ../wai-quantum-editor/editors/
point at this directory, and the editors guide
says how to install each.