qasm-ts - v2.0.0
    Preparing search index...

    Module qasm3/ast

    OpenQASM 3.0 Abstract Syntax Tree Node Definitions

    This module defines all the AST node classes that represent the parsed structure of OpenQASM 3.0 programs. Each class corresponds to a specific language construct and contains the necessary information to represent that construct in memory.

    The AST provides a hierarchical representation where:

    • AstNode: Base class for all nodes
    • Statement: Executable instructions (declarations, assignments, control flow)
    • Expression: Value-producing constructs (literals, identifiers, operations)
    • ClassicalType: Type system for classical data

    Key node categories:

    • Declarations: Variable, type, and quantum register declarations
    • Quantum Operations: Gate calls, measurements, barriers, delays
    • Control Flow: If/else, loops, switch statements
    • Expressions: Arithmetic, logical, and function call expressions
    • Types: Classical type specifications (int, float, bool, etc.)
    import { QuantumDeclaration, Identifier, IntegerLiteral } from './ast';

    // Represents: qubit[2] q;
    const qubitDecl = new QuantumDeclaration(
    new Identifier('q'),
    new IntegerLiteral(2)
    );
    import { Arithmetic, ArithmeticOp, Identifier, FloatLiteral } from './ast';

    // Represents: theta * 2.0
    const expr = new Arithmetic(
    ArithmeticOp.TIMES,
    new Identifier('theta'),
    new FloatLiteral(2.0)
    );

    Classes

    AliasStatement
    AngleType
    Arithmetic
    ArrayAccess
    ArrayDeclaration
    ArrayInitializer
    ArrayReference
    AssignmentStatement
    AstNode
    Binary
    BitstringLiteral
    BitType
    BooleanLiteral
    BoolType
    BoxDefinition
    BranchingStatement
    BreakStatement
    CalibrationGrammarDeclaration
    CaseStatement
    Cast
    ClassicalDeclaration
    ClassicalType
    ComplexType
    ContinueStatement
    DefaultStatement
    DurationLiteral
    DurationOf
    DurationType
    Euler
    Expression
    ExternSignature
    FloatLiteral
    FloatType
    ForLoopStatement
    HardwareQubit
    Identifier
    ImaginaryLiteral
    Include
    IndexSet
    IntegerLiteral
    IntType
    IODeclaration
    MathFunction
    NumericLiteral
    Parameters
    Pi
    ProgramBlock
    QuantumBarrier
    QuantumBlock
    QuantumDeclaration
    QuantumDelay
    QuantumGateCall
    QuantumGateDefinition
    QuantumGateModifier
    QuantumMeasurement
    QuantumMeasurementAssignment
    QuantumReset
    Range
    ReturnStatement
    SizeOf
    Statement
    StretchType
    SubroutineBlock
    SubroutineCall
    SubroutineDefinition
    SubscriptedIdentifier
    SwitchStatement
    Tau
    TrigFunction
    UIntType
    Unary
    Version
    WhileLoopStatement

    Enumerations

    ArithmeticOp
    ArrayReferenceModifier
    BinaryOp
    DurationUnit
    IOModifier
    MathFunctionTypes
    QuantumGateModifierName
    TrigFunctionTypes
    UnaryOp