ket is a small quantum programming language, simulator, and cli written in typescript. it can interpret .ket programs locally, compile them to openqasm 2.0, submit qasm jobs to ibm quantum, and open a hosted browser playground for interactive work.
ket is an experimental but usable quantum toolchain. the repository is prepared for public collaboration, and the docs in docs/README.md are the authoritative public reference for the current implementation.
- utf-8 lexer and recursive-descent parser for
.ketsource files - type checker for qubits, classical bits, user-defined gates, and circuits
- local statevector simulator with built-in grover diffusion, phase oracle, and qft support
- openqasm 2.0 emitter
- cli commands for
run,compile,viz, andauth - vite/react playground for editing, circuit visualisation, and result inspection
pnpm install
pnpm build
node dist/ket.js run examples/bell-state.ket --shots 32circuit bell_state() {
qubit q[2]
H q[0]
CNOT q[0], q[1]
let r = measure q
}
run bell_state()
compile a program to openqasm:
node dist/ket.js compile examples/qft.ketopen the playground with a program loaded:
node dist/ket.js viz examples/teleportation.ketstore your ibm quantum token and optional defaults:
node dist/ket.js auth --ibm <token> --instance ibm-q/open/main --backend ibm_brisbaneyou can also provide the same values through your shell environment or a local .env file:
cp .env.example .envket run resolves the execution backend in this order:
--backend <local|ibm>run ... on ibmin the source program- local execution by default
values from the shell or .env override ~/.ket/config. when you use ket auth, the config file is created with owner-only permissions on non-windows systems.
pnpm install
pnpm dev
pnpm lint
pnpm typecheck
pnpm test
pnpm build
pnpm build:playgroundpnpm dev starts the workspace development flow:
- the vite playground dev server from
playground - the cli bundle watcher that rebuilds
dist/ket.js
for direct cli execution in typescript, use:
pnpm dev:cli -- run examples/bell-state.ket --shots 32srccontains the lexer, parser, type checker, simulator, code generator, backends, and cliplaygroundcontains the browser playgroundexamplescontains runnable sample programstestscontains the automated test suite
docs/README.mdis the documentation indexdocs/getting-started/installation.mdcovers setup and first runsdocs/language/overview.mdexplains the language surfacedocs/usage/cli.mddocuments the cli and playground entry pointsdocs/codebase/architecture.mdexplains the codebase layout and execution pipelinedocs/project/open-source.mdcovers open-source and commit hygieneCONTRIBUTING.mdexplains the contribution workflowSECURITY.mdexplains how to report vulnerabilities
ket is maintained by Abedalaziz Alzweidi.
this project is released under the apache-2.0 licence. see LICENSE and NOTICE.