qasm-ts 2.1.2 → 2.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/qasm3/ast.js CHANGED
@@ -1,30 +1,7 @@
1
- "use strict";
2
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
3
- var __extends = (this && this.__extends) || (function () {
4
- var extendStatics = function (d, b) {
5
- extendStatics = Object.setPrototypeOf ||
6
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
7
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
8
- return extendStatics(d, b);
9
- };
10
- return function (d, b) {
11
- if (typeof b !== "function" && b !== null)
12
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
13
- extendStatics(d, b);
14
- function __() { this.constructor = d; }
15
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
16
- };
17
- })();
18
- Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.QuantumMeasurement = exports.ArrayAccess = exports.ArrayInitializer = exports.ArrayDeclaration = exports.IndexSet = exports.Cast = exports.Binary = exports.BinaryOp = exports.Arithmetic = exports.ArithmeticOp = exports.Unary = exports.UnaryOp = exports.SizeOf = exports.DurationOf = exports.DurationLiteral = exports.DurationUnit = exports.BitstringLiteral = exports.BooleanLiteral = exports.ImaginaryLiteral = exports.FloatLiteral = exports.NumericLiteral = exports.IntegerLiteral = exports.TrigFunction = exports.TrigFunctionTypes = exports.MathFunction = exports.MathFunctionTypes = exports.Tau = exports.Euler = exports.Pi = exports.SubscriptedIdentifier = exports.Identifier = exports.Range = exports.DurationType = exports.StretchType = exports.AngleType = exports.BitType = exports.UIntType = exports.IntType = exports.BoolType = exports.ComplexType = exports.FloatType = exports.Version = exports.Include = exports.CalibrationGrammarDeclaration = exports.ArrayReference = exports.ArrayReferenceModifier = exports.Parameters = exports.Expression = exports.Statement = exports.AstNode = void 0;
20
- exports.ClassicalType = exports.DefaultStatement = exports.CaseStatement = exports.SwitchStatement = exports.IODeclaration = exports.IOModifier = exports.ContinueStatement = exports.BreakStatement = exports.WhileLoopStatement = exports.ForLoopStatement = exports.BranchingStatement = exports.SubroutineCall = exports.SubroutineDefinition = exports.ExternSignature = exports.BoxDefinition = exports.QuantumGateDefinition = exports.SubroutineBlock = exports.QuantumBlock = exports.ProgramBlock = exports.ReturnStatement = exports.QuantumDelay = exports.QuantumReset = exports.QuantumBarrier = exports.QuantumGateCall = exports.QuantumGateModifier = exports.QuantumGateModifierName = exports.AliasStatement = exports.HardwareQubit = exports.QuantumDeclaration = exports.AssignmentStatement = exports.ClassicalDeclaration = exports.QuantumMeasurementAssignment = void 0;
21
2
  /** Base class representing a basic AST node. */
22
- var AstNode = /** @class */ (function () {
23
- function AstNode() {
24
- }
25
- return AstNode;
26
- }());
27
- exports.AstNode = AstNode;
3
+ class AstNode {
4
+ }
28
5
  /**
29
6
  * Base class representing an instruction which performs an action.
30
7
  *
@@ -38,62 +15,44 @@ exports.AstNode = AstNode;
38
15
  * | aliasStatement
39
16
  * | quantumStatement
40
17
  */
41
- var Statement = /** @class */ (function (_super) {
42
- __extends(Statement, _super);
43
- function Statement() {
44
- return _super !== null && _super.apply(this, arguments) || this;
45
- }
46
- return Statement;
47
- }(AstNode));
48
- exports.Statement = Statement;
18
+ class Statement extends AstNode {
19
+ }
49
20
  /**
50
21
  * Class representing a custom grammar for specifying calibrations.
51
22
  *
52
23
  * calibrationGrammarStatement:
53
24
  * | DEFCALGRAMMAR StringLiteral SEMICOLON
54
25
  */
55
- var CalibrationGrammarDeclaration = /** @class */ (function (_super) {
56
- __extends(CalibrationGrammarDeclaration, _super);
57
- function CalibrationGrammarDeclaration(name) {
58
- var _this = _super.call(this) || this;
59
- _this.name = name;
60
- return _this;
26
+ class CalibrationGrammarDeclaration extends Statement {
27
+ constructor(name) {
28
+ super();
29
+ this.name = name;
61
30
  }
62
- return CalibrationGrammarDeclaration;
63
- }(Statement));
64
- exports.CalibrationGrammarDeclaration = CalibrationGrammarDeclaration;
31
+ }
65
32
  /**
66
33
  * Class representing an include statement.
67
34
  *
68
35
  * includeStatement:
69
36
  * INCLUDE StringLiteral SEMICOLON
70
37
  */
71
- var Include = /** @class */ (function (_super) {
72
- __extends(Include, _super);
73
- function Include(filename) {
74
- var _this = _super.call(this) || this;
75
- _this.filename = filename;
76
- return _this;
38
+ class Include extends AstNode {
39
+ constructor(filename) {
40
+ super();
41
+ this.filename = filename;
77
42
  }
78
- return Include;
79
- }(AstNode));
80
- exports.Include = Include;
43
+ }
81
44
  /**
82
45
  * Class representing the version statement.
83
46
  *
84
47
  * version
85
48
  * : 'OPENQASM'(Integer | RealNumber) SEMICOLON
86
49
  */
87
- var Version = /** @class */ (function (_super) {
88
- __extends(Version, _super);
89
- function Version(version) {
90
- var _this = _super.call(this) || this;
91
- _this.version = version;
92
- return _this;
50
+ class Version extends AstNode {
51
+ constructor(version) {
52
+ super();
53
+ this.version = version;
93
54
  }
94
- return Version;
95
- }(AstNode));
96
- exports.Version = Version;
55
+ }
97
56
  /**
98
57
  * Base class representing a quantum instruction.
99
58
  *
@@ -104,207 +63,114 @@ exports.Version = Version;
104
63
  * | quantumReset
105
64
  * | quantumBarrier
106
65
  */
107
- var QuantumInstruction = /** @class */ (function (_super) {
108
- __extends(QuantumInstruction, _super);
109
- function QuantumInstruction() {
110
- return _super !== null && _super.apply(this, arguments) || this;
111
- }
112
- return QuantumInstruction;
113
- }(AstNode));
66
+ class QuantumInstruction extends AstNode {
67
+ }
114
68
  /** Base class representing a classical computing type. */
115
- var ClassicalType = /** @class */ (function (_super) {
116
- __extends(ClassicalType, _super);
117
- function ClassicalType() {
118
- return _super !== null && _super.apply(this, arguments) || this;
119
- }
120
- return ClassicalType;
121
- }(AstNode));
122
- exports.ClassicalType = ClassicalType;
69
+ class ClassicalType extends AstNode {
70
+ }
123
71
  /**
124
72
  * Class representing a classical float type.
125
73
  *
126
74
  * scalarType:
127
75
  * FLOAT designator?
128
76
  */
129
- var FloatType = /** @class */ (function (_super) {
130
- __extends(FloatType, _super);
131
- function FloatType(width) {
132
- var _this = _super.call(this) || this;
133
- _this.width = width ? width : null;
134
- return _this;
77
+ class FloatType extends ClassicalType {
78
+ constructor(width) {
79
+ super();
80
+ this.width = width ? width : null;
135
81
  }
136
- return FloatType;
137
- }(ClassicalType));
138
- exports.FloatType = FloatType;
82
+ }
139
83
  /**
140
84
  * Class representing a complex number type.
141
85
  *
142
86
  * scalarType:
143
87
  * COMPLEX (LBRACKET scalarType RBRACKET)?
144
88
  */
145
- var ComplexType = /** @class */ (function (_super) {
146
- __extends(ComplexType, _super);
147
- function ComplexType(float) {
148
- var _this = _super.call(this) || this;
149
- _this.float = float;
150
- return _this;
89
+ class ComplexType extends ClassicalType {
90
+ constructor(float) {
91
+ super();
92
+ this.float = float;
151
93
  }
152
- return ComplexType;
153
- }(ClassicalType));
154
- exports.ComplexType = ComplexType;
94
+ }
155
95
  /** Class representing a classical boolean type. */
156
- var BoolType = /** @class */ (function (_super) {
157
- __extends(BoolType, _super);
158
- function BoolType() {
159
- return _super !== null && _super.apply(this, arguments) || this;
160
- }
161
- return BoolType;
162
- }(ClassicalType));
163
- exports.BoolType = BoolType;
96
+ class BoolType extends ClassicalType {
97
+ }
164
98
  /** Class representing a classical signed integer type. */
165
- var IntType = /** @class */ (function (_super) {
166
- __extends(IntType, _super);
167
- function IntType(size) {
168
- var _this = _super.call(this) || this;
169
- _this.size = size ? size : null;
170
- return _this;
99
+ class IntType extends ClassicalType {
100
+ constructor(size) {
101
+ super();
102
+ this.size = size ? size : null;
171
103
  }
172
- return IntType;
173
- }(ClassicalType));
174
- exports.IntType = IntType;
104
+ }
175
105
  /** Class representing a classical unsigned integer type. */
176
- var UIntType = /** @class */ (function (_super) {
177
- __extends(UIntType, _super);
178
- function UIntType(size) {
179
- var _this = _super.call(this) || this;
180
- _this.size = size ? size : null;
181
- return _this;
106
+ class UIntType extends ClassicalType {
107
+ constructor(size) {
108
+ super();
109
+ this.size = size ? size : null;
182
110
  }
183
- return UIntType;
184
- }(ClassicalType));
185
- exports.UIntType = UIntType;
111
+ }
186
112
  /** Class representing a classical bit type. */
187
- var BitType = /** @class */ (function (_super) {
188
- __extends(BitType, _super);
189
- function BitType(size) {
190
- var _this = _super.call(this) || this;
191
- _this.size = size ? size : null;
192
- return _this;
113
+ class BitType extends ClassicalType {
114
+ constructor(size) {
115
+ super();
116
+ this.size = size ? size : null;
193
117
  }
194
- return BitType;
195
- }(ClassicalType));
196
- exports.BitType = BitType;
118
+ }
197
119
  /** Class representing an angle type. */
198
- var AngleType = /** @class */ (function (_super) {
199
- __extends(AngleType, _super);
200
- function AngleType(size) {
201
- var _this = _super.call(this) || this;
202
- _this.size = size ? size : null;
203
- return _this;
120
+ class AngleType extends ClassicalType {
121
+ constructor(size) {
122
+ super();
123
+ this.size = size ? size : null;
204
124
  }
205
- return AngleType;
206
- }(ClassicalType));
207
- exports.AngleType = AngleType;
125
+ }
208
126
  /** Class representing the stretch type. */
209
- var StretchType = /** @class */ (function (_super) {
210
- __extends(StretchType, _super);
211
- function StretchType() {
212
- return _super !== null && _super.apply(this, arguments) || this;
213
- }
214
- return StretchType;
215
- }(ClassicalType));
216
- exports.StretchType = StretchType;
127
+ class StretchType extends ClassicalType {
128
+ }
217
129
  /** Class representing a duration type. */
218
- var DurationType = /** @class */ (function (_super) {
219
- __extends(DurationType, _super);
220
- function DurationType() {
221
- return _super !== null && _super.apply(this, arguments) || this;
222
- }
223
- return DurationType;
224
- }(ClassicalType));
225
- exports.DurationType = DurationType;
130
+ class DurationType extends ClassicalType {
131
+ }
226
132
  /** Base class representing an expression. */
227
- var Expression = /** @class */ (function (_super) {
228
- __extends(Expression, _super);
229
- function Expression() {
230
- return _super !== null && _super.apply(this, arguments) || this;
231
- }
232
- return Expression;
233
- }(AstNode));
234
- exports.Expression = Expression;
133
+ class Expression extends AstNode {
134
+ }
235
135
  /** Class representing a list of parameters. */
236
- var Parameters = /** @class */ (function (_super) {
237
- __extends(Parameters, _super);
238
- function Parameters(args) {
239
- var _this = _super.call(this) || this;
240
- _this.args = args;
241
- return _this;
136
+ class Parameters extends Expression {
137
+ constructor(args) {
138
+ super();
139
+ this.args = args;
242
140
  }
243
- return Parameters;
244
- }(Expression));
245
- exports.Parameters = Parameters;
141
+ }
246
142
  /** Class representing a range. */
247
- var Range = /** @class */ (function (_super) {
248
- __extends(Range, _super);
249
- function Range(start, end, step) {
250
- var _this = _super.call(this) || this;
251
- _this.start = start ? start : null;
252
- _this.end = end ? end : null;
253
- _this.step = step ? step : null;
254
- return _this;
255
- }
256
- return Range;
257
- }(Expression));
258
- exports.Range = Range;
143
+ class Range extends Expression {
144
+ constructor(start, end, step) {
145
+ super();
146
+ this.start = start ? start : null;
147
+ this.end = end ? end : null;
148
+ this.step = step ? step : null;
149
+ }
150
+ }
259
151
  /** Class representing an expression identifier. */
260
- var Identifier = /** @class */ (function (_super) {
261
- __extends(Identifier, _super);
262
- function Identifier(name) {
263
- var _this = _super.call(this) || this;
264
- _this.name = name;
265
- return _this;
152
+ class Identifier extends Expression {
153
+ constructor(name) {
154
+ super();
155
+ this.name = name;
266
156
  }
267
- return Identifier;
268
- }(Expression));
269
- exports.Identifier = Identifier;
157
+ }
270
158
  /** Class representing an identifier with subscripted access. */
271
- var SubscriptedIdentifier = /** @class */ (function (_super) {
272
- __extends(SubscriptedIdentifier, _super);
273
- function SubscriptedIdentifier(name, subscript) {
274
- var _this = _super.call(this, name) || this;
275
- _this.subscript = subscript;
276
- return _this;
159
+ class SubscriptedIdentifier extends Identifier {
160
+ constructor(name, subscript) {
161
+ super(name);
162
+ this.subscript = subscript;
277
163
  }
278
- return SubscriptedIdentifier;
279
- }(Identifier));
280
- exports.SubscriptedIdentifier = SubscriptedIdentifier;
164
+ }
281
165
  /** Class representing the Pi constant. */
282
- var Pi = /** @class */ (function (_super) {
283
- __extends(Pi, _super);
284
- function Pi() {
285
- return _super !== null && _super.apply(this, arguments) || this;
286
- }
287
- return Pi;
288
- }(Expression));
289
- exports.Pi = Pi;
166
+ class Pi extends Expression {
167
+ }
290
168
  /** Class representing the Euler constant. */
291
- var Euler = /** @class */ (function (_super) {
292
- __extends(Euler, _super);
293
- function Euler() {
294
- return _super !== null && _super.apply(this, arguments) || this;
295
- }
296
- return Euler;
297
- }(Expression));
298
- exports.Euler = Euler;
169
+ class Euler extends Expression {
170
+ }
299
171
  /** Class representing the Tau constant. */
300
- var Tau = /** @class */ (function (_super) {
301
- __extends(Tau, _super);
302
- function Tau() {
303
- return _super !== null && _super.apply(this, arguments) || this;
304
- }
305
- return Tau;
306
- }(Expression));
307
- exports.Tau = Tau;
172
+ class Tau extends Expression {
173
+ }
308
174
  /** Enum representing the available mathematical functions. */
309
175
  var MathFunctionTypes;
310
176
  (function (MathFunctionTypes) {
@@ -318,19 +184,15 @@ var MathFunctionTypes;
318
184
  MathFunctionTypes["SQRT"] = "sqrt";
319
185
  MathFunctionTypes["ROTR"] = "rotr";
320
186
  MathFunctionTypes["ROTL"] = "rotl";
321
- })(MathFunctionTypes || (exports.MathFunctionTypes = MathFunctionTypes = {}));
187
+ })(MathFunctionTypes || (MathFunctionTypes = {}));
322
188
  /** Class representing a mathematical function. */
323
- var MathFunction = /** @class */ (function (_super) {
324
- __extends(MathFunction, _super);
325
- function MathFunction(mathType, operands) {
326
- var _this = _super.call(this) || this;
327
- _this.mathType = mathType;
328
- _this.operands = operands;
329
- return _this;
189
+ class MathFunction extends Expression {
190
+ constructor(mathType, operands) {
191
+ super();
192
+ this.mathType = mathType;
193
+ this.operands = operands;
330
194
  }
331
- return MathFunction;
332
- }(Expression));
333
- exports.MathFunction = MathFunction;
195
+ }
334
196
  /** Enum representing the available trigonometric functions. */
335
197
  var TrigFunctionTypes;
336
198
  (function (TrigFunctionTypes) {
@@ -340,85 +202,57 @@ var TrigFunctionTypes;
340
202
  TrigFunctionTypes["COS"] = "Cos";
341
203
  TrigFunctionTypes["SIN"] = "Sin";
342
204
  TrigFunctionTypes["TAN"] = "Tan";
343
- })(TrigFunctionTypes || (exports.TrigFunctionTypes = TrigFunctionTypes = {}));
205
+ })(TrigFunctionTypes || (TrigFunctionTypes = {}));
344
206
  /** Class representing a trigonometric function. */
345
- var TrigFunction = /** @class */ (function (_super) {
346
- __extends(TrigFunction, _super);
347
- function TrigFunction(trigType, operand) {
348
- var _this = _super.call(this) || this;
349
- _this.trigType = trigType;
350
- _this.operand = operand;
351
- return _this;
207
+ class TrigFunction extends Expression {
208
+ constructor(trigType, operand) {
209
+ super();
210
+ this.trigType = trigType;
211
+ this.operand = operand;
352
212
  }
353
- return TrigFunction;
354
- }(Expression));
355
- exports.TrigFunction = TrigFunction;
213
+ }
356
214
  /** Class representing an integer literal. */
357
- var IntegerLiteral = /** @class */ (function (_super) {
358
- __extends(IntegerLiteral, _super);
359
- function IntegerLiteral(value) {
360
- var _this = _super.call(this) || this;
361
- _this.value = value;
362
- return _this;
215
+ class IntegerLiteral extends Expression {
216
+ constructor(value) {
217
+ super();
218
+ this.value = value;
363
219
  }
364
- return IntegerLiteral;
365
- }(Expression));
366
- exports.IntegerLiteral = IntegerLiteral;
220
+ }
367
221
  /** Class representing a scientific notation, binary, octal, or hex literal. */
368
- var NumericLiteral = /** @class */ (function (_super) {
369
- __extends(NumericLiteral, _super);
370
- function NumericLiteral(value) {
371
- var _this = _super.call(this) || this;
372
- _this.value = value;
373
- return _this;
222
+ class NumericLiteral extends Expression {
223
+ constructor(value) {
224
+ super();
225
+ this.value = value;
374
226
  }
375
- return NumericLiteral;
376
- }(Expression));
377
- exports.NumericLiteral = NumericLiteral;
227
+ }
378
228
  /** Class representing a float literal. */
379
- var FloatLiteral = /** @class */ (function (_super) {
380
- __extends(FloatLiteral, _super);
381
- function FloatLiteral(value) {
382
- var _this = _super.call(this) || this;
383
- _this.value = value;
384
- return _this;
229
+ class FloatLiteral extends Expression {
230
+ constructor(value) {
231
+ super();
232
+ this.value = value;
385
233
  }
386
- return FloatLiteral;
387
- }(Expression));
388
- exports.FloatLiteral = FloatLiteral;
234
+ }
389
235
  /** Class representing an imaginary number literal. */
390
- var ImaginaryLiteral = /** @class */ (function (_super) {
391
- __extends(ImaginaryLiteral, _super);
392
- function ImaginaryLiteral(value) {
393
- var _this = _super.call(this) || this;
394
- _this.value = value;
395
- return _this;
236
+ class ImaginaryLiteral extends Expression {
237
+ constructor(value) {
238
+ super();
239
+ this.value = value;
396
240
  }
397
- return ImaginaryLiteral;
398
- }(Expression));
399
- exports.ImaginaryLiteral = ImaginaryLiteral;
241
+ }
400
242
  /** Class representing a boolean literal. */
401
- var BooleanLiteral = /** @class */ (function (_super) {
402
- __extends(BooleanLiteral, _super);
403
- function BooleanLiteral(value) {
404
- var _this = _super.call(this) || this;
405
- _this.value = value;
406
- return _this;
243
+ class BooleanLiteral extends Expression {
244
+ constructor(value) {
245
+ super();
246
+ this.value = value;
407
247
  }
408
- return BooleanLiteral;
409
- }(Expression));
410
- exports.BooleanLiteral = BooleanLiteral;
248
+ }
411
249
  /** Class representing a bit string literal. */
412
- var BitstringLiteral = /** @class */ (function (_super) {
413
- __extends(BitstringLiteral, _super);
414
- function BitstringLiteral(value) {
415
- var _this = _super.call(this) || this;
416
- _this.value = value;
417
- return _this;
250
+ class BitstringLiteral extends Expression {
251
+ constructor(value) {
252
+ super();
253
+ this.value = value;
418
254
  }
419
- return BitstringLiteral;
420
- }(Expression));
421
- exports.BitstringLiteral = BitstringLiteral;
255
+ }
422
256
  /** Enum representing the supported duration units. */
423
257
  var DurationUnit;
424
258
  (function (DurationUnit) {
@@ -427,64 +261,48 @@ var DurationUnit;
427
261
  DurationUnit["MILLISECOND"] = "ms";
428
262
  DurationUnit["SECOND"] = "s";
429
263
  DurationUnit["SAMPLE"] = "dt";
430
- })(DurationUnit || (exports.DurationUnit = DurationUnit = {}));
264
+ })(DurationUnit || (DurationUnit = {}));
431
265
  /** Class representing a duration literal. */
432
- var DurationLiteral = /** @class */ (function (_super) {
433
- __extends(DurationLiteral, _super);
434
- function DurationLiteral(value, unit) {
435
- var _this = _super.call(this) || this;
436
- _this.value = value;
437
- _this.unit = unit;
438
- return _this;
266
+ class DurationLiteral extends Expression {
267
+ constructor(value, unit) {
268
+ super();
269
+ this.value = value;
270
+ this.unit = unit;
439
271
  }
440
- return DurationLiteral;
441
- }(Expression));
442
- exports.DurationLiteral = DurationLiteral;
272
+ }
443
273
  /** Class representing a durationof function call. */
444
- var DurationOf = /** @class */ (function (_super) {
445
- __extends(DurationOf, _super);
446
- function DurationOf(scope) {
447
- var _this = _super.call(this) || this;
448
- _this.scope = scope;
449
- return _this;
274
+ class DurationOf extends Expression {
275
+ constructor(scope) {
276
+ super();
277
+ this.scope = scope;
450
278
  }
451
- return DurationOf;
452
- }(Expression));
453
- exports.DurationOf = DurationOf;
279
+ }
454
280
  /** Class representing a sizeof function call. */
455
- var SizeOf = /** @class */ (function (_super) {
456
- __extends(SizeOf, _super);
457
- function SizeOf(array, dimensionIndex) {
458
- var _this = _super.call(this) || this;
459
- _this.array = array;
460
- _this.dimensionIndex =
281
+ class SizeOf extends Expression {
282
+ constructor(array, dimensionIndex) {
283
+ super();
284
+ this.array = array;
285
+ this.dimensionIndex =
461
286
  dimensionIndex !== undefined && dimensionIndex !== null
462
287
  ? dimensionIndex
463
288
  : new IntegerLiteral(0);
464
- return _this;
465
289
  }
466
- return SizeOf;
467
- }(Expression));
468
- exports.SizeOf = SizeOf;
290
+ }
469
291
  /** Enum representing Unary operands. */
470
292
  var UnaryOp;
471
293
  (function (UnaryOp) {
472
294
  UnaryOp["LOGIC_NOT"] = "!";
473
295
  UnaryOp["BIT_NOT"] = "~";
474
296
  UnaryOp["MINUS"] = "-";
475
- })(UnaryOp || (exports.UnaryOp = UnaryOp = {}));
297
+ })(UnaryOp || (UnaryOp = {}));
476
298
  /** Class representing a unary operator. */
477
- var Unary = /** @class */ (function (_super) {
478
- __extends(Unary, _super);
479
- function Unary(op, operand) {
480
- var _this = _super.call(this) || this;
481
- _this.op = op;
482
- _this.operand = operand;
483
- return _this;
299
+ class Unary extends Expression {
300
+ constructor(op, operand) {
301
+ super();
302
+ this.op = op;
303
+ this.operand = operand;
484
304
  }
485
- return Unary;
486
- }(Expression));
487
- exports.Unary = Unary;
305
+ }
488
306
  /** Enum representing arithmetic operations. */
489
307
  var ArithmeticOp;
490
308
  (function (ArithmeticOp) {
@@ -495,20 +313,16 @@ var ArithmeticOp;
495
313
  ArithmeticOp["PLUS"] = "+";
496
314
  ArithmeticOp["MINUS"] = "-";
497
315
  ArithmeticOp["CONCAT"] = "++";
498
- })(ArithmeticOp || (exports.ArithmeticOp = ArithmeticOp = {}));
316
+ })(ArithmeticOp || (ArithmeticOp = {}));
499
317
  /** Class representing an arithmetic operator expression. */
500
- var Arithmetic = /** @class */ (function (_super) {
501
- __extends(Arithmetic, _super);
502
- function Arithmetic(op, left, right) {
503
- var _this = _super.call(this) || this;
504
- _this.op = op;
505
- _this.left = left;
506
- _this.right = right;
507
- return _this;
508
- }
509
- return Arithmetic;
510
- }(Expression));
511
- exports.Arithmetic = Arithmetic;
318
+ class Arithmetic extends Expression {
319
+ constructor(op, left, right) {
320
+ super();
321
+ this.op = op;
322
+ this.left = left;
323
+ this.right = right;
324
+ }
325
+ }
512
326
  /** Enum representing binary operands. */
513
327
  var BinaryOp;
514
328
  (function (BinaryOp) {
@@ -525,119 +339,87 @@ var BinaryOp;
525
339
  BinaryOp["NOT_EQUAL"] = "!=";
526
340
  BinaryOp["SHIFT_LEFT"] = "<<";
527
341
  BinaryOp["SHIFT_RIGHT"] = ">>";
528
- })(BinaryOp || (exports.BinaryOp = BinaryOp = {}));
342
+ })(BinaryOp || (BinaryOp = {}));
529
343
  /** Class representing binary operator expressions. */
530
- var Binary = /** @class */ (function (_super) {
531
- __extends(Binary, _super);
532
- function Binary(op, left, right) {
533
- var _this = _super.call(this) || this;
534
- _this.op = op;
535
- _this.left = left;
536
- _this.right = right;
537
- return _this;
538
- }
539
- return Binary;
540
- }(Expression));
541
- exports.Binary = Binary;
344
+ class Binary extends Expression {
345
+ constructor(op, left, right) {
346
+ super();
347
+ this.op = op;
348
+ this.left = left;
349
+ this.right = right;
350
+ }
351
+ }
542
352
  /** Class representing an cast expression. */
543
- var Cast = /** @class */ (function (_super) {
544
- __extends(Cast, _super);
545
- function Cast(type, operand) {
546
- var _this = _super.call(this) || this;
547
- _this.type = type;
548
- _this.operand = operand;
549
- return _this;
353
+ class Cast extends Expression {
354
+ constructor(type, operand) {
355
+ super();
356
+ this.type = type;
357
+ this.operand = operand;
550
358
  }
551
- return Cast;
552
- }(Expression));
553
- exports.Cast = Cast;
359
+ }
554
360
  /**
555
361
  * Class representing a literal index set of values.
556
362
  *
557
363
  * { Expression (, Expression )* }
558
364
  */
559
- var IndexSet = /** @class */ (function (_super) {
560
- __extends(IndexSet, _super);
561
- function IndexSet(values) {
562
- var _this = _super.call(this) || this;
563
- _this.values = values;
564
- return _this;
365
+ class IndexSet extends Expression {
366
+ constructor(values) {
367
+ super();
368
+ this.values = values;
565
369
  }
566
- return IndexSet;
567
- }(Expression));
568
- exports.IndexSet = IndexSet;
370
+ }
569
371
  /** Enum representing the supported array reference modifiers. */
570
372
  var ArrayReferenceModifier;
571
373
  (function (ArrayReferenceModifier) {
572
374
  ArrayReferenceModifier["READONLY"] = "readonly";
573
375
  ArrayReferenceModifier["MUTABLE"] = "mutable";
574
- })(ArrayReferenceModifier || (exports.ArrayReferenceModifier = ArrayReferenceModifier = {}));
376
+ })(ArrayReferenceModifier || (ArrayReferenceModifier = {}));
575
377
  /** Class representing an array reference. */
576
- var ArrayReference = /** @class */ (function (_super) {
577
- __extends(ArrayReference, _super);
578
- function ArrayReference(array, modifier) {
579
- var _this = _super.call(this) || this;
580
- _this.array = array;
581
- _this.modifier = modifier;
582
- return _this;
378
+ class ArrayReference extends Expression {
379
+ constructor(array, modifier) {
380
+ super();
381
+ this.array = array;
382
+ this.modifier = modifier;
583
383
  }
584
- return ArrayReference;
585
- }(Expression));
586
- exports.ArrayReference = ArrayReference;
384
+ }
587
385
  /** Class representing a statically sized array. */
588
- var ArrayDeclaration = /** @class */ (function (_super) {
589
- __extends(ArrayDeclaration, _super);
590
- function ArrayDeclaration(baseType, dimensions, identifier, initializer) {
591
- var _this = _super.call(this) || this;
592
- _this.baseType = baseType;
593
- _this.dimensions = dimensions;
594
- _this.identifier = identifier;
595
- _this.initializer =
386
+ class ArrayDeclaration extends Statement {
387
+ constructor(baseType, dimensions, identifier, initializer) {
388
+ super();
389
+ this.baseType = baseType;
390
+ this.dimensions = dimensions;
391
+ this.identifier = identifier;
392
+ this.initializer =
596
393
  initializer !== undefined && initializer !== null ? initializer : null;
597
- return _this;
598
394
  }
599
- return ArrayDeclaration;
600
- }(Statement));
601
- exports.ArrayDeclaration = ArrayDeclaration;
395
+ }
602
396
  /** Class representing an initial value for an ArrayDeclaration. */
603
- var ArrayInitializer = /** @class */ (function (_super) {
604
- __extends(ArrayInitializer, _super);
605
- function ArrayInitializer(values) {
606
- var _this = _super.call(this) || this;
607
- _this.values = values;
608
- return _this;
397
+ class ArrayInitializer extends Expression {
398
+ constructor(values) {
399
+ super();
400
+ this.values = values;
609
401
  }
610
- return ArrayInitializer;
611
- }(Expression));
612
- exports.ArrayInitializer = ArrayInitializer;
402
+ }
613
403
  /** Class representing an array access */
614
- var ArrayAccess = /** @class */ (function (_super) {
615
- __extends(ArrayAccess, _super);
616
- function ArrayAccess(array, indices) {
617
- var _this = _super.call(this) || this;
618
- _this.array = array;
619
- _this.indices = indices !== undefined && indices !== null ? indices : null;
620
- return _this;
404
+ class ArrayAccess extends Expression {
405
+ constructor(array, indices) {
406
+ super();
407
+ this.array = array;
408
+ this.indices = indices !== undefined && indices !== null ? indices : null;
621
409
  }
622
- return ArrayAccess;
623
- }(Expression));
624
- exports.ArrayAccess = ArrayAccess;
410
+ }
625
411
  /**
626
412
  * Class representing a quantum measurement.
627
413
  *
628
414
  * quantumMeasurement
629
415
  * : `measure` identifierList
630
416
  */
631
- var QuantumMeasurement = /** @class */ (function (_super) {
632
- __extends(QuantumMeasurement, _super);
633
- function QuantumMeasurement(identifierList) {
634
- var _this = _super.call(this) || this;
635
- _this.identifierList = identifierList;
636
- return _this;
417
+ class QuantumMeasurement extends AstNode {
418
+ constructor(identifierList) {
419
+ super();
420
+ this.identifierList = identifierList;
637
421
  }
638
- return QuantumMeasurement;
639
- }(AstNode));
640
- exports.QuantumMeasurement = QuantumMeasurement;
422
+ }
641
423
  /**
642
424
  * Class representing a quantum measurement assignment statement.
643
425
  *
@@ -645,45 +427,33 @@ exports.QuantumMeasurement = QuantumMeasurement;
645
427
  * : quantumMeasurement ARROW indexIdentifierList
646
428
  * | indexIdentifier EQUALS quantumMeasurement
647
429
  */
648
- var QuantumMeasurementAssignment = /** @class */ (function (_super) {
649
- __extends(QuantumMeasurementAssignment, _super);
650
- function QuantumMeasurementAssignment(identifier, quantumMeasurement) {
651
- var _this = _super.call(this) || this;
652
- _this.identifier = identifier;
653
- _this.quantumMeasurement = quantumMeasurement;
654
- return _this;
430
+ class QuantumMeasurementAssignment extends Statement {
431
+ constructor(identifier, quantumMeasurement) {
432
+ super();
433
+ this.identifier = identifier;
434
+ this.quantumMeasurement = quantumMeasurement;
655
435
  }
656
- return QuantumMeasurementAssignment;
657
- }(Statement));
658
- exports.QuantumMeasurementAssignment = QuantumMeasurementAssignment;
436
+ }
659
437
  /** Class representing the declaration of a classical type, optionally initializing it to a value. */
660
- var ClassicalDeclaration = /** @class */ (function (_super) {
661
- __extends(ClassicalDeclaration, _super);
662
- function ClassicalDeclaration(classicalType, identifier, initializer, isConst) {
663
- var _this = _super.call(this) || this;
664
- _this.classicalType = classicalType;
665
- _this.identifier =
438
+ class ClassicalDeclaration extends Statement {
439
+ constructor(classicalType, identifier, initializer, isConst) {
440
+ super();
441
+ this.classicalType = classicalType;
442
+ this.identifier =
666
443
  identifier !== undefined && identifier !== null ? identifier : null;
667
- _this.initializer =
444
+ this.initializer =
668
445
  initializer !== undefined && initializer !== null ? initializer : null;
669
- _this.isConst = isConst !== undefined && isConst !== null ? isConst : false;
670
- return _this;
446
+ this.isConst = isConst !== undefined && isConst !== null ? isConst : false;
671
447
  }
672
- return ClassicalDeclaration;
673
- }(Statement));
674
- exports.ClassicalDeclaration = ClassicalDeclaration;
448
+ }
675
449
  /** Class representing an expression to a left value. */
676
- var AssignmentStatement = /** @class */ (function (_super) {
677
- __extends(AssignmentStatement, _super);
678
- function AssignmentStatement(leftValue, rightValue) {
679
- var _this = _super.call(this) || this;
680
- _this.leftValue = leftValue;
681
- _this.rightValue = rightValue;
682
- return _this;
450
+ class AssignmentStatement extends Statement {
451
+ constructor(leftValue, rightValue) {
452
+ super();
453
+ this.leftValue = leftValue;
454
+ this.rightValue = rightValue;
683
455
  }
684
- return AssignmentStatement;
685
- }(Statement));
686
- exports.AssignmentStatement = AssignmentStatement;
456
+ }
687
457
  /**
688
458
  * Class representing a quantum declaration.
689
459
  *
@@ -691,44 +461,32 @@ exports.AssignmentStatement = AssignmentStatement;
691
461
  * : `qreg` Identifier designator?
692
462
  * `qubit` designator? Identifier
693
463
  */
694
- var QuantumDeclaration = /** @class */ (function (_super) {
695
- __extends(QuantumDeclaration, _super);
696
- function QuantumDeclaration(identifier, size) {
697
- var _this = _super.call(this) || this;
698
- _this.identifier = identifier;
699
- _this.size = size ? size : null;
700
- return _this;
464
+ class QuantumDeclaration extends AstNode {
465
+ constructor(identifier, size) {
466
+ super();
467
+ this.identifier = identifier;
468
+ this.size = size ? size : null;
701
469
  }
702
- return QuantumDeclaration;
703
- }(AstNode));
704
- exports.QuantumDeclaration = QuantumDeclaration;
470
+ }
705
471
  /**
706
472
  * Class representing a hardware qubit.
707
473
  *
708
474
  * $[NUM]
709
475
  */
710
- var HardwareQubit = /** @class */ (function (_super) {
711
- __extends(HardwareQubit, _super);
712
- function HardwareQubit(number) {
713
- var _this = _super.call(this) || this;
714
- _this.number = number;
715
- return _this;
476
+ class HardwareQubit extends AstNode {
477
+ constructor(number) {
478
+ super();
479
+ this.number = number;
716
480
  }
717
- return HardwareQubit;
718
- }(AstNode));
719
- exports.HardwareQubit = HardwareQubit;
481
+ }
720
482
  /** Class representing an alias statement. */
721
- var AliasStatement = /** @class */ (function (_super) {
722
- __extends(AliasStatement, _super);
723
- function AliasStatement(identifier, value) {
724
- var _this = _super.call(this) || this;
725
- _this.identifier = identifier;
726
- _this.value = value;
727
- return _this;
483
+ class AliasStatement extends AstNode {
484
+ constructor(identifier, value) {
485
+ super();
486
+ this.identifier = identifier;
487
+ this.value = value;
728
488
  }
729
- return AliasStatement;
730
- }(AstNode));
731
- exports.AliasStatement = AliasStatement;
489
+ }
732
490
  /** Enum representing the available quantum gate modifiers. */
733
491
  var QuantumGateModifierName;
734
492
  (function (QuantumGateModifierName) {
@@ -736,88 +494,64 @@ var QuantumGateModifierName;
736
494
  QuantumGateModifierName[QuantumGateModifierName["NRGCTRL"] = 1] = "NRGCTRL";
737
495
  QuantumGateModifierName[QuantumGateModifierName["INV"] = 2] = "INV";
738
496
  QuantumGateModifierName[QuantumGateModifierName["POW"] = 3] = "POW";
739
- })(QuantumGateModifierName || (exports.QuantumGateModifierName = QuantumGateModifierName = {}));
497
+ })(QuantumGateModifierName || (QuantumGateModifierName = {}));
740
498
  /** Class representing a modifier of a gate. */
741
- var QuantumGateModifier = /** @class */ (function (_super) {
742
- __extends(QuantumGateModifier, _super);
743
- function QuantumGateModifier(modifier, argument) {
744
- var _this = _super.call(this) || this;
745
- _this.modifier = modifier;
746
- _this.argument = argument ? argument : null;
747
- return _this;
499
+ class QuantumGateModifier extends AstNode {
500
+ constructor(modifier, argument) {
501
+ super();
502
+ this.modifier = modifier;
503
+ this.argument = argument ? argument : null;
748
504
  }
749
- return QuantumGateModifier;
750
- }(AstNode));
751
- exports.QuantumGateModifier = QuantumGateModifier;
505
+ }
752
506
  /**
753
507
  * Class representing a quantum gate call.
754
508
  *
755
509
  * quantumGateCall
756
510
  * : quantumGateModifier* quantumGateName ( LPAREN expressionList? RPAREN )? indexIdentifierList
757
511
  */
758
- var QuantumGateCall = /** @class */ (function (_super) {
759
- __extends(QuantumGateCall, _super);
760
- function QuantumGateCall(quantumGateCall, qubits, parameters, modifiers) {
761
- var _this = _super.call(this) || this;
762
- _this.quantumGateName = quantumGateCall;
763
- _this.qubits = qubits;
764
- _this.parameters = parameters ? parameters : null;
765
- _this.modifiers = modifiers ? modifiers : [];
766
- return _this;
767
- }
768
- return QuantumGateCall;
769
- }(QuantumInstruction));
770
- exports.QuantumGateCall = QuantumGateCall;
512
+ class QuantumGateCall extends QuantumInstruction {
513
+ constructor(quantumGateCall, qubits, parameters, modifiers) {
514
+ super();
515
+ this.quantumGateName = quantumGateCall;
516
+ this.qubits = qubits;
517
+ this.parameters = parameters ? parameters : null;
518
+ this.modifiers = modifiers ? modifiers : [];
519
+ }
520
+ }
771
521
  /**
772
522
  * Class representing a quantum barrier.
773
523
  *
774
524
  * quantumBarrier
775
525
  * : `barrier` indexIdentifierList
776
526
  */
777
- var QuantumBarrier = /** @class */ (function (_super) {
778
- __extends(QuantumBarrier, _super);
779
- function QuantumBarrier(qubits) {
780
- var _this = _super.call(this) || this;
781
- _this.qubits = qubits;
782
- return _this;
527
+ class QuantumBarrier extends QuantumInstruction {
528
+ constructor(qubits) {
529
+ super();
530
+ this.qubits = qubits;
783
531
  }
784
- return QuantumBarrier;
785
- }(QuantumInstruction));
786
- exports.QuantumBarrier = QuantumBarrier;
532
+ }
787
533
  /** Class representing a quantum reset instruction. */
788
- var QuantumReset = /** @class */ (function (_super) {
789
- __extends(QuantumReset, _super);
790
- function QuantumReset(identifier) {
791
- var _this = _super.call(this) || this;
792
- _this.identifier = identifier;
793
- return _this;
534
+ class QuantumReset extends QuantumInstruction {
535
+ constructor(identifier) {
536
+ super();
537
+ this.identifier = identifier;
794
538
  }
795
- return QuantumReset;
796
- }(QuantumInstruction));
797
- exports.QuantumReset = QuantumReset;
539
+ }
798
540
  /** Class representing a quantum delay instruction. */
799
- var QuantumDelay = /** @class */ (function (_super) {
800
- __extends(QuantumDelay, _super);
801
- function QuantumDelay(duration, qubits) {
802
- var _this = _super.call(this) || this;
803
- _this.duration = duration;
804
- _this.qubits = qubits;
805
- return _this;
541
+ class QuantumDelay extends QuantumInstruction {
542
+ constructor(duration, qubits) {
543
+ super();
544
+ this.duration = duration;
545
+ this.qubits = qubits;
806
546
  }
807
- return QuantumDelay;
808
- }(QuantumInstruction));
809
- exports.QuantumDelay = QuantumDelay;
547
+ }
810
548
  /** Class representing a return statement. */
811
- var ReturnStatement = /** @class */ (function (_super) {
812
- __extends(ReturnStatement, _super);
813
- function ReturnStatement(expression) {
814
- var _this = _super.call(this) || this;
815
- _this.expression = expression ? expression : null;
816
- return _this;
549
+ class ReturnStatement extends Statement {
550
+ constructor(expression) {
551
+ super();
552
+ this.expression = expression ? expression : null;
817
553
  }
818
- return ReturnStatement;
819
- }(Statement));
820
- exports.ReturnStatement = ReturnStatement;
554
+ }
821
555
  /**
822
556
  * Base class representing a program block.
823
557
  *
@@ -825,82 +559,64 @@ exports.ReturnStatement = ReturnStatement;
825
559
  * : statement | controlDirective
826
560
  * | LBRACE(statement | controlDirective) * RBRACEj
827
561
  */
828
- var ProgramBlock = /** @class */ (function (_super) {
829
- __extends(ProgramBlock, _super);
830
- function ProgramBlock(statements) {
831
- var _this = _super.call(this) || this;
832
- _this.statements = statements;
833
- return _this;
562
+ class ProgramBlock extends AstNode {
563
+ constructor(statements) {
564
+ super();
565
+ this.statements = statements;
834
566
  }
835
- return ProgramBlock;
836
- }(AstNode));
837
- exports.ProgramBlock = ProgramBlock;
567
+ }
838
568
  /**
839
569
  * Class representing a block of quantum operation statements.
840
570
  *
841
571
  * quantumBlock
842
572
  * : LBRACE (quantumStatement | quantumLoop) * RBRACE
843
573
  */
844
- var QuantumBlock = /** @class */ (function (_super) {
845
- __extends(QuantumBlock, _super);
846
- function QuantumBlock(statements) {
847
- return _super.call(this, statements) || this;
574
+ class QuantumBlock extends ProgramBlock {
575
+ constructor(statements) {
576
+ super(statements);
848
577
  }
849
- return QuantumBlock;
850
- }(ProgramBlock));
851
- exports.QuantumBlock = QuantumBlock;
578
+ }
852
579
  /**
853
580
  * Class representing a block of statements in a subroutine.
854
581
  *
855
582
  * subroutineBlock
856
583
  * : LBRACE statement* returnStatement? RBRACE
857
584
  */
858
- var SubroutineBlock = /** @class */ (function (_super) {
859
- __extends(SubroutineBlock, _super);
860
- function SubroutineBlock(statements) {
861
- return _super.call(this, statements) || this;
585
+ class SubroutineBlock extends ProgramBlock {
586
+ constructor(statements) {
587
+ super(statements);
862
588
  }
863
- return SubroutineBlock;
864
- }(ProgramBlock));
865
- exports.SubroutineBlock = SubroutineBlock;
589
+ }
866
590
  /**
867
591
  * Class representing a quantum gate definition.
868
592
  *
869
593
  * quantumGateDefinition
870
594
  * : `gate` quantumGateDefinition quantumBlock
871
595
  */
872
- var QuantumGateDefinition = /** @class */ (function (_super) {
873
- __extends(QuantumGateDefinition, _super);
874
- function QuantumGateDefinition(name, params, qubits, body) {
875
- var _this = _super.call(this) || this;
876
- _this.name = name;
877
- _this.params = params;
878
- _this.qubits = qubits;
879
- _this.body = body;
880
- return _this;
881
- }
882
- return QuantumGateDefinition;
883
- }(Statement));
884
- exports.QuantumGateDefinition = QuantumGateDefinition;
596
+ class QuantumGateDefinition extends Statement {
597
+ constructor(name, params, qubits, body) {
598
+ super();
599
+ this.name = name;
600
+ this.params = params;
601
+ this.qubits = qubits;
602
+ this.body = body;
603
+ }
604
+ }
885
605
  /**
886
606
  * Class representing an extern function signature.
887
607
  *
888
608
  * externStatement
889
609
  * : EXTERN Identifier LPAREN externArgumentList? RPAREN returnSignature? SEMICOLON;
890
610
  */
891
- var ExternSignature = /** @class */ (function (_super) {
892
- __extends(ExternSignature, _super);
893
- function ExternSignature(name, args, returnType) {
894
- var _this = _super.call(this) || this;
895
- _this.name = name;
896
- _this.args = args;
897
- _this.returnType =
611
+ class ExternSignature extends Statement {
612
+ constructor(name, args, returnType) {
613
+ super();
614
+ this.name = name;
615
+ this.args = args;
616
+ this.returnType =
898
617
  returnType !== undefined && returnType !== null ? returnType : null;
899
- return _this;
900
618
  }
901
- return ExternSignature;
902
- }(Statement));
903
- exports.ExternSignature = ExternSignature;
619
+ }
904
620
  /**
905
621
  * Class representing a subroutine.
906
622
  *
@@ -908,67 +624,51 @@ exports.ExternSignature = ExternSignature;
908
624
  * : `def` Identifier LPAREN anyTypeArgumentList? RPAREN
909
625
  * returnSignature? subroutineBlock
910
626
  */
911
- var SubroutineDefinition = /** @class */ (function (_super) {
912
- __extends(SubroutineDefinition, _super);
913
- function SubroutineDefinition(name, subroutineBlock, args, returnType) {
914
- var _this = _super.call(this) || this;
915
- _this.name = name;
916
- _this.subroutineBlock = subroutineBlock;
917
- _this.args = args;
918
- _this.returnType = returnType ? returnType : null;
919
- return _this;
920
- }
921
- return SubroutineDefinition;
922
- }(Statement));
923
- exports.SubroutineDefinition = SubroutineDefinition;
627
+ class SubroutineDefinition extends Statement {
628
+ constructor(name, subroutineBlock, args, returnType) {
629
+ super();
630
+ this.name = name;
631
+ this.subroutineBlock = subroutineBlock;
632
+ this.args = args;
633
+ this.returnType = returnType ? returnType : null;
634
+ }
635
+ }
924
636
  /**
925
637
  * Class representing a box scoping statement.
926
638
  *
927
639
  * boxStatement
928
640
  * : BOX designator? scope;
929
641
  */
930
- var BoxDefinition = /** @class */ (function (_super) {
931
- __extends(BoxDefinition, _super);
932
- function BoxDefinition(scope, designator) {
933
- var _this = _super.call(this) || this;
934
- _this.scope = scope;
935
- _this.designator =
642
+ class BoxDefinition extends Statement {
643
+ constructor(scope, designator) {
644
+ super();
645
+ this.scope = scope;
646
+ this.designator =
936
647
  designator !== undefined && designator !== null ? designator : null;
937
- return _this;
938
648
  }
939
- return BoxDefinition;
940
- }(Statement));
941
- exports.BoxDefinition = BoxDefinition;
649
+ }
942
650
  /** Class representing a subroutine call. */
943
- var SubroutineCall = /** @class */ (function (_super) {
944
- __extends(SubroutineCall, _super);
945
- function SubroutineCall(subroutineName, parameters) {
946
- var _this = _super.call(this) || this;
947
- _this.subroutineName = subroutineName;
948
- _this.parameters = parameters ? parameters : null;
949
- return _this;
651
+ class SubroutineCall extends Statement {
652
+ constructor(subroutineName, parameters) {
653
+ super();
654
+ this.subroutineName = subroutineName;
655
+ this.parameters = parameters ? parameters : null;
950
656
  }
951
- return SubroutineCall;
952
- }(Statement));
953
- exports.SubroutineCall = SubroutineCall;
657
+ }
954
658
  /**
955
659
  * Class representing a branching if statement.
956
660
  *
957
661
  * branchingStatement
958
662
  * : `if` LPAREN booleanExpression RPAREN programBlock (`else` programBlock)?
959
663
  */
960
- var BranchingStatement = /** @class */ (function (_super) {
961
- __extends(BranchingStatement, _super);
962
- function BranchingStatement(condition, trueBody, falseBody) {
963
- var _this = _super.call(this) || this;
964
- _this.condition = condition;
965
- _this.trueBody = trueBody;
966
- _this.falseBody = falseBody;
967
- return _this;
968
- }
969
- return BranchingStatement;
970
- }(Statement));
971
- exports.BranchingStatement = BranchingStatement;
664
+ class BranchingStatement extends Statement {
665
+ constructor(condition, trueBody, falseBody) {
666
+ super();
667
+ this.condition = condition;
668
+ this.trueBody = trueBody;
669
+ this.falseBody = falseBody;
670
+ }
671
+ }
972
672
  /**
973
673
  * Class representing a for loop statement.
974
674
  *
@@ -978,104 +678,69 @@ exports.BranchingStatement = BranchingStatement;
978
678
  * | "{" Expression ("," Expression)* "}"
979
679
  * | "[" Range "]"
980
680
  */
981
- var ForLoopStatement = /** @class */ (function (_super) {
982
- __extends(ForLoopStatement, _super);
983
- function ForLoopStatement(indexSet, loopVarType, parameter, body) {
984
- var _this = _super.call(this) || this;
985
- _this.indexSet = indexSet;
986
- _this.loopVarType = loopVarType;
987
- _this.parameter = parameter;
988
- _this.body = body;
989
- return _this;
990
- }
991
- return ForLoopStatement;
992
- }(Statement));
993
- exports.ForLoopStatement = ForLoopStatement;
681
+ class ForLoopStatement extends Statement {
682
+ constructor(indexSet, loopVarType, parameter, body) {
683
+ super();
684
+ this.indexSet = indexSet;
685
+ this.loopVarType = loopVarType;
686
+ this.parameter = parameter;
687
+ this.body = body;
688
+ }
689
+ }
994
690
  /**
995
691
  * Class representing a while loop statement.
996
692
  *
997
693
  * WhileLoop: "while" "(" Expression ")" ProgramBlock
998
694
  */
999
- var WhileLoopStatement = /** @class */ (function (_super) {
1000
- __extends(WhileLoopStatement, _super);
1001
- function WhileLoopStatement(condition, body) {
1002
- var _this = _super.call(this) || this;
1003
- _this.condition = condition;
1004
- _this.body = body;
1005
- return _this;
695
+ class WhileLoopStatement extends Statement {
696
+ constructor(condition, body) {
697
+ super();
698
+ this.condition = condition;
699
+ this.body = body;
1006
700
  }
1007
- return WhileLoopStatement;
1008
- }(Statement));
1009
- exports.WhileLoopStatement = WhileLoopStatement;
701
+ }
1010
702
  /** Class representing a break loop statement. */
1011
- var BreakStatement = /** @class */ (function (_super) {
1012
- __extends(BreakStatement, _super);
1013
- function BreakStatement() {
1014
- return _super !== null && _super.apply(this, arguments) || this;
1015
- }
1016
- return BreakStatement;
1017
- }(Statement));
1018
- exports.BreakStatement = BreakStatement;
703
+ class BreakStatement extends Statement {
704
+ }
1019
705
  /** Class representing a continue loop statement. */
1020
- var ContinueStatement = /** @class */ (function (_super) {
1021
- __extends(ContinueStatement, _super);
1022
- function ContinueStatement() {
1023
- return _super !== null && _super.apply(this, arguments) || this;
1024
- }
1025
- return ContinueStatement;
1026
- }(Statement));
1027
- exports.ContinueStatement = ContinueStatement;
706
+ class ContinueStatement extends Statement {
707
+ }
1028
708
  /** Enum representing the available IO modifiers. */
1029
709
  var IOModifier;
1030
710
  (function (IOModifier) {
1031
711
  IOModifier["INPUT"] = "input";
1032
712
  IOModifier["OUTPUT"] = "output";
1033
- })(IOModifier || (exports.IOModifier = IOModifier = {}));
713
+ })(IOModifier || (IOModifier = {}));
1034
714
  /** Class representing a declaration of an IO variable. */
1035
- var IODeclaration = /** @class */ (function (_super) {
1036
- __extends(IODeclaration, _super);
1037
- function IODeclaration(modifier, classicalType) {
1038
- var _this = _super.call(this) || this;
1039
- _this.modifier = modifier;
1040
- _this.classicalType = classicalType;
1041
- return _this;
715
+ class IODeclaration extends Statement {
716
+ constructor(modifier, classicalType) {
717
+ super();
718
+ this.modifier = modifier;
719
+ this.classicalType = classicalType;
1042
720
  }
1043
- return IODeclaration;
1044
- }(Statement));
1045
- exports.IODeclaration = IODeclaration;
721
+ }
1046
722
  /** Class representing a switch statement. */
1047
- var SwitchStatement = /** @class */ (function (_super) {
1048
- __extends(SwitchStatement, _super);
1049
- function SwitchStatement(controlExpression, cases, defaultBlock) {
1050
- var _this = _super.call(this) || this;
1051
- _this.controlExpression = controlExpression;
1052
- _this.cases = cases;
1053
- _this.defaultBlock = defaultBlock ? defaultBlock : null;
1054
- return _this;
1055
- }
1056
- return SwitchStatement;
1057
- }(Statement));
1058
- exports.SwitchStatement = SwitchStatement;
723
+ class SwitchStatement extends Statement {
724
+ constructor(controlExpression, cases, defaultBlock) {
725
+ super();
726
+ this.controlExpression = controlExpression;
727
+ this.cases = cases;
728
+ this.defaultBlock = defaultBlock ? defaultBlock : null;
729
+ }
730
+ }
1059
731
  /** Class representing a single case in a switch statement. */
1060
- var CaseStatement = /** @class */ (function (_super) {
1061
- __extends(CaseStatement, _super);
1062
- function CaseStatement(labels, body) {
1063
- var _this = _super.call(this) || this;
1064
- _this.labels = labels;
1065
- _this.body = body;
1066
- return _this;
732
+ class CaseStatement extends Statement {
733
+ constructor(labels, body) {
734
+ super();
735
+ this.labels = labels;
736
+ this.body = body;
1067
737
  }
1068
- return CaseStatement;
1069
- }(Statement));
1070
- exports.CaseStatement = CaseStatement;
738
+ }
1071
739
  /** Class representing the default case in a swtich statement. */
1072
- var DefaultStatement = /** @class */ (function (_super) {
1073
- __extends(DefaultStatement, _super);
1074
- function DefaultStatement(body) {
1075
- var _this = _super.call(this) || this;
1076
- _this.body = body;
1077
- return _this;
740
+ class DefaultStatement extends Statement {
741
+ constructor(body) {
742
+ super();
743
+ this.body = body;
1078
744
  }
1079
- return DefaultStatement;
1080
- }(Statement));
1081
- exports.DefaultStatement = DefaultStatement;
745
+ }
746
+ export { AstNode, Statement, Expression, Parameters, ArrayReferenceModifier, ArrayReference, CalibrationGrammarDeclaration, Include, Version, FloatType, ComplexType, BoolType, IntType, UIntType, BitType, AngleType, StretchType, DurationType, Range, Identifier, SubscriptedIdentifier, Pi, Euler, Tau, MathFunctionTypes, MathFunction, TrigFunctionTypes, TrigFunction, IntegerLiteral, NumericLiteral, FloatLiteral, ImaginaryLiteral, BooleanLiteral, BitstringLiteral, DurationUnit, DurationLiteral, DurationOf, SizeOf, UnaryOp, Unary, ArithmeticOp, Arithmetic, BinaryOp, Binary, Cast, IndexSet, ArrayDeclaration, ArrayInitializer, ArrayAccess, QuantumMeasurement, QuantumMeasurementAssignment, ClassicalDeclaration, AssignmentStatement, QuantumDeclaration, HardwareQubit, AliasStatement, QuantumGateModifierName, QuantumGateModifier, QuantumGateCall, QuantumBarrier, QuantumReset, QuantumDelay, ReturnStatement, ProgramBlock, QuantumBlock, SubroutineBlock, QuantumGateDefinition, BoxDefinition, ExternSignature, SubroutineDefinition, SubroutineCall, BranchingStatement, ForLoopStatement, WhileLoopStatement, BreakStatement, ContinueStatement, IOModifier, IODeclaration, SwitchStatement, CaseStatement, DefaultStatement, ClassicalType, };