0.9.0 • Published 5 years ago

@qiskit/qasm v0.9.0

Weekly downloads
2
License
Apache-2.0
Repository
github
Last release
5 years ago

Qiskit.js OpenQASM

:atom_symbol: Quantum Information Science Kit OpenQASM library.

Please visit the main repository of the project to know about the rest of the tools.

Install

:coffee: Install lastest Node.js stable version (or LTS) and then:

npm i @qiskit/qasm

Use

:pencil: You can visit the complete example in this test.

const qasm = require('@qiskit/qasm');
const fs = require('fs');
const util = require('util');

console.log('Version');
console.log(qasm.version);

const parser = new qasm.Parser();

const circuit = fs.readFileSync('./example.qasm', 'utf8');

console.log(util.inspect(parser.parse(circuit), { depth: null }));

API

:eyes: Full specification.

version

The actual version of the library.

  • version (string) - Version number.

Parser(opts) -> parser

The constructor accepts next option:

  • core (boolean) - To include core libraries. (default: true)

parser.parse(circuit) -> circuitJson

NOTE: Method still partially implemented Get the intermediate representation of the circuit using the OpenQASM parser.

  • circuit (string) - QASM circuit representation.
  • circuitJson (object): The same information in JSON format.

QasmError(msg, opts) -> error

Custom QASM error class.

  • msg (string) - Error message.
  • opts (object) - Optional parameter, including next fields:
    • line (number) - Line number where the error happened.
    • column (number) - Column number where the error happened.
    • text (string) - Text extracted from where the error happened.
    • token (string) - Identifier found where the error happened.
    • expected (string) - Regular expresion for supported values.
  • error (Error) - A common JS error including also next fields:
    • name (string) - Error name ("QasmError").
    • message (string) - Error message.
    • stack (string) - Error stack.
    • From here the same fields that for opts are included.
0.9.0

5 years ago

0.8.0

5 years ago

0.7.0

5 years ago

0.6.3

5 years ago

0.6.2

5 years ago

0.6.1

5 years ago

0.6.0

5 years ago

0.5.0

6 years ago

0.4.0

6 years ago

0.3.0

6 years ago

0.2.0

6 years ago

0.1.9

6 years ago

0.1.7

6 years ago

0.1.6

6 years ago

0.1.5

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago