Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grammar railroad diagram #41

Open
mingodad opened this issue Nov 8, 2024 · 2 comments
Open

Grammar railroad diagram #41

mingodad opened this issue Nov 8, 2024 · 2 comments

Comments

@mingodad
Copy link

mingodad commented Nov 8, 2024

I've just added the grammar/lexer of this project to https://mingodad.github.io/parsertl-playground/playground/ an Yacc/Lex compatible online editor/interpreter (select Qasm parser (be patient) (partially working) from Examples then click Parse to see a parse tree for the content in Input source) and also generated an EBNF understood by https://github.com/GuntherRademacher/rr to generate a nice navigable railroad diagram (see next comment with instructions at the top).

In doing so I've noticed that the lexer seems to be reused from another project and has several unused tokens and several duplicates for other tokens, the parser grammar seems to be generated from a tool that inline/expand several rules (maybe https://github.com/BNFC/bnfc ?) what make the grammar bigger and slower.

I hope https://mingodad.github.io/parsertl-playground/playground/ can help develop/test/debug this project grammar.

@mingodad
Copy link
Author

mingodad commented Nov 8, 2024

//
// EBNF to be viewd at
//    (IPV6) https://www.bottlecaps.de/rr/ui
//    (IPV4) https://rr.red-dove.com/ui
//
// Copy and paste this at one of the urls shown above in the 'Edit Grammar' tab
// then click the 'View Diagram' tab.
//

Start::=
	  OpenQASMProgram

OpenPulseProgram::=
	  OpenPulseStmtList
	| TOK_IBMQASM TOK_FP_CONSTANT TOK_SEMICOLON StmtListImpl
	| TOK_IBMQASM TOK_INTEGER_CONSTANT TOK_SEMICOLON StmtList
	| TOK_START_OPENQASM OpenQASMProgram

OpenQASMProgram::=
	  StmtList
	| TOK_IBMQASM TOK_FP_CONSTANT TOK_SEMICOLON StmtListImpl
	| TOK_IBMQASM TOK_INTEGER_CONSTANT TOK_SEMICOLON StmtList
	| TOK_START_OPENPULSE OpenPulseProgram

StmtList::=
	  StmtListImpl

StmtListImpl::=
	  /*%empty*/
	| StmtListImpl Statement
	| StmtListImpl OpenPulseStatement

OpenPulseStmtList::=
	  OpenPulseStmtListImpl

OpenPulseStmtListImpl::=
	  /*%empty*/
	| OpenPulseStmtListImpl OpenPulseStatement
	| OpenPulseStmtListImpl Statement

ForStmtList::=
	  ForStmtListImpl

ForStmtListImpl::=
	  /*%empty*/
	| ForStmtListImpl Statement

BoxStmtList::=
	  BoxStmtListImpl

BoxStmtListImpl::=
	  /*%empty*/
	| BoxStmtListImpl Statement

FuncStmtList::=
	  FuncStmtListImpl

FuncStmtListImpl::=
	  /*%empty*/
	| FuncStmtListImpl Statement
	| FuncStmtListImpl Statement TOK_COMMA

InitExpressionNodeList::=
	  InitExpressionNodeListImpl

InitExpressionNodeListImpl::=
	  /*%empty*/
	| InitExpressionNode
	| InitExpressionNodeListImpl TOK_COMMA InitExpressionNode

InitializerList::=
	  InitializerListImpl

InitializerListImpl::=
	  /*%empty*/
	| TOK_LEFT_CURLY InitExpressionNodeList TOK_RIGHT_CURLY
	| InitializerListImpl TOK_COMMA TOK_LEFT_CURLY InitExpressionNodeList TOK_RIGHT_CURLY

QubitList::=
	  QubitListImpl

QubitListImpl::=
	  /*%empty*/
	| QubitListImpl BoundQubit
	| QubitListImpl IndexedBoundQubit
	| QubitListImpl BoundQubit TOK_COMMA
	| QubitListImpl IndexedBoundQubit TOK_COMMA
	| QubitListImpl UnboundQubit
	| QubitListImpl IndexedUnboundQubit
	| QubitListImpl UnboundQubit TOK_COMMA
	| QubitListImpl IndexedUnboundQubit TOK_COMMA

IndexedSubscriptExpr::=
	  TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET
	| TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET
	| TOK_LEFT_BRACKET BinaryOp TOK_RIGHT_BRACKET
	| TOK_LEFT_BRACKET UnaryOp TOK_RIGHT_BRACKET

IndexedSubscriptList::=
	  IndexedSubscriptListImpl

IndexedSubscriptListImpl::=
	  /*%empty*/
	| IndexedSubscriptListImpl IndexedSubscriptExpr

KernelStmtList::=
	  KernelStmtListImpl

KernelStmtListImpl::=
	  /*%empty*/
	| KernelStmtListImpl Statement
	| KernelStmtListImpl Statement TOK_COMMA

DefcalStmtList::=
	  DefcalStmtListImpl

DefcalStmtListImpl::=
	  /*%empty*/
	| DefcalStmtListImpl Statement
	| DefcalStmtListImpl Statement TOK_COMMA
	| DefcalStmtListImpl OpenPulseStatement
	| DefcalStmtListImpl OpenPulseStatement TOK_COMMA

IfStmtList::=
	  IfStmtListImpl

IfStmtListImpl::=
	  /*%empty*/
	| IfStmtListImpl Statement

ElseIfStmtList::=
	  ElseIfStmtListImpl

ElseIfStmtListImpl::=
	  /*%empty*/
	| ElseIfStmtListImpl Statement

ElseStmtList::=
	  ElseStmtListImpl

ElseStmtListImpl::=
	  /*%empty*/
	| ElseStmtListImpl Statement

WhileStmtList::=
	  WhileStmtListImpl

WhileStmtListImpl::=
	  /*%empty*/
	| WhileStmtListImpl Statement

DoWhileStmtList::=
	  DoWhileStmtListImpl

DoWhileStmtListImpl::=
	  /*%empty*/
	| DoWhileStmtListImpl Statement

SwitchStmtList::=
	  SwitchStmtListImpl

SwitchStmtListImpl::=
	  /*%empty*/
	| SwitchStmtListImpl SwitchCaseStmt
	| SwitchStmtListImpl SwitchDefaultStmt

Statement::=
	  Decl
	| ConstDecl
	| FuncDecl
	| GateDecl
	| OpaqueDecl
	| GateQOp
	| Barrier
	| IfStmt
	| ElseIfStmt
	| ElseStmt
	| ForStmt
	| WhileStmt
	| DoWhileStmt
	| ReturnStmt
	| SwitchStmt
	| BreakStmt
	| ContinueStmt
	| DelayStmt
	| StretchStmt
	| BinaryOpStmt
	| BoxStmt
	| FunctionCallStmt
	| IncludeStmt
	| RotateOpStmt
	| PopcountOpStmt
	| GateCtrlExprStmt
	| GateNegCtrlExprStmt
	| GateInvExprStmt
	| GatePowExprStmt
	| PragmaStmt
	| AnnotationStmt
	| LineDirective
	| FileDirective
	| Newline

OpenPulseStatement::=
	  OpenPulseDecl
	| OpenPulseStmt

Decl::=
	  TOK_QREG Identifier TOK_SEMICOLON
	| TOK_CREG Identifier TOK_SEMICOLON
	| TOK_CREG Identifier TOK_EQUAL_ASSIGN Integer TOK_SEMICOLON
	| TOK_CREG TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET Identifier TOK_SEMICOLON
	| TOK_CREG TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN Integer TOK_SEMICOLON
	| TOK_CREG TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_STRING_LITERAL TOK_SEMICOLON
	| TOK_BOOL Identifier TOK_SEMICOLON
	| TOK_BOOL Identifier TOK_EQUAL_ASSIGN TOK_BOOLEAN_CONSTANT TOK_SEMICOLON
	| TOK_BOOL Identifier TOK_EQUAL_ASSIGN TOK_INTEGER_CONSTANT TOK_SEMICOLON
	| TOK_BOOL Identifier TOK_EQUAL_ASSIGN BinaryOpExpr TOK_SEMICOLON
	| TOK_BOOL Identifier TOK_EQUAL_ASSIGN UnaryOp TOK_SEMICOLON
	| TOK_BOOL Identifier TOK_EQUAL_ASSIGN LogicalNotExpr TOK_SEMICOLON
	| TOK_BOOL Identifier TOK_EQUAL_ASSIGN Identifier TOK_SEMICOLON
	| TOK_BOOL Identifier TOK_EQUAL_ASSIGN FunctionCallStmt
	| TOK_INT Identifier TOK_SEMICOLON
	| TOK_INT Identifier TOK_EQUAL_ASSIGN Expr TOK_SEMICOLON
	| TOK_INT Identifier TOK_EQUAL_ASSIGN Statement
	| TOK_INT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET Identifier TOK_SEMICOLON
	| TOK_INT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET Identifier TOK_SEMICOLON
	| TOK_INT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN Expr TOK_SEMICOLON
	| TOK_INT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN FunctionCallStmt
	| TOK_INT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN Expr TOK_SEMICOLON
	| TOK_INT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN FunctionCallStmt
	| TOK_UINT Identifier TOK_SEMICOLON
	| TOK_UINT Identifier TOK_EQUAL_ASSIGN Expr TOK_SEMICOLON
	| TOK_UINT Identifier TOK_EQUAL_ASSIGN Statement
	| TOK_UINT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET Identifier TOK_SEMICOLON
	| TOK_UINT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET Identifier TOK_SEMICOLON
	| TOK_UINT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN Expr TOK_SEMICOLON
	| TOK_UINT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN FunctionCallStmt
	| TOK_UINT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN Expr TOK_SEMICOLON
	| TOK_UINT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN FunctionCallStmt
	| TOK_DOUBLE Identifier TOK_SEMICOLON
	| TOK_DOUBLE Identifier TOK_EQUAL_ASSIGN Expr TOK_SEMICOLON
	| TOK_FLOAT Identifier TOK_SEMICOLON
	| TOK_FLOAT Identifier TOK_EQUAL_ASSIGN Expr TOK_SEMICOLON
	| TOK_FLOAT Identifier TOK_EQUAL_ASSIGN FunctionCallStmt
	| TOK_FLOAT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET Identifier TOK_SEMICOLON
	| TOK_FLOAT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET Identifier TOK_SEMICOLON
	| TOK_FLOAT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN Expr TOK_SEMICOLON
	| TOK_FLOAT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN FunctionCallStmt
	| TOK_FLOAT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN Expr TOK_SEMICOLON
	| TOK_FLOAT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN FunctionCallStmt
	| TOK_CONST TOK_IDENTIFIER TOK_EQUAL_ASSIGN Expr TOK_SEMICOLON
	| TOK_CONST TOK_IDENTIFIER TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_EQUAL_ASSIGN Expr TOK_SEMICOLON
	| TOK_CONST TOK_IDENTIFIER TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_EQUAL_ASSIGN Expr TOK_SEMICOLON
	| TOK_ANGLE TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET Identifier TOK_SEMICOLON
	| TOK_ANGLE TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET Identifier TOK_SEMICOLON
	| TOK_ANGLE TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN Expr TOK_SEMICOLON
	| TOK_ANGLE TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN FunctionCallStmt
	| TOK_ANGLE Identifier TOK_SEMICOLON
	| TOK_ANGLE Identifier TOK_EQUAL_ASSIGN Expr TOK_SEMICOLON
	| TOK_ANGLE Identifier TOK_EQUAL_ASSIGN FunctionCallStmt
	| TOK_ANGLE TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN Expr TOK_SEMICOLON
	| TOK_ANGLE TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN FunctionCallStmt
	| DurationOfDecl TOK_SEMICOLON
	| DurationDecl TOK_SEMICOLON
	| TOK_BIT Identifier TOK_SEMICOLON
	| TOK_BIT Identifier TOK_EQUAL_ASSIGN TOK_INTEGER_CONSTANT TOK_SEMICOLON
	| TOK_BIT Identifier TOK_EQUAL_ASSIGN TOK_STRING_LITERAL TOK_SEMICOLON
	| TOK_BIT Identifier TOK_EQUAL_ASSIGN Identifier TOK_SEMICOLON
	| TOK_BIT Identifier TOK_EQUAL_ASSIGN GateQOp
	| TOK_BIT Identifier TOK_EQUAL_ASSIGN FunctionCallStmt
	| TOK_BIT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET Identifier TOK_SEMICOLON
	| TOK_BIT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET Identifier TOK_SEMICOLON
	| TOK_BIT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN Expr TOK_SEMICOLON
	| TOK_BIT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN FunctionCallStmt
	| TOK_BIT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN Expr TOK_SEMICOLON
	| TOK_BIT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN FunctionCallStmt
	| TOK_QUBIT Identifier TOK_SEMICOLON
	| TOK_QUBIT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET Identifier TOK_SEMICOLON
	| TOK_QUBIT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET Identifier TOK_SEMICOLON
	| TOK_QUBIT Identifier TOK_EQUAL_ASSIGN Expr TOK_SEMICOLON
	| TOK_QUBIT Identifier TOK_EQUAL_ASSIGN FunctionCallStmt
	| TOK_QUBIT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN Expr TOK_SEMICOLON
	| TOK_QUBIT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN FunctionCallStmt
	| TOK_QUBIT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN Expr TOK_SEMICOLON
	| TOK_QUBIT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN FunctionCallStmt
	| TOK_LET Identifier TOK_EQUAL_ASSIGN TOK_IDENTIFIER TOK_LEFT_BRACKET TOK_INTEGER_CONSTANT TOK_COMMA IntegerList TOK_RIGHT_BRACKET TOK_SEMICOLON
	| TOK_LET Identifier TOK_EQUAL_ASSIGN TOK_IDENTIFIER TOK_LEFT_BRACKET TOK_INTEGER_CONSTANT ':' IntegerList TOK_RIGHT_BRACKET TOK_SEMICOLON
	| TOK_LET Identifier TOK_EQUAL_ASSIGN TOK_IDENTIFIER IndexedSubscriptExpr TOK_SEMICOLON
	| TOK_LET Identifier TOK_EQUAL_ASSIGN Identifier TOK_OR_OP QubitConcatList TOK_SEMICOLON
	| TOK_LET Identifier TOK_EQUAL_ASSIGN Identifier TOK_INC_OP QubitConcatList TOK_SEMICOLON
	| FuncResult
	| KernelDecl
	| DefcalDecl
	| DefcalGrammarDecl
	| ArrayExpr TOK_SEMICOLON
	| InitArrayExpr TOK_SEMICOLON
	| MPComplexDecl TOK_SEMICOLON
	| MPComplexFunctionCallDecl TOK_SEMICOLON
	| ModifierDecl

ConstDecl::=
	  TOK_CONST Decl

ModifierDecl::=
	  TOK_INPUT Decl
	| TOK_OUTPUT Decl

OpenPulseDecl::=
	  OpenPulseFrame TOK_SEMICOLON
	| OpenPulsePort TOK_SEMICOLON
	| OpenPulseWaveform TOK_SEMICOLON
	| OpenPulseWaveform

OpenPulseStmt::=
	  OpenPulsePlay TOK_SEMICOLON
	| OpenPulseCalibration

OpenPulseFrame::=
	  TOK_FRAME Identifier TOK_EQUAL_ASSIGN TOK_NEWFRAME TOK_LEFT_PAREN ExprList TOK_RIGHT_PAREN
	| TOK_EXTERN TOK_FRAME Identifier
	| TOK_NEWFRAME TOK_LEFT_PAREN ExprList TOK_RIGHT_PAREN

OpenPulsePort::=
	  TOK_EXTERN TOK_PORT Identifier

OpenPulseWaveform::=
	  TOK_WAVEFORM Identifier TOK_EQUAL_ASSIGN TOK_LEFT_BRACKET ExprList TOK_RIGHT_BRACKET
	| TOK_WAVEFORM Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY ExprList TOK_RIGHT_CURLY
	| TOK_WAVEFORM Identifier TOK_EQUAL_ASSIGN FunctionCallStmt

OpenPulsePlay::=
	  TOK_PLAY TOK_LEFT_PAREN TOK_LEFT_BRACKET ExprList TOK_RIGHT_BRACKET TOK_COMMA Identifier TOK_RIGHT_PAREN
	| TOK_PLAY TOK_LEFT_PAREN TOK_LEFT_BRACKET ExprList TOK_RIGHT_BRACKET TOK_COMMA OpenPulseFrame TOK_RIGHT_PAREN
	| TOK_PLAY TOK_LEFT_PAREN OpenPulseWaveform TOK_COMMA Identifier TOK_RIGHT_PAREN
	| TOK_PLAY TOK_LEFT_PAREN Identifier TOK_COMMA Identifier TOK_RIGHT_PAREN
	| TOK_PLAY TOK_LEFT_PAREN Identifier TOK_COMMA OpenPulseFrame TOK_RIGHT_PAREN
	| TOK_PLAY TOK_LEFT_PAREN OpenPulseWaveform TOK_COMMA OpenPulseFrame TOK_RIGHT_PAREN
	| TOK_PLAY TOK_LEFT_PAREN ParenFunctionCallExpr TOK_COMMA Identifier TOK_RIGHT_PAREN
	| TOK_PLAY TOK_LEFT_PAREN ParenFunctionCallExpr TOK_COMMA OpenPulseFrame TOK_RIGHT_PAREN

OpenPulseCalibration::=
	  TOK_CAL TOK_LEFT_CURLY OpenPulseStmtList TOK_RIGHT_CURLY

NamedTypeDeclList::=
	  NamedTypeDeclListImpl NamedTypeDecl
	| NamedTypeDeclListImpl ParamTypeDecl

NamedTypeDeclListImpl::=
	  /*%empty*/
	| NamedTypeDeclListImpl NamedTypeDecl
	| NamedTypeDeclListImpl NamedTypeDecl TOK_COMMA
	| NamedTypeDeclListImpl ParamTypeDecl TOK_COMMA

PragmaExpr::=
	  TOK_PRAGMA TOK_STRING_LITERAL

PragmaStmt::=
	  PragmaExpr

AnnotationExpr::=
	  TOK_ANNOTATION StringList

AnnotationStmt::=
	  AnnotationExpr

FuncResult::=
	  TOK_RIGHT_ARROW TOK_ANGLE
	| TOK_RIGHT_ARROW TOK_ANGLE TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET
	| TOK_RIGHT_ARROW TOK_ANGLE TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET
	| TOK_RIGHT_ARROW TOK_ANGLE TOK_LEFT_BRACKET BinaryOpExpr TOK_RIGHT_BRACKET
	| TOK_RIGHT_ARROW TOK_BIT
	| TOK_RIGHT_ARROW TOK_BIT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET
	| TOK_RIGHT_ARROW TOK_BIT TOK_LEFT_BRACKET BinaryOpExpr TOK_RIGHT_BRACKET
	| TOK_RIGHT_ARROW TOK_BIT TOK_LEFT_BRACKET TOK_INTEGER_CONSTANT TOK_RIGHT_BRACKET
	| TOK_RIGHT_ARROW TOK_QUBIT
	| TOK_RIGHT_ARROW TOK_QUBIT TOK_LEFT_BRACKET Expr TOK_RIGHT_BRACKET
	| TOK_RIGHT_ARROW TOK_BOOL
	| TOK_RIGHT_ARROW TOK_INT
	| TOK_RIGHT_ARROW TOK_UINT
	| TOK_RIGHT_ARROW MPIntegerType
	| TOK_RIGHT_ARROW TOK_FLOAT
	| TOK_RIGHT_ARROW TOK_DOUBLE
	| TOK_RIGHT_ARROW MPDecimalType
	| TOK_RIGHT_ARROW MPComplexType
	| TOK_RIGHT_ARROW TOK_WAVEFORM
	| TOK_RIGHT_ARROW TOK_FRAME

FuncDecl::=
	  TOK_FUNCTION_DEFINITION Identifier TOK_LEFT_PAREN NamedTypeDeclList TOK_RIGHT_PAREN FuncResult TOK_LEFT_CURLY FuncStmtList TOK_RIGHT_CURLY
	| TOK_FUNCTION_DEFINITION Identifier TOK_LEFT_PAREN TOK_RIGHT_PAREN FuncResult TOK_LEFT_CURLY FuncStmtList TOK_RIGHT_CURLY
	| TOK_FUNCTION_DEFINITION Identifier FuncResult TOK_LEFT_CURLY FuncStmtList TOK_RIGHT_CURLY
	| TOK_FUNCTION_DEFINITION Identifier TOK_LEFT_PAREN NamedTypeDeclList TOK_RIGHT_PAREN TOK_LEFT_CURLY FuncStmtList TOK_RIGHT_CURLY
	| TOK_FUNCTION_DEFINITION Identifier TOK_LEFT_PAREN TOK_RIGHT_PAREN TOK_LEFT_CURLY FuncStmtList TOK_RIGHT_CURLY
	| TOK_FUNCTION_DEFINITION Identifier TOK_LEFT_CURLY FuncStmtList TOK_RIGHT_CURLY

GateDecl::=
	  TOK_GATE Identifier TOK_LEFT_PAREN NamedTypeDeclList TOK_RIGHT_PAREN GateQubitParamList TOK_LEFT_CURLY GateOpList TOK_RIGHT_CURLY
	| TOK_GATE Identifier GateQubitParamList TOK_LEFT_CURLY GateOpList TOK_RIGHT_CURLY
	| TOK_GATE TOK_CX GateQubitParamList TOK_LEFT_CURLY GateOpList TOK_RIGHT_CURLY
	| TOK_GATE TOK_HADAMARD GateQubitParamList TOK_LEFT_CURLY GateOpList TOK_RIGHT_CURLY
	| TOK_GATE TOK_HADAMARD TOK_LEFT_PAREN NamedTypeDeclList TOK_RIGHT_PAREN GateQubitParamList TOK_LEFT_CURLY GateOpList TOK_RIGHT_CURLY

OpaqueDecl::=
	  TOK_OPAQUE Identifier TOK_LEFT_PAREN NamedTypeDeclList TOK_RIGHT_PAREN GateQubitParamList TOK_SEMICOLON
	| TOK_OPAQUE Identifier GateQubitParamList TOK_SEMICOLON

BinaryOpAssign::=
	  Identifier TOK_EQUAL_ASSIGN Expr
	| Identifier TOK_EQUAL_ASSIGN FunctionCallExpr
	| Identifier TOK_EQUAL_ASSIGN ComplexInitializerExpr
	| Identifier TOK_EQUAL_ASSIGN BinaryOpSelfAssign
	| Identifier TOK_EQUAL_ASSIGN BinaryOpAssign
	| Identifier TOK_EQUAL_ASSIGN BinaryOpPrePost
	| Identifier TOK_EQUAL_ASSIGN RotateOpExpr
	| Identifier TOK_EQUAL_ASSIGN PopcountOpExpr
	| Identifier TOK_EQUAL_ASSIGN TimeUnit
	| Identifier TOK_EQUAL_ASSIGN BooleanConstant
	| TOK_INTEGER_CONSTANT TOK_EQUAL_ASSIGN Expr
	| TOK_FP_CONSTANT TOK_EQUAL_ASSIGN Expr
	| TOK_STRING_LITERAL TOK_EQUAL_ASSIGN Expr
	| BinaryOp TOK_EQUAL_ASSIGN BinaryOp
	| BinaryOp TOK_EQUAL_ASSIGN BinaryOpAssign
	| BinaryOp TOK_EQUAL_ASSIGN BinaryOpSelfAssign
	| BinaryOp TOK_EQUAL_ASSIGN BinaryOpPrePost
	| BinaryOp TOK_EQUAL_ASSIGN UnaryOp
	| BinaryOp TOK_EQUAL_ASSIGN RotateOpExpr
	| BinaryOp TOK_EQUAL_ASSIGN PopcountOpExpr
	| BinaryOp TOK_EQUAL_ASSIGN FunctionCallExpr
	| BinaryOp TOK_EQUAL_ASSIGN ComplexInitializerExpr
	| BinaryOp TOK_EQUAL_ASSIGN TimeUnit
	| BinaryOp TOK_EQUAL_ASSIGN BooleanConstant
	| BinaryOpSelfAssign TOK_EQUAL_ASSIGN BinaryOp
	| BinaryOpPrePost TOK_EQUAL_ASSIGN BinaryOp
	| UnaryOp TOK_EQUAL_ASSIGN BinaryOp
	| UnaryOp TOK_EQUAL_ASSIGN BinaryOpSelfAssign
	| UnaryOp TOK_EQUAL_ASSIGN BinaryOpPrePost

BinaryOpSelfAssign::=
	  Expr TOK_RIGHT_SHIFT_ASSIGN Expr
	| Expr TOK_RIGHT_SHIFT_ASSIGN ParenFunctionCallExpr
	| BinaryOpSelfAssign TOK_RIGHT_SHIFT_ASSIGN Expr
	| BinaryOpPrePost TOK_RIGHT_SHIFT_ASSIGN Expr
	| Expr TOK_RIGHT_SHIFT_ASSIGN BinaryOpSelfAssign
	| Expr TOK_RIGHT_SHIFT_ASSIGN BinaryOpPrePost
	| Expr TOK_LEFT_SHIFT_ASSIGN Expr
	| Expr TOK_LEFT_SHIFT_ASSIGN ParenFunctionCallExpr
	| BinaryOpSelfAssign TOK_LEFT_SHIFT_ASSIGN Expr
	| BinaryOpPrePost TOK_LEFT_SHIFT_ASSIGN Expr
	| Expr TOK_LEFT_SHIFT_ASSIGN BinaryOpSelfAssign
	| Expr TOK_LEFT_SHIFT_ASSIGN BinaryOpPrePost
	| Expr TOK_ADD_ASSIGN Expr
	| Expr TOK_ADD_ASSIGN ParenFunctionCallExpr
	| BinaryOpSelfAssign TOK_ADD_ASSIGN Expr
	| BinaryOpPrePost TOK_ADD_ASSIGN Expr
	| Expr TOK_ADD_ASSIGN BinaryOpSelfAssign
	| Expr TOK_ADD_ASSIGN BinaryOpPrePost
	| Expr TOK_SUB_ASSIGN Expr
	| Expr TOK_SUB_ASSIGN ParenFunctionCallExpr
	| BinaryOpSelfAssign TOK_SUB_ASSIGN Expr
	| BinaryOpPrePost TOK_SUB_ASSIGN Expr
	| Expr TOK_SUB_ASSIGN BinaryOpSelfAssign
	| Expr TOK_SUB_ASSIGN BinaryOpPrePost
	| Expr TOK_MUL_ASSIGN Expr
	| Expr TOK_MUL_ASSIGN ParenFunctionCallExpr
	| BinaryOpSelfAssign TOK_MUL_ASSIGN Expr
	| BinaryOpPrePost TOK_MUL_ASSIGN Expr
	| Expr TOK_MUL_ASSIGN BinaryOpSelfAssign
	| Expr TOK_MUL_ASSIGN BinaryOpPrePost
	| Expr TOK_DIV_OP_ASSIGN Expr
	| Expr TOK_DIV_OP_ASSIGN ParenFunctionCallExpr
	| BinaryOpSelfAssign TOK_DIV_OP_ASSIGN Expr
	| BinaryOpPrePost TOK_DIV_OP_ASSIGN Expr
	| Expr TOK_DIV_OP_ASSIGN BinaryOpSelfAssign
	| Expr TOK_DIV_OP_ASSIGN BinaryOpPrePost
	| Expr TOK_MOD_ASSIGN Expr
	| Expr TOK_MOD_ASSIGN ParenFunctionCallExpr
	| BinaryOpSelfAssign TOK_MOD_ASSIGN Expr
	| BinaryOpPrePost TOK_MOD_ASSIGN Expr
	| Expr TOK_MOD_ASSIGN BinaryOpSelfAssign
	| Expr TOK_MOD_ASSIGN BinaryOpPrePost
	| Expr TOK_AND_ASSIGN Expr
	| Expr TOK_AND_ASSIGN ParenFunctionCallExpr
	| BinaryOpSelfAssign TOK_AND_ASSIGN Expr
	| BinaryOpPrePost TOK_AND_ASSIGN Expr
	| Expr TOK_AND_ASSIGN BinaryOpSelfAssign
	| Expr TOK_AND_ASSIGN BinaryOpPrePost
	| Expr TOK_OR_ASSIGN Expr
	| Expr TOK_OR_ASSIGN ParenFunctionCallExpr
	| BinaryOpSelfAssign TOK_OR_ASSIGN Expr
	| BinaryOpPrePost TOK_OR_ASSIGN Expr
	| Expr TOK_OR_ASSIGN BinaryOpSelfAssign
	| Expr TOK_OR_ASSIGN BinaryOpPrePost
	| Expr TOK_XOR_ASSIGN Expr
	| Expr TOK_XOR_ASSIGN ParenFunctionCallExpr
	| BinaryOpSelfAssign TOK_XOR_ASSIGN Expr
	| BinaryOpPrePost TOK_XOR_ASSIGN Expr
	| Expr TOK_XOR_ASSIGN BinaryOpSelfAssign
	| Expr TOK_XOR_ASSIGN BinaryOpPrePost

BinaryOpPrePost::=
	  TOK_DEC_OP Identifier
	| TOK_DEC_OP TOK_LEFT_PAREN Expr TOK_RIGHT_PAREN
	| TOK_INC_OP Identifier
	| TOK_INC_OP TOK_LEFT_PAREN Expr TOK_RIGHT_PAREN
	| Identifier TOK_DEC_OP
	| TOK_LEFT_PAREN Expr TOK_RIGHT_PAREN TOK_DEC_OP
	| Identifier TOK_INC_OP
	| TOK_LEFT_PAREN Expr TOK_RIGHT_PAREN TOK_INC_OP

BinaryOp::=
	  Expr TOK_ADD_OP Expr
	| Expr TOK_ADD_OP ParenFunctionCallExpr
	| Expr TOK_ADD_OP BinaryOpPrePost
	| Expr TOK_ADD_OP BinaryOpSelfAssign
	| BinaryOpPrePost TOK_ADD_OP Expr
	| BinaryOpSelfAssign TOK_ADD_OP Expr
	| Expr TOK_MINUS Expr
	| Expr TOK_MINUS ParenFunctionCallExpr
	| Expr TOK_MINUS BinaryOpPrePost
	| Expr TOK_MINUS BinaryOpSelfAssign
	| BinaryOpPrePost TOK_MINUS Expr
	| BinaryOpSelfAssign TOK_MINUS Expr
	| Expr TOK_MUL_OP Expr
	| Expr TOK_MUL_OP ParenFunctionCallExpr
	| Expr TOK_MUL_OP BinaryOpPrePost
	| Expr TOK_MUL_OP BinaryOpSelfAssign
	| BinaryOpPrePost TOK_MUL_OP Expr
	| BinaryOpSelfAssign TOK_MUL_OP Expr
	| Expr TOK_MUL_OP TOK_MUL_OP Expr
	| Expr TOK_MUL_OP TOK_MUL_OP ParenFunctionCallExpr
	| Expr TOK_MUL_OP TOK_MUL_OP BinaryOpPrePost
	| Expr TOK_MUL_OP TOK_MUL_OP BinaryOpSelfAssign
	| BinaryOpPrePost TOK_MUL_OP TOK_MUL_OP Expr
	| BinaryOpSelfAssign TOK_MUL_OP TOK_MUL_OP Expr
	| Expr TOK_DIV_OP Expr
	| Expr TOK_DIV_OP ParenFunctionCallExpr
	| Expr TOK_DIV_OP BinaryOpPrePost
	| Expr TOK_DIV_OP BinaryOpSelfAssign
	| BinaryOpPrePost TOK_DIV_OP Expr
	| BinaryOpSelfAssign TOK_DIV_OP Expr
	| Expr TOK_MOD_OP Expr
	| Expr TOK_MOD_OP ParenFunctionCallExpr
	| Expr TOK_MOD_OP BinaryOpPrePost
	| Expr TOK_MOD_OP BinaryOpSelfAssign
	| BinaryOpPrePost TOK_MOD_OP Expr
	| BinaryOpSelfAssign TOK_MOD_OP Expr
	| Expr TOK_XOR_OP Expr
	| Expr TOK_XOR_OP ParenFunctionCallExpr
	| Expr TOK_XOR_OP BinaryOpPrePost
	| BinaryOpPrePost TOK_XOR_OP Expr
	| Expr TOK_XOR_OP BinaryOpSelfAssign
	| BinaryOpSelfAssign TOK_XOR_OP Expr
	| Expr '|' Expr
	| Expr '|' ParenFunctionCallExpr
	| Expr '|' BinaryOpPrePost
	| BinaryOpPrePost '|' Expr
	| Expr '|' BinaryOpSelfAssign
	| BinaryOpSelfAssign '|' Expr
	| Expr '&' Expr
	| Expr '&' ParenFunctionCallExpr
	| Expr '&' BinaryOpPrePost
	| BinaryOpPrePost '&' Expr
	| Expr '&' BinaryOpSelfAssign
	| BinaryOpSelfAssign '&' Expr
	| Expr TOK_LT_OP Expr
	| Expr TOK_LT_OP ParenFunctionCallExpr
	| Expr TOK_LT_OP BinaryOpPrePost
	| BinaryOpPrePost TOK_LT_OP Expr
	| Expr TOK_LT_OP BinaryOpSelfAssign
	| BinaryOpSelfAssign TOK_LT_OP Expr
	| Expr TOK_GT_OP Expr
	| Expr TOK_GT_OP ParenFunctionCallExpr
	| Expr TOK_GT_OP BinaryOpPrePost
	| BinaryOpPrePost TOK_GT_OP Expr
	| Expr TOK_GT_OP BinaryOpSelfAssign
	| BinaryOpSelfAssign TOK_GT_OP Expr
	| Expr TOK_LE_OP Expr
	| Expr TOK_LE_OP ParenFunctionCallExpr
	| Expr TOK_LE_OP BinaryOpPrePost
	| BinaryOpPrePost TOK_LE_OP Expr
	| Expr TOK_LE_OP BinaryOpSelfAssign
	| BinaryOpSelfAssign TOK_LE_OP Expr
	| Expr TOK_GE_OP Expr
	| Expr TOK_GE_OP ParenFunctionCallExpr
	| Expr TOK_GE_OP BinaryOpPrePost
	| BinaryOpPrePost TOK_GE_OP Expr
	| Expr TOK_GE_OP BinaryOpSelfAssign
	| BinaryOpSelfAssign TOK_GE_OP Expr
	| Expr TOK_OR_OP Expr
	| Expr TOK_OR_OP ParenFunctionCallExpr
	| Expr TOK_OR_OP BinaryOpPrePost
	| BinaryOpPrePost TOK_OR_OP Expr
	| Expr TOK_OR_OP BinaryOpSelfAssign
	| BinaryOpSelfAssign TOK_OR_OP Expr
	| Expr TOK_AND_OP Expr
	| Expr TOK_AND_OP ParenFunctionCallExpr
	| Expr TOK_AND_OP BinaryOpPrePost
	| BinaryOpPrePost TOK_AND_OP Expr
	| Expr TOK_AND_OP BinaryOpSelfAssign
	| BinaryOpSelfAssign TOK_AND_OP Expr
	| Expr TOK_EQ_OP Expr
	| Expr TOK_EQ_OP ParenFunctionCallExpr
	| Expr TOK_EQ_OP BinaryOpPrePost
	| BinaryOpPrePost TOK_EQ_OP Expr
	| Expr TOK_EQ_OP BinaryOpSelfAssign
	| BinaryOpSelfAssign TOK_EQ_OP Expr
	| Expr TOK_NE_OP Expr
	| Expr TOK_NE_OP ParenFunctionCallExpr
	| Expr TOK_NE_OP BinaryOpPrePost
	| BinaryOpPrePost TOK_NE_OP Expr
	| Expr TOK_NE_OP BinaryOpSelfAssign
	| BinaryOpSelfAssign TOK_NE_OP Expr
	| Expr TOK_LEFT_SHIFT_OP Expr
	| Expr TOK_LEFT_SHIFT_OP ParenFunctionCallExpr
	| Expr TOK_LEFT_SHIFT_OP BinaryOpPrePost
	| BinaryOpPrePost TOK_LEFT_SHIFT_OP Expr
	| Expr TOK_LEFT_SHIFT_OP BinaryOpSelfAssign
	| BinaryOpSelfAssign TOK_LEFT_SHIFT_OP Expr
	| Expr TOK_RIGHT_SHIFT_OP Expr
	| Expr TOK_RIGHT_SHIFT_OP ParenFunctionCallExpr
	| Expr TOK_RIGHT_SHIFT_OP BinaryOpPrePost
	| BinaryOpPrePost TOK_RIGHT_SHIFT_OP Expr
	| Expr TOK_RIGHT_SHIFT_OP BinaryOpSelfAssign
	| BinaryOpSelfAssign TOK_RIGHT_SHIFT_OP Expr
	| Expr TOK_ASSOCIATION_OP Expr
	| Expr TOK_ASSOCIATION_OP ParenFunctionCallExpr

BinaryOpExpr::=
	  BinaryOp
	| BinaryOpAssign
	| BinaryOpSelfAssign
	| BinaryOpPrePost
	| ArithPowExpr

BinaryOpStmt::=
	  BinaryOpAssign TOK_SEMICOLON
	| BinaryOpSelfAssign TOK_SEMICOLON
	| BinaryOpPrePost TOK_SEMICOLON

Barrier::=
	  TOK_BARRIER IdentifierList TOK_SEMICOLON
	| TOK_BARRIER TOK_SEMICOLON

Reset::=
	  TOK_RESET Identifier TOK_SEMICOLON

Measure::=
	  MeasureDecl TOK_SEMICOLON
	| Identifier TOK_EQUAL_ASSIGN TOK_MEASURE Identifier TOK_SEMICOLON
	| TOK_IDENTIFIER TOK_LEFT_BRACKET Integer ':' Integer TOK_RIGHT_BRACKET TOK_EQUAL_ASSIGN TOK_MEASURE TOK_IDENTIFIER TOK_LEFT_BRACKET Integer ':' Integer TOK_RIGHT_BRACKET TOK_SEMICOLON
	| TOK_MEASURE Identifier TOK_SEMICOLON

MeasureDecl::=
	  TOK_MEASURE Identifier TOK_RIGHT_ARROW Identifier
	| TOK_MEASURE Identifier TOK_RIGHT_ARROW TOK_BIT
	| TOK_MEASURE TOK_IDENTIFIER TOK_LEFT_BRACKET Integer ':' Integer TOK_RIGHT_BRACKET TOK_RIGHT_ARROW TOK_IDENTIFIER TOK_LEFT_BRACKET Integer ':' Integer TOK_RIGHT_BRACKET
	| TOK_MEASURE Identifier TOK_RIGHT_ARROW TOK_BIT TOK_LEFT_BRACKET TOK_INTEGER_CONSTANT TOK_RIGHT_BRACKET

DefcalDecl::=
	  TOK_DEFCAL Identifier TOK_LEFT_PAREN ExprList TOK_RIGHT_PAREN QubitList TOK_LEFT_CURLY DefcalStmtList TOK_RIGHT_CURLY
	| TOK_DEFCAL Identifier QubitList TOK_LEFT_CURLY DefcalStmtList TOK_RIGHT_CURLY
	| TOK_DEFCAL String Identifier TOK_LEFT_PAREN ExprList TOK_RIGHT_PAREN QubitList TOK_LEFT_CURLY DefcalStmtList TOK_RIGHT_CURLY
	| TOK_DEFCAL String Identifier QubitList TOK_LEFT_CURLY DefcalStmtList TOK_RIGHT_CURLY
	| TOK_DEFCAL MeasureDecl TOK_LEFT_CURLY DefcalStmtList TOK_RIGHT_CURLY
	| TOK_DEFCAL String MeasureDecl TOK_LEFT_CURLY DefcalStmtList TOK_RIGHT_CURLY
	| TOK_DEFCAL TOK_RESET Identifier TOK_LEFT_CURLY DefcalStmtList TOK_RIGHT_CURLY
	| TOK_DEFCAL String TOK_RESET Identifier TOK_LEFT_CURLY DefcalStmtList TOK_RIGHT_CURLY
	| TOK_DEFCAL TOK_DELAY TOK_LEFT_BRACKET TimeUnit TOK_RIGHT_BRACKET QubitList TOK_LEFT_CURLY DefcalStmtList TOK_RIGHT_CURLY
	| TOK_DEFCAL String TOK_DELAY TOK_LEFT_BRACKET TimeUnit TOK_RIGHT_BRACKET QubitList TOK_LEFT_CURLY DefcalStmtList TOK_RIGHT_CURLY
	| TOK_DEFCAL TOK_DELAY TOK_LEFT_BRACKET DurationOfDecl TOK_RIGHT_BRACKET QubitList TOK_LEFT_CURLY DefcalStmtList TOK_RIGHT_CURLY
	| TOK_DEFCAL TOK_DELAY TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET QubitList TOK_LEFT_CURLY DefcalStmtList TOK_RIGHT_CURLY
	| TOK_DEFCAL String TOK_DELAY TOK_LEFT_BRACKET DurationOfDecl TOK_RIGHT_BRACKET QubitList TOK_LEFT_CURLY DefcalStmtList TOK_RIGHT_CURLY
	| TOK_DEFCAL String TOK_DELAY TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET QubitList TOK_LEFT_CURLY DefcalStmtList TOK_RIGHT_CURLY

DefcalGrammarDecl::=
	  TOK_DEFCAL_GRAMMAR String TOK_SEMICOLON

DurationOfDecl::=
	  TOK_DURATIONOF TOK_LEFT_PAREN Identifier TOK_RIGHT_PAREN
	| TOK_DURATIONOF TOK_LEFT_PAREN TOK_LEFT_CURLY GateEOp TOK_SEMICOLON TOK_RIGHT_CURLY TOK_RIGHT_PAREN

DurationDecl::=
	  TOK_DURATION Identifier TOK_EQUAL_ASSIGN TimeUnit
	| TOK_DURATION Identifier TOK_EQUAL_ASSIGN DurationOfDecl
	| TOK_DURATION TOK_LEFT_BRACKET TimeUnit TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN Identifier
	| TOK_DURATION Identifier TOK_EQUAL_ASSIGN Identifier
	| TOK_DURATION Identifier TOK_EQUAL_ASSIGN BinaryOp
	| TOK_DURATION Identifier TOK_EQUAL_ASSIGN FunctionCallStmt

ImplicitDuration::=
	  TimeUnit

IfStmt::=
	  TOK_IF TOK_LEFT_PAREN Expr TOK_RIGHT_PAREN Statement
	| TOK_IF TOK_LEFT_PAREN Expr TOK_RIGHT_PAREN TOK_LEFT_CURLY IfStmtList TOK_RIGHT_CURLY

ElseIfStmt::=
	  TOK_ELSEIF TOK_LEFT_PAREN Expr TOK_RIGHT_PAREN Statement
	| TOK_ELSEIF TOK_LEFT_PAREN Expr TOK_RIGHT_PAREN TOK_LEFT_CURLY ElseIfStmtList TOK_RIGHT_CURLY

ElseStmt::=
	  TOK_ELSE Statement
	| TOK_ELSE TOK_LEFT_CURLY ElseStmtList TOK_RIGHT_CURLY

ForStmt::=
	  TOK_FOR Identifier TOK_IN TOK_LEFT_BRACKET IntegerList TOK_RIGHT_BRACKET TOK_LEFT_CURLY ForStmtList TOK_RIGHT_CURLY
	| TOK_FOR Identifier TOK_IN TOK_LEFT_BRACKET IntegerList TOK_RIGHT_BRACKET Statement
	| TOK_FOR Identifier TOK_IN TOK_LEFT_CURLY IntegerList TOK_RIGHT_CURLY Statement
	| TOK_FOR Identifier TOK_IN TOK_LEFT_CURLY IntegerList TOK_RIGHT_CURLY TOK_LEFT_CURLY ForStmtList TOK_RIGHT_CURLY
	| TOK_FOR Identifier TOK_IN TOK_LEFT_BRACKET ForLoopRangeExpr TOK_RIGHT_BRACKET TOK_LEFT_CURLY ForStmtList TOK_RIGHT_CURLY
	| TOK_FOR Identifier TOK_IN TOK_LEFT_BRACKET ForLoopRangeExpr TOK_RIGHT_BRACKET Statement
	| TOK_FOR IntScalarType Identifier TOK_IN TOK_LEFT_BRACKET IntegerList TOK_RIGHT_BRACKET TOK_LEFT_CURLY ForStmtList TOK_RIGHT_CURLY
	| TOK_FOR IntScalarType Identifier TOK_IN TOK_LEFT_BRACKET IntegerList TOK_RIGHT_BRACKET Statement
	| TOK_FOR IntScalarType Identifier TOK_IN TOK_LEFT_CURLY IntegerList TOK_RIGHT_CURLY TOK_LEFT_CURLY ForStmtList TOK_RIGHT_CURLY
	| TOK_FOR IntScalarType Identifier TOK_IN TOK_LEFT_CURLY IntegerList TOK_RIGHT_CURLY Statement
	| TOK_FOR IntScalarType Identifier TOK_IN TOK_LEFT_BRACKET ForLoopRangeExpr TOK_RIGHT_BRACKET TOK_LEFT_CURLY ForStmtList TOK_RIGHT_CURLY
	| TOK_FOR IntScalarType Identifier TOK_IN TOK_LEFT_BRACKET ForLoopRangeExpr TOK_RIGHT_BRACKET Statement

KernelDecl::=
	  TOK_EXTERN Identifier TOK_LEFT_PAREN NamedTypeDeclList TOK_RIGHT_PAREN FuncResult TOK_SEMICOLON
	| TOK_EXTERN Identifier TOK_LEFT_PAREN NamedTypeDeclList TOK_RIGHT_PAREN TOK_SEMICOLON
	| TOK_EXTERN Identifier TOK_LEFT_PAREN TOK_RIGHT_PAREN TOK_SEMICOLON
	| TOK_EXTERN Identifier TOK_LEFT_PAREN TOK_RIGHT_PAREN FuncResult TOK_SEMICOLON
	| TOK_EXTERN Identifier FuncResult TOK_SEMICOLON
	| TOK_EXTERN Identifier TOK_LEFT_PAREN NamedTypeDeclList TOK_RIGHT_PAREN FuncResult TOK_LEFT_CURLY KernelStmtList TOK_RIGHT_CURLY

WhileStmt::=
	  TOK_WHILE TOK_LEFT_PAREN Expr TOK_RIGHT_PAREN TOK_LEFT_CURLY WhileStmtList TOK_RIGHT_CURLY

DoWhileStmt::=
	  TOK_DO TOK_LEFT_CURLY DoWhileStmtList TOK_RIGHT_CURLY TOK_WHILE TOK_LEFT_PAREN Expr TOK_RIGHT_PAREN TOK_SEMICOLON

SwitchScopedStatement::=
	  IfStmt
	| ElseIfStmt
	| ElseStmt
	| ForStmt
	| ContinueStmt
	| WhileStmt
	| DoWhileStmt
	| SwitchStmt
	| ReturnStmt
	| FunctionCallStmt
	| BinaryOpStmt
	| Decl
	| Barrier
	| DelayStmt
	| StretchStmt
	| BoxStmt
	| GateQOp
	| RotateOpStmt
	| PopcountOpStmt
	| IncludeStmt
	| LineDirective
	| FileDirective
	| Newline

SwitchUnscopedStatement::=
	  IfStmt
	| ElseIfStmt
	| ElseStmt
	| ForStmt
	| ContinueStmt
	| WhileStmt
	| DoWhileStmt
	| SwitchStmt
	| ReturnStmt
	| FunctionCallStmt
	| BinaryOpStmt
	| Decl
	| Barrier
	| DelayStmt
	| StretchStmt
	| BoxStmt
	| GateQOp
	| RotateOpStmt
	| PopcountOpStmt
	| IncludeStmt
	| LineDirective
	| FileDirective
	| Newline

SwitchScopedStmtList::=
	  SwitchScopedStmtListImpl

SwitchScopedStmtListImpl::=
	  /*%empty*/
	| SwitchScopedStmtListImpl SwitchScopedStatement

SwitchUnscopedStmtList::=
	  SwitchUnscopedStmtListImpl

SwitchUnscopedStmtListImpl::=
	  /*%empty*/
	| SwitchUnscopedStmtListImpl SwitchUnscopedStatement

SwitchStmt::=
	  TOK_SWITCH TOK_LEFT_PAREN Integer TOK_RIGHT_PAREN TOK_LEFT_CURLY SwitchStmtList TOK_RIGHT_CURLY
	| TOK_SWITCH TOK_LEFT_PAREN BinaryOp TOK_RIGHT_PAREN TOK_LEFT_CURLY SwitchStmtList TOK_RIGHT_CURLY
	| TOK_SWITCH TOK_LEFT_PAREN UnaryOp TOK_RIGHT_PAREN TOK_LEFT_CURLY SwitchStmtList TOK_RIGHT_CURLY
	| TOK_SWITCH TOK_LEFT_PAREN Identifier TOK_RIGHT_PAREN TOK_LEFT_CURLY SwitchStmtList TOK_RIGHT_CURLY
	| TOK_SWITCH TOK_LEFT_PAREN ParenFunctionCallExpr TOK_RIGHT_PAREN TOK_LEFT_CURLY SwitchStmtList TOK_RIGHT_CURLY

ReturnStmt::=
	  TOK_RETURN Expr TOK_SEMICOLON
	| TOK_RETURN BinaryOpAssign TOK_SEMICOLON
	| TOK_RETURN BinaryOpSelfAssign TOK_SEMICOLON
	| TOK_RETURN BinaryOpPrePost TOK_SEMICOLON
	| TOK_RETURN FunctionCallStmt
	| TOK_RETURN Measure
	| TOK_RETURN TOK_SEMICOLON
	| TOK_RETURN TOK_BOOLEAN_CONSTANT TOK_SEMICOLON

BreakStmt::=
	  TOK_BREAK TOK_SEMICOLON

ContinueStmt::=
	  TOK_CONTINUE TOK_SEMICOLON

GateOpList::=
	  /*%empty*/
	| GateOpList GateUOp
	| GateOpList Barrier
	| GateOpList Measure
	| GateOpList GPhaseStmt
	| GateOpList GateCtrlExpr
	| GateOpList GateCtrlStmt
	| GateOpList GateNegCtrlExpr
	| GateOpList GateNegCtrlStmt
	| GateOpList GateInvExpr
	| GateOpList GateInvStmt
	| GateOpList GatePowExpr
	| GateOpList GatePowStmt
	| GateOpList GateGPhaseExpr
	| GateOpList GateGPhaseStmt
	| GateOpList GPhaseExpr
	| GateOpList LineDirective
	| GateOpList FileDirective

GateQOp::=
	  GateUOp
	| Measure
	| Reset
	| GPhaseStmt

GateEOp::=
	  Identifier ArgsList AnyList
	| TOK_U ArgsList AnyList
	| TOK_CX IdentifierList
	| TOK_CCX ArgsList AnyList
	| TOK_CNOT ArgsList AnyList
	| TOK_HADAMARD ArgsList AnyList

GateUOp::=
	  GateEOp TOK_SEMICOLON

ArgsList::=
	  /*%empty*/
	| TOK_LEFT_PAREN ExprList TOK_RIGHT_PAREN

IdentifierList::=
	  IdentifierListImpl Identifier

IdentifierListImpl::=
	  /*%empty*/
	| IdentifierListImpl Identifier TOK_COMMA

StringList::=
	  StringListImpl String
	| StringListImpl TOK_ANNOTATION

StringListImpl::=
	  /*%empty*/
	| StringListImpl TOK_IDENTIFIER
	| StringListImpl TOK_INTEGER_CONSTANT
	| StringListImpl TOK_FP_CONSTANT
	| StringListImpl TOK_LEFT_PAREN
	| StringListImpl TOK_RIGHT_PAREN
	| StringListImpl TOK_LEFT_BRACKET
	| StringListImpl TOK_RIGHT_BRACKET
	| StringListImpl TOK_LEFT_CURLY
	| StringListImpl TOK_RIGHT_CURLY
	| StringListImpl TOK_COMMA
	| StringListImpl ':'

GateQubitParamList::=
	  GateQubitParamListImpl Identifier

GateQubitParamListImpl::=
	  /*%empty*/
	| GateQubitParamListImpl Identifier TOK_COMMA
	| GateQubitParamListImpl Identifier

AnyList::=
	  AnyListImpl Identifier

AnyListImpl::=
	  /*%empty*/
	| AnyListImpl Identifier TOK_COMMA
	| AnyListImpl LineDirective
	| AnyListImpl FileDirective

FunctionCallArgExprList::=
	  /*%empty*/
	| FunctionCallArgExprListImpl Expr

FunctionCallArgExprListImpl::=
	  /*%empty*/
	| FunctionCallArgExprListImpl Expr TOK_COMMA

FunctionCallArg::=
	  Identifier TOK_LEFT_PAREN FunctionCallArgExprList TOK_RIGHT_PAREN

ExprList::=
	  /*%empty*/
	| ExprListImpl Expr
	| ExprListImpl BinaryOpAssign
	| ExprListImpl TOK_LEFT_PAREN BinaryOpAssign TOK_RIGHT_PAREN
	| ExprListImpl BinaryOpSelfAssign
	| ExprListImpl TOK_LEFT_PAREN BinaryOpSelfAssign TOK_RIGHT_PAREN
	| ExprListImpl BinaryOpPrePost
	| ExprListImpl TOK_LEFT_PAREN BinaryOpPrePost TOK_RIGHT_PAREN
	| ExprListImpl ComplexInitializerExpr
	| ExprListImpl FunctionCallArg
	| ExprListImpl ImplicitDuration
	| ExprListImpl LineDirective
	| ExprListImpl FileDirective

ExprListImpl::=
	  /*%empty*/
	| ExprListImpl Expr TOK_COMMA
	| ExprListImpl BinaryOpAssign TOK_COMMA
	| ExprListImpl TOK_LEFT_PAREN BinaryOpAssign TOK_RIGHT_PAREN TOK_COMMA
	| ExprListImpl BinaryOpSelfAssign TOK_COMMA
	| ExprListImpl TOK_LEFT_PAREN BinaryOpSelfAssign TOK_RIGHT_PAREN TOK_COMMA
	| ExprListImpl BinaryOpPrePost TOK_COMMA
	| ExprListImpl TOK_LEFT_PAREN BinaryOpPrePost TOK_RIGHT_PAREN TOK_COMMA
	| ExprListImpl Expr ':'
	| ExprListImpl ComplexInitializerExpr
	| ExprListImpl ComplexInitializerExpr TOK_COMMA
	| ExprListImpl FunctionCallArg
	| ExprListImpl FunctionCallArg TOK_COMMA
	| ExprListImpl ImplicitDuration
	| ExprListImpl ImplicitDuration TOK_COMMA

Expr::=
	  Real
	| Integer
	| String
	| Identifier
	| UnaryOp
	| BinaryOp
	| ArithPowExpr
	| TOK_LEFT_PAREN Expr TOK_RIGHT_PAREN
	| LogicalNotExpr
	| CastExpr
	| TOK_MINUS Identifier
	| TOK_ADD_OP Identifier
	| TOK_MINUS TOK_LEFT_PAREN BinaryOpSelfAssign TOK_RIGHT_PAREN
	| TOK_MINUS TOK_LEFT_PAREN BinaryOpAssign TOK_RIGHT_PAREN
	| TOK_MINUS TOK_LEFT_PAREN BinaryOpPrePost TOK_RIGHT_PAREN
	| TOK_ADD_OP TOK_LEFT_PAREN BinaryOpSelfAssign TOK_RIGHT_PAREN
	| TOK_ADD_OP TOK_LEFT_PAREN BinaryOpAssign TOK_RIGHT_PAREN
	| TOK_ADD_OP TOK_LEFT_PAREN BinaryOpPrePost TOK_RIGHT_PAREN
	| TOK_MINUS UnaryOp
	| TOK_ADD_OP UnaryOp
	| TOK_MINUS TOK_LEFT_PAREN Expr TOK_RIGHT_PAREN
	| TOK_ADD_OP TOK_LEFT_PAREN Expr TOK_RIGHT_PAREN
	| TOK_MINUS FunctionCallExpr
	| TOK_ADD_OP FunctionCallExpr
	| TOK_MINUS TOK_LEFT_PAREN FunctionCallExpr TOK_RIGHT_PAREN
	| TOK_ADD_OP TOK_LEFT_PAREN FunctionCallExpr TOK_RIGHT_PAREN

InitExpressionNode::=
	  TOK_LEFT_CURLY Real TOK_RIGHT_CURLY
	| Real
	| TOK_LEFT_CURLY Integer TOK_RIGHT_CURLY
	| Integer
	| TOK_LEFT_CURLY String TOK_RIGHT_CURLY
	| String
	| TOK_LEFT_CURLY MPIntegerType TOK_RIGHT_CURLY
	| MPIntegerType
	| TOK_LEFT_CURLY MPDecimalType TOK_RIGHT_CURLY
	| MPDecimalType
	| TOK_LEFT_CURLY MPComplexType TOK_RIGHT_CURLY
	| MPComplexType
	| TOK_LEFT_CURLY ComplexInitializerExpr TOK_RIGHT_CURLY
	| ComplexInitializerExpr
	| TOK_LEFT_CURLY CastExpr TOK_RIGHT_CURLY
	| CastExpr
	| TOK_LEFT_CURLY BinaryOpExpr TOK_RIGHT_CURLY
	| BinaryOpExpr
	| TOK_LEFT_CURLY UnaryOp TOK_RIGHT_CURLY
	| UnaryOp

LogicalNotExpr::=
	  TOK_BANG TOK_LEFT_PAREN Expr TOK_RIGHT_PAREN
	| TOK_BANG Identifier
	| TOK_BANG UnaryOp
	| TOK_BANG BinaryOpPrePost
	| TOK_BANG TOK_LEFT_PAREN BinaryOpPrePost TOK_RIGHT_PAREN
	| TOK_BANG TOK_LEFT_PAREN BinaryOpSelfAssign TOK_RIGHT_PAREN
	| TOK_BANG TOK_LEFT_PAREN BinaryOpAssign TOK_RIGHT_PAREN
	| TOK_BANG LogicalNotExpr
	| TOK_BANG ArithPowExpr
	| TOK_BANG FunctionCallExpr
	| TOK_BANG TOK_LEFT_PAREN FunctionCallExpr TOK_RIGHT_PAREN

PopcountOpExpr::=
	  TOK_POPCOUNT TOK_LEFT_PAREN Integer TOK_RIGHT_PAREN
	| TOK_POPCOUNT TOK_LEFT_PAREN Identifier TOK_RIGHT_PAREN

PopcountOpStmt::=
	  PopcountOpExpr TOK_SEMICOLON

RotateOpExpr::=
	  TOK_ROTL TOK_LEFT_PAREN Identifier TOK_COMMA Integer TOK_RIGHT_PAREN
	| TOK_ROTL TOK_LEFT_PAREN Identifier TOK_COMMA Identifier TOK_RIGHT_PAREN
	| TOK_ROTR TOK_LEFT_PAREN Identifier TOK_COMMA Integer TOK_RIGHT_PAREN
	| TOK_ROTR TOK_LEFT_PAREN Identifier TOK_COMMA Identifier TOK_RIGHT_PAREN

RotateOpStmt::=
	  RotateOpExpr TOK_SEMICOLON

UnaryOp::=
	  TOK_SIN TOK_LEFT_PAREN Identifier TOK_RIGHT_PAREN
	| TOK_SIN TOK_LEFT_PAREN BinaryOpExpr TOK_RIGHT_PAREN
	| TOK_SIN TOK_LEFT_PAREN UnaryOp TOK_RIGHT_PAREN
	| TOK_SIN TOK_LEFT_PAREN Integer TOK_RIGHT_PAREN
	| TOK_SIN TOK_LEFT_PAREN Real TOK_RIGHT_PAREN
	| TOK_COS TOK_LEFT_PAREN Identifier TOK_RIGHT_PAREN
	| TOK_COS TOK_LEFT_PAREN BinaryOpExpr TOK_RIGHT_PAREN
	| TOK_COS TOK_LEFT_PAREN UnaryOp TOK_RIGHT_PAREN
	| TOK_COS TOK_LEFT_PAREN Integer TOK_RIGHT_PAREN
	| TOK_COS TOK_LEFT_PAREN Real TOK_RIGHT_PAREN
	| TOK_TAN TOK_LEFT_PAREN Identifier TOK_RIGHT_PAREN
	| TOK_TAN TOK_LEFT_PAREN BinaryOpExpr TOK_RIGHT_PAREN
	| TOK_TAN TOK_LEFT_PAREN UnaryOp TOK_RIGHT_PAREN
	| TOK_TAN TOK_LEFT_PAREN Integer TOK_RIGHT_PAREN
	| TOK_TAN TOK_LEFT_PAREN Real TOK_RIGHT_PAREN
	| TOK_ARCSIN TOK_LEFT_PAREN Identifier TOK_RIGHT_PAREN
	| TOK_ARCSIN TOK_LEFT_PAREN Integer TOK_RIGHT_PAREN
	| TOK_ARCSIN TOK_LEFT_PAREN Real TOK_RIGHT_PAREN
	| TOK_ARCSIN TOK_LEFT_PAREN BinaryOpExpr TOK_RIGHT_PAREN
	| TOK_ARCSIN TOK_LEFT_PAREN UnaryOp TOK_RIGHT_PAREN
	| TOK_ARCCOS TOK_LEFT_PAREN Identifier TOK_RIGHT_PAREN
	| TOK_ARCCOS TOK_LEFT_PAREN Integer TOK_RIGHT_PAREN
	| TOK_ARCCOS TOK_LEFT_PAREN Real TOK_RIGHT_PAREN
	| TOK_ARCCOS TOK_LEFT_PAREN BinaryOpExpr TOK_RIGHT_PAREN
	| TOK_ARCCOS TOK_LEFT_PAREN UnaryOp TOK_RIGHT_PAREN
	| TOK_ARCTAN TOK_LEFT_PAREN Identifier TOK_RIGHT_PAREN
	| TOK_ARCTAN TOK_LEFT_PAREN Integer TOK_RIGHT_PAREN
	| TOK_ARCTAN TOK_LEFT_PAREN Real TOK_RIGHT_PAREN
	| TOK_ARCTAN TOK_LEFT_PAREN BinaryOpExpr TOK_RIGHT_PAREN
	| TOK_ARCTAN TOK_LEFT_PAREN UnaryOp TOK_RIGHT_PAREN
	| TOK_EXP TOK_LEFT_PAREN Identifier TOK_RIGHT_PAREN
	| TOK_EXP TOK_LEFT_PAREN BinaryOpExpr TOK_RIGHT_PAREN
	| TOK_EXP TOK_LEFT_PAREN UnaryOp TOK_RIGHT_PAREN
	| TOK_EXP TOK_LEFT_PAREN Integer TOK_RIGHT_PAREN
	| TOK_EXP TOK_LEFT_PAREN Real TOK_RIGHT_PAREN
	| TOK_LN TOK_LEFT_PAREN Identifier TOK_RIGHT_PAREN
	| TOK_LN TOK_LEFT_PAREN BinaryOpExpr TOK_RIGHT_PAREN
	| TOK_LN TOK_LEFT_PAREN UnaryOp TOK_RIGHT_PAREN
	| TOK_LN TOK_LEFT_PAREN Integer TOK_RIGHT_PAREN
	| TOK_LN TOK_LEFT_PAREN Real TOK_RIGHT_PAREN
	| TOK_SQRT TOK_LEFT_PAREN Identifier TOK_RIGHT_PAREN
	| TOK_SQRT TOK_LEFT_PAREN BinaryOpExpr TOK_RIGHT_PAREN
	| TOK_SQRT TOK_LEFT_PAREN UnaryOp TOK_RIGHT_PAREN
	| TOK_SQRT TOK_LEFT_PAREN Integer TOK_RIGHT_PAREN
	| TOK_SQRT TOK_LEFT_PAREN Real TOK_RIGHT_PAREN
	| TOK_TILDE Expr

ArithPowExpr::=
	  TOK_POW TOK_LEFT_PAREN Integer TOK_COMMA Integer TOK_RIGHT_PAREN
	| TOK_POW TOK_LEFT_PAREN Integer TOK_COMMA Real TOK_RIGHT_PAREN
	| TOK_POW TOK_LEFT_PAREN Real TOK_COMMA Integer TOK_RIGHT_PAREN
	| TOK_POW TOK_LEFT_PAREN Real TOK_COMMA Real TOK_RIGHT_PAREN
	| TOK_POW TOK_LEFT_PAREN Identifier TOK_COMMA Integer TOK_RIGHT_PAREN
	| TOK_POW TOK_LEFT_PAREN Identifier TOK_COMMA Real TOK_RIGHT_PAREN
	| TOK_POW TOK_LEFT_PAREN Integer TOK_COMMA Identifier TOK_RIGHT_PAREN
	| TOK_POW TOK_LEFT_PAREN Real TOK_COMMA Identifier TOK_RIGHT_PAREN
	| TOK_POW TOK_LEFT_PAREN Identifier TOK_COMMA Identifier TOK_RIGHT_PAREN
	| TOK_POW TOK_LEFT_PAREN Integer TOK_COMMA BinaryOpExpr TOK_RIGHT_PAREN
	| TOK_POW TOK_LEFT_PAREN Real TOK_COMMA BinaryOpExpr TOK_RIGHT_PAREN
	| TOK_POW TOK_LEFT_PAREN Identifier TOK_COMMA BinaryOpExpr TOK_RIGHT_PAREN
	| TOK_POW TOK_LEFT_PAREN Integer TOK_COMMA UnaryOp TOK_RIGHT_PAREN
	| TOK_POW TOK_LEFT_PAREN Real TOK_COMMA UnaryOp TOK_RIGHT_PAREN
	| TOK_POW TOK_LEFT_PAREN Identifier TOK_COMMA UnaryOp TOK_RIGHT_PAREN
	| TOK_POW TOK_LEFT_PAREN BinaryOpExpr TOK_COMMA Integer TOK_RIGHT_PAREN
	| TOK_POW TOK_LEFT_PAREN BinaryOpExpr TOK_COMMA Real TOK_RIGHT_PAREN
	| TOK_POW TOK_LEFT_PAREN BinaryOpExpr TOK_COMMA Identifier TOK_RIGHT_PAREN
	| TOK_POW TOK_LEFT_PAREN UnaryOp TOK_COMMA Integer TOK_RIGHT_PAREN
	| TOK_POW TOK_LEFT_PAREN UnaryOp TOK_COMMA Real TOK_RIGHT_PAREN
	| TOK_POW TOK_LEFT_PAREN UnaryOp TOK_COMMA Identifier TOK_RIGHT_PAREN
	| TOK_POW TOK_LEFT_PAREN BinaryOpExpr TOK_COMMA UnaryOp TOK_RIGHT_PAREN
	| TOK_POW TOK_LEFT_PAREN UnaryOp TOK_COMMA BinaryOpExpr TOK_RIGHT_PAREN
	| TOK_POW TOK_LEFT_PAREN BinaryOpExpr TOK_COMMA BinaryOpExpr TOK_RIGHT_PAREN
	| TOK_POW TOK_LEFT_PAREN UnaryOp TOK_COMMA UnaryOp TOK_RIGHT_PAREN

Identifier::=
	  TOK_IDENTIFIER
	| UnboundQubit
	| BoundQubit
	| ComplexCReal
	| ComplexCImag
	| OpenPulseFramePhase
	| OpenPulseFrameFrequency
	| OpenPulseFrameTime
	| TOK_IDENTIFIER IndexedSubscriptExpr IndexedSubscriptList
	| BoundQubit IndexedSubscriptExpr IndexedSubscriptList
	| UnboundQubit IndexedSubscriptExpr IndexedSubscriptList
	| TOK_IDENTIFIER TOK_LEFT_BRACKET TimeUnit TOK_RIGHT_BRACKET

Integer::=
	  TOK_INTEGER_CONSTANT

IntegerList::=
	  IntegerListImpl

IntegerListImpl::=
	  /*%empty*/
	| IntegerListImpl Integer
	| IntegerListImpl Integer TOK_COMMA
	| IntegerListImpl Integer ':'
	| IntegerListImpl LineDirective
	| IntegerListImpl FileDirective

QubitConcatList::=
	  QubitConcatListImpl

QubitConcatListImpl::=
	  /*%empty*/
	| QubitConcatListImpl Identifier
	| QubitConcatListImpl Identifier TOK_OR_OP
	| QubitConcatListImpl Identifier TOK_INC_OP

Real::=
	  TOK_FP_CONSTANT

Ellipsis::=
	  TOK_ELLIPSIS

String::=
	  TOK_STRING_LITERAL

TimeUnit::=
	  TOK_TIME_UNIT

BooleanConstant::=
	  TOK_BOOLEAN_CONSTANT

BoundQubit::=
	  TOK_BOUND_QUBIT

IndexedBoundQubit::=
	  TOK_BOUND_QUBIT IndexedSubscriptExpr

UnboundQubit::=
	  TOK_UNBOUND_QUBIT

IndexedUnboundQubit::=
	  TOK_UNBOUND_QUBIT IndexedSubscriptExpr

ComplexCReal::=
	  TOK_IDENTIFIER TOK_PERIOD TOK_CREAL

ComplexCImag::=
	  TOK_IDENTIFIER TOK_PERIOD TOK_CIMAG

OpenPulseFramePhase::=
	  TOK_IDENTIFIER TOK_PHASE

OpenPulseFrameFrequency::=
	  TOK_IDENTIFIER TOK_FREQUENCY

OpenPulseFrameTime::=
	  TOK_IDENTIFIER TOK_TIME

IntScalarType::=
	  TOK_INT
	| TOK_UINT

FloatScalarType::=
	  TOK_FLOAT

MPIntegerType::=
	  TOK_INT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET
	| TOK_INT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET
	| TOK_INT TOK_LEFT_BRACKET BinaryOpExpr TOK_RIGHT_BRACKET
	| TOK_UINT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET
	| TOK_UINT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET
	| TOK_UINT TOK_LEFT_BRACKET BinaryOpExpr TOK_RIGHT_BRACKET

MPDecimalType::=
	  TOK_FLOAT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET
	| TOK_FLOAT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET
	| TOK_FLOAT TOK_LEFT_BRACKET BinaryOpExpr TOK_RIGHT_BRACKET

MPComplexDecl::=
	  TOK_COMPLEX Identifier
	| TOK_COMPLEX TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET Identifier
	| TOK_COMPLEX TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_RIGHT_BRACKET Identifier
	| TOK_COMPLEX TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_RIGHT_BRACKET Identifier
	| TOK_COMPLEX TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN ComplexInitializerExpr
	| TOK_COMPLEX TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN ComplexInitializerExpr
	| TOK_COMPLEX TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN BinaryOp
	| TOK_COMPLEX TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN UnaryOp
	| TOK_COMPLEX TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN ComplexInitializerExpr
	| TOK_COMPLEX TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN BinaryOp
	| TOK_COMPLEX TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN UnaryOp
	| TOK_COMPLEX TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN Identifier
	| TOK_COMPLEX TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN Identifier

MPComplexFunctionCallDecl::=
	  TOK_COMPLEX TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN FunctionCallStmtExpr
	| TOK_COMPLEX TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN FunctionCallStmtExpr

MPComplexType::=
	  TOK_COMPLEX TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_RIGHT_BRACKET
	| TOK_COMPLEX TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_RIGHT_BRACKET

BitType::=
	  TOK_BIT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET
	| TOK_BIT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET
	| TOK_BIT

AngleType::=
	  TOK_ANGLE
	| TOK_ANGLE TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET
	| TOK_ANGLE TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET

QubitType::=
	  TOK_QUBIT
	| TOK_QUBIT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET
	| TOK_QUBIT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET

DurationType::=
	  TOK_DURATION
	| TOK_DURATION TOK_LEFT_BRACKET TimeUnit TOK_RIGHT_BRACKET

ArrayType::=
	  TOK_ARRAY TOK_LEFT_BRACKET TOK_BIT TOK_COMMA Integer TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_BIT TOK_COMMA Integer TOK_COMMA Integer TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_BIT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_COMMA Integer TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_BIT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_COMMA Integer TOK_COMMA Integer TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_QUBIT TOK_COMMA Integer TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_QUBIT TOK_COMMA Integer TOK_COMMA Integer TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_QUBIT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_COMMA Integer TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_QUBIT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_COMMA Integer TOK_COMMA Integer TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_ANGLE TOK_COMMA Integer TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_ANGLE TOK_COMMA Integer TOK_COMMA Integer TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_ANGLE TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_COMMA Integer TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_ANGLE TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_COMMA Integer TOK_COMMA Integer TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_BOOL TOK_COMMA Integer TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_INT TOK_COMMA Integer TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_INT TOK_COMMA Integer TOK_COMMA Integer TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_INT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_COMMA Integer TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_INT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_COMMA Integer TOK_COMMA Integer TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_UINT TOK_COMMA Integer TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_UINT TOK_COMMA Integer TOK_COMMA Integer TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_UINT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_COMMA Integer TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_UINT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_COMMA Integer TOK_COMMA Integer TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_FLOAT TOK_COMMA Integer TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_FLOAT TOK_COMMA Integer TOK_COMMA Integer TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_COMMA Integer TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_COMMA Integer TOK_COMMA Integer TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_DURATION TOK_COMMA Integer TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_DURATION TOK_LEFT_BRACKET TimeUnit TOK_RIGHT_BRACKET TOK_COMMA Integer TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_DURATION TOK_LEFT_BRACKET TimeUnit TOK_RIGHT_BRACKET TOK_COMMA Integer TOK_COMMA Integer TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_BIT TOK_COMMA Identifier TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_BIT TOK_COMMA Identifier TOK_COMMA Identifier TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_BIT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_COMMA Identifier TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_BIT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_COMMA Identifier TOK_COMMA Identifier TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_QUBIT TOK_COMMA Identifier TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_QUBIT TOK_COMMA Identifier TOK_COMMA Identifier TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_QUBIT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_COMMA Identifier TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_QUBIT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_COMMA Identifier TOK_COMMA Identifier TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_ANGLE TOK_COMMA Identifier TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_ANGLE TOK_COMMA Identifier TOK_COMMA Identifier TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_ANGLE TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_COMMA Identifier TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_ANGLE TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_COMMA Identifier TOK_COMMA Identifier TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_BOOL TOK_COMMA Identifier TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_INT TOK_COMMA Identifier TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_INT TOK_COMMA Identifier TOK_COMMA Identifier TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_INT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_COMMA Identifier TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_INT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_COMMA Identifier TOK_COMMA Identifier TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_UINT TOK_COMMA Identifier TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_UINT TOK_COMMA Identifier TOK_COMMA Identifier TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_UINT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_COMMA Identifier TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_UINT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_COMMA Identifier TOK_COMMA Identifier TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_FLOAT TOK_COMMA Identifier TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_FLOAT TOK_COMMA Identifier TOK_COMMA Identifier TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_COMMA Identifier TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_COMMA Identifier TOK_COMMA Identifier TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_DURATION TOK_COMMA Identifier TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_DURATION TOK_LEFT_BRACKET TimeUnit TOK_RIGHT_BRACKET TOK_COMMA Identifier TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_DURATION TOK_LEFT_BRACKET TimeUnit TOK_RIGHT_BRACKET TOK_COMMA Identifier TOK_COMMA Identifier TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_COMPLEX TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_RIGHT_BRACKET TOK_COMMA Integer TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_COMPLEX TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_RIGHT_BRACKET TOK_COMMA Integer TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_COMPLEX TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_RIGHT_BRACKET TOK_COMMA Identifier TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_COMPLEX TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_RIGHT_BRACKET TOK_COMMA Identifier TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_COMPLEX TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_RIGHT_BRACKET TOK_COMMA Integer TOK_COMMA Integer TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_COMPLEX TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_RIGHT_BRACKET TOK_COMMA Integer TOK_COMMA Integer TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_COMPLEX TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_RIGHT_BRACKET TOK_COMMA Identifier TOK_COMMA Integer TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_COMPLEX TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_RIGHT_BRACKET TOK_COMMA Identifier TOK_COMMA Identifier TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_COMPLEX TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_RIGHT_BRACKET TOK_COMMA Identifier TOK_COMMA Integer TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_COMPLEX TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_RIGHT_BRACKET TOK_COMMA Identifier TOK_COMMA Identifier TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_COMPLEX TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_RIGHT_BRACKET TOK_COMMA Integer TOK_COMMA Identifier TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET DurationOfDecl TOK_COMMA Integer TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET DurationOfDecl TOK_COMMA Integer TOK_COMMA Integer TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET DurationOfDecl TOK_COMMA Integer TOK_COMMA Identifier TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET DurationOfDecl TOK_COMMA Identifier TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET DurationOfDecl TOK_COMMA Identifier TOK_COMMA Integer TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET DurationOfDecl TOK_COMMA Identifier TOK_COMMA Identifier TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_FRAME TOK_COMMA Integer TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_FRAME TOK_COMMA Integer TOK_COMMA Integer TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_FRAME TOK_COMMA Identifier TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_FRAME TOK_COMMA Identifier TOK_COMMA Identifier TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_FRAME TOK_COMMA Integer TOK_COMMA Identifier TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_FRAME TOK_COMMA Identifier TOK_COMMA Integer TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_PORT TOK_COMMA Integer TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_PORT TOK_COMMA Integer TOK_COMMA Integer TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_PORT TOK_COMMA Identifier TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_PORT TOK_COMMA Identifier TOK_COMMA Identifier TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_PORT TOK_COMMA Integer TOK_COMMA Identifier TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_PORT TOK_COMMA Identifier TOK_COMMA Integer TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_WAVEFORM TOK_COMMA Integer TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_WAVEFORM TOK_COMMA Integer TOK_COMMA Integer TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_WAVEFORM TOK_COMMA Identifier TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_WAVEFORM TOK_COMMA Identifier TOK_COMMA Identifier TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_WAVEFORM TOK_COMMA Integer TOK_COMMA Identifier TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_WAVEFORM TOK_COMMA Identifier TOK_COMMA Integer TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_GATE TOK_COMMA Integer TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_GATE TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_COMMA Integer TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_GATE TOK_COMMA Identifier TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_GATE TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_COMMA Identifier TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_DEFCAL TOK_COMMA Integer TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_DEFCAL TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_COMMA Integer TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_DEFCAL TOK_COMMA Identifier TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_DEFCAL TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_COMMA Identifier TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_BARRIER TOK_COMMA Integer TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_BARRIER TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_COMMA Integer TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_BARRIER TOK_COMMA Identifier TOK_RIGHT_BRACKET
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_BARRIER TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_COMMA Identifier TOK_RIGHT_BRACKET

ParamTypeDecl::=
	  IntScalarType
	| TOK_CONST IntScalarType
	| FloatScalarType
	| TOK_CONST FloatScalarType
	| MPDecimalType
	| TOK_CONST MPDecimalType
	| MPIntegerType
	| TOK_CONST MPIntegerType
	| MPComplexType
	| TOK_CONST MPComplexType
	| BitType
	| TOK_CONST BitType
	| AngleType
	| TOK_CONST AngleType
	| QubitType
	| TOK_CONST QubitType
	| DurationType
	| TOK_CONST DurationType
	| ArrayType
	| TOK_CONST ArrayType

CastExpr::=
	  TOK_BOOL TOK_LEFT_PAREN Expr TOK_RIGHT_PAREN
	| TOK_INT TOK_LEFT_PAREN Expr TOK_RIGHT_PAREN
	| TOK_UINT TOK_LEFT_PAREN Expr TOK_RIGHT_PAREN
	| TOK_FLOAT TOK_LEFT_PAREN Expr TOK_RIGHT_PAREN
	| TOK_DOUBLE TOK_LEFT_PAREN Expr TOK_RIGHT_PAREN
	| TOK_BIT TOK_LEFT_PAREN Expr TOK_RIGHT_PAREN
	| TOK_BIT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_LEFT_PAREN Expr TOK_RIGHT_PAREN
	| TOK_BIT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_LEFT_PAREN Expr TOK_RIGHT_PAREN
	| TOK_ANGLE TOK_LEFT_PAREN Expr TOK_RIGHT_PAREN
	| TOK_ANGLE TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_LEFT_PAREN Expr TOK_RIGHT_PAREN
	| TOK_ANGLE TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_LEFT_PAREN Expr TOK_RIGHT_PAREN
	| TOK_INT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_LEFT_PAREN Expr TOK_RIGHT_PAREN
	| TOK_INT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_LEFT_PAREN Expr TOK_RIGHT_PAREN
	| TOK_UINT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_LEFT_PAREN Expr TOK_RIGHT_PAREN
	| TOK_UINT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_LEFT_PAREN Expr TOK_RIGHT_PAREN
	| TOK_FLOAT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_LEFT_PAREN Expr TOK_RIGHT_PAREN
	| TOK_FLOAT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_LEFT_PAREN Expr TOK_RIGHT_PAREN
	| TOK_COMPLEX TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_RIGHT_BRACKET TOK_LEFT_PAREN Expr TOK_RIGHT_PAREN
	| TOK_COMPLEX TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_RIGHT_BRACKET TOK_LEFT_PAREN Expr TOK_RIGHT_PAREN

NamedTypeDecl::=
	  TOK_INT Identifier
	| TOK_CONST TOK_INT Identifier
	| TOK_INT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET Identifier
	| TOK_CONST TOK_INT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET Identifier
	| TOK_INT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_CONST TOK_INT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_UINT Identifier
	| TOK_CONST TOK_UINT Identifier
	| TOK_UINT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET Identifier
	| TOK_CONST TOK_UINT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET Identifier
	| TOK_UINT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_CONST TOK_UINT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_FLOAT Identifier
	| TOK_CONST TOK_FLOAT Identifier
	| TOK_FLOAT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET Identifier
	| TOK_CONST TOK_FLOAT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET Identifier
	| TOK_FLOAT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_CONST TOK_FLOAT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_DOUBLE Identifier
	| TOK_CONST TOK_DOUBLE Identifier
	| TOK_DOUBLE TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_CONST TOK_DOUBLE TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_DOUBLE TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET Identifier
	| TOK_CONST TOK_DOUBLE TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET Identifier
	| TOK_COMPLEX TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_RIGHT_BRACKET Identifier
	| TOK_CONST TOK_COMPLEX TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_RIGHT_BRACKET Identifier
	| TOK_COMPLEX TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_RIGHT_BRACKET Identifier
	| TOK_CONST TOK_COMPLEX TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_RIGHT_BRACKET Identifier
	| TOK_DURATION Identifier
	| TOK_CONST TOK_DURATION Identifier
	| TOK_DURATION TOK_LEFT_BRACKET TimeUnit TOK_RIGHT_BRACKET Identifier
	| TOK_CONST TOK_DURATION TOK_LEFT_BRACKET TimeUnit TOK_RIGHT_BRACKET Identifier
	| TOK_BOOL Identifier
	| TOK_CONST TOK_BOOL Identifier
	| TOK_QUBIT Identifier
	| TOK_CONST TOK_QUBIT Identifier
	| TOK_QUBIT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_CONST TOK_QUBIT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_QUBIT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET Identifier
	| TOK_CONST TOK_QUBIT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET Identifier
	| TOK_BIT Identifier
	| TOK_CONST TOK_BIT Identifier
	| TOK_BIT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_CONST TOK_BIT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_BIT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET Identifier
	| TOK_CONST TOK_BIT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ANGLE Identifier
	| TOK_CONST TOK_ANGLE Identifier
	| TOK_ANGLE TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET Identifier
	| TOK_CONST TOK_ANGLE TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ANGLE TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_CONST TOK_ANGLE TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET Identifier
	| Identifier
	| Ellipsis
	| ArrayExpr
	| TOK_CONST ArrayExpr
	| TOK_WAVEFORM Identifier
	| TOK_CONST TOK_WAVEFORM Identifier
	| TOK_FRAME Identifier
	| TOK_CONST TOK_FRAME Identifier
	| TOK_PORT Identifier
	| TOK_CONST TOK_PORT Identifier
	| TOK_EXTERN TOK_PORT Identifier
	| TOK_CONST TOK_EXTERN TOK_PORT Identifier

ArrayExpr::=
	  TOK_ARRAY TOK_LEFT_BRACKET TOK_BIT TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_BIT TOK_COMMA Integer TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_BIT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_BIT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_COMMA Integer TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_QUBIT TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_QUBIT TOK_COMMA Integer TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_QUBIT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_QUBIT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_COMMA Integer TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_ANGLE TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_ANGLE TOK_COMMA Integer TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_ANGLE TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_ANGLE TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_COMMA Integer TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_BOOL TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_BOOL TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_BOOL TOK_COMMA Integer TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_BOOL TOK_COMMA Integer TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_BOOL TOK_COMMA Identifier TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_BOOL TOK_COMMA Identifier TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_INT TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_INT TOK_COMMA Integer TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_INT TOK_COMMA Integer TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_INT TOK_COMMA Identifier TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_INT TOK_COMMA Identifier TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_INT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_INT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_COMMA Integer TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_UINT TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_UINT TOK_COMMA Integer TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_UINT TOK_COMMA Integer TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_UINT TOK_COMMA Identifier TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_UINT TOK_COMMA Identifier TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_UINT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_UINT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_COMMA Integer TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_FLOAT TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_FLOAT TOK_COMMA Integer TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_COMMA Integer TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_DURATION TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_DURATION TOK_LEFT_BRACKET TimeUnit TOK_RIGHT_BRACKET TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_DURATION TOK_LEFT_BRACKET TimeUnit TOK_RIGHT_BRACKET TOK_COMMA Integer TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_BIT TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_BIT TOK_COMMA Identifier TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_BIT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_BIT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_COMMA Identifier TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_QUBIT TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_QUBIT TOK_COMMA Identifier TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_QUBIT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_QUBIT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_COMMA Identifier TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_ANGLE TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_ANGLE TOK_COMMA Identifier TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_ANGLE TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_ANGLE TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_COMMA Identifier TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_INT TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_INT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_INT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_COMMA Identifier TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_UINT TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_UINT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_UINT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_COMMA Identifier TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_FLOAT TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_FLOAT TOK_COMMA Identifier TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_COMMA Identifier TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_DURATION TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_DURATION TOK_LEFT_BRACKET TimeUnit TOK_RIGHT_BRACKET TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_DURATION TOK_LEFT_BRACKET TimeUnit TOK_RIGHT_BRACKET TOK_COMMA Identifier TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_COMPLEX TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_RIGHT_BRACKET TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_COMPLEX TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_RIGHT_BRACKET TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_COMPLEX TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_RIGHT_BRACKET TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_COMPLEX TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_RIGHT_BRACKET TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_COMPLEX TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_RIGHT_BRACKET TOK_COMMA Integer TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_COMPLEX TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_RIGHT_BRACKET TOK_COMMA Integer TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_COMPLEX TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_RIGHT_BRACKET TOK_COMMA Identifier TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_COMPLEX TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_RIGHT_BRACKET TOK_COMMA Identifier TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_COMPLEX TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_RIGHT_BRACKET TOK_COMMA Identifier TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_COMPLEX TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_RIGHT_BRACKET TOK_COMMA Identifier TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_COMPLEX TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_RIGHT_BRACKET TOK_COMMA Integer TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET DurationOfDecl TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET DurationOfDecl TOK_COMMA Integer TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET DurationOfDecl TOK_COMMA Integer TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET DurationOfDecl TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET DurationOfDecl TOK_COMMA Identifier TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET DurationOfDecl TOK_COMMA Identifier TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_FRAME TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_FRAME TOK_COMMA Integer TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_FRAME TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_FRAME TOK_COMMA Identifier TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_FRAME TOK_COMMA Integer TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_FRAME TOK_COMMA Identifier TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_PORT TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_PORT TOK_COMMA Integer TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_PORT TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_PORT TOK_COMMA Identifier TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_PORT TOK_COMMA Integer TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_PORT TOK_COMMA Identifier TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_WAVEFORM TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_WAVEFORM TOK_COMMA Integer TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_WAVEFORM TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_WAVEFORM TOK_COMMA Identifier TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_WAVEFORM TOK_COMMA Integer TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_WAVEFORM TOK_COMMA Identifier TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_GATE TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_GATE TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_GATE TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_GATE TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_DEFCAL TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_DEFCAL TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_DEFCAL TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_DEFCAL TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_BARRIER TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_BARRIER TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_BARRIER TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_BARRIER TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier

InitArrayExpr::=
	  TOK_ARRAY TOK_LEFT_BRACKET TOK_BIT TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_BIT TOK_COMMA Integer TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_BIT TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_BIT TOK_COMMA Identifier TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_BIT TOK_COMMA Integer TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_BIT TOK_COMMA Identifier TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_QUBIT TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_QUBIT TOK_COMMA Integer TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_QUBIT TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_QUBIT TOK_COMMA Identifier TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_QUBIT TOK_COMMA Integer TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_QUBIT TOK_COMMA Identifier TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_ANGLE TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_ANGLE TOK_COMMA Integer TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_ANGLE TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_ANGLE TOK_COMMA Identifier TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_ANGLE TOK_COMMA Integer TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_ANGLE TOK_COMMA Identifier TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_BOOL TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_BOOL TOK_COMMA Integer TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_BOOL TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_BOOL TOK_COMMA Identifier TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_BOOL TOK_COMMA Integer TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_BOOL TOK_COMMA Identifier TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_INT TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_INT TOK_COMMA Integer TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_INT TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_INT TOK_COMMA Identifier TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_INT TOK_COMMA Integer TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_INT TOK_COMMA Identifier TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_UINT TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_UINT TOK_COMMA Integer TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_UINT TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_UINT TOK_COMMA Identifier TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_UINT TOK_COMMA Integer TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_UINT TOK_COMMA Identifier TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_FLOAT TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_FLOAT TOK_COMMA Integer TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_FLOAT TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_FLOAT TOK_COMMA Identifier TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_FLOAT TOK_COMMA Integer TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_FLOAT TOK_COMMA Identifier TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_DOUBLE TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_DOUBLE TOK_COMMA Integer TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_DOUBLE TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_DOUBLE TOK_COMMA Identifier TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_DOUBLE TOK_COMMA Integer TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_DOUBLE TOK_COMMA Identifier TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_DURATION TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_DURATION TOK_COMMA Integer TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_DURATION TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_DURATION TOK_COMMA Identifier TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_DURATION TOK_COMMA Integer TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_DURATION TOK_COMMA Identifier TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_COMPLEX TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_RIGHT_BRACKET TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_COMPLEX TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_RIGHT_BRACKET TOK_COMMA Integer TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_COMPLEX TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_RIGHT_BRACKET TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_COMPLEX TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_RIGHT_BRACKET TOK_COMMA Identifier TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_COMPLEX TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_RIGHT_BRACKET TOK_COMMA Integer TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_COMPLEX TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET TOK_RIGHT_BRACKET TOK_COMMA Identifier TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_COMPLEX TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_RIGHT_BRACKET TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_COMPLEX TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_RIGHT_BRACKET TOK_COMMA Integer TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_COMPLEX TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_RIGHT_BRACKET TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_COMPLEX TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_RIGHT_BRACKET TOK_COMMA Identifier TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_COMPLEX TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_RIGHT_BRACKET TOK_COMMA Integer TOK_COMMA Identifier TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY
	| TOK_ARRAY TOK_LEFT_BRACKET TOK_COMPLEX TOK_LEFT_BRACKET TOK_FLOAT TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET TOK_RIGHT_BRACKET TOK_COMMA Identifier TOK_COMMA Integer TOK_RIGHT_BRACKET Identifier TOK_EQUAL_ASSIGN TOK_LEFT_CURLY InitializerList TOK_RIGHT_CURLY

ForLoopRangeExpr::=
	  IntegerList Identifier TOK_ADD_OP Integer
	| IntegerList Identifier TOK_ADD_OP Identifier
	| IntegerList Identifier TOK_MINUS Integer
	| IntegerList Identifier TOK_MINUS Identifier
	| IntegerList Identifier TOK_MUL_OP Integer
	| IntegerList Identifier TOK_MUL_OP Identifier
	| IntegerList Identifier TOK_DIV_OP Integer
	| IntegerList Identifier TOK_DIV_OP Identifier
	| IntegerList Identifier TOK_MOD_OP Integer
	| IntegerList Identifier TOK_MOD_OP Identifier
	| IntegerList Identifier TOK_LEFT_SHIFT_OP Integer
	| IntegerList Identifier TOK_LEFT_SHIFT_OP Identifier
	| IntegerList Identifier TOK_RIGHT_SHIFT_OP Integer
	| IntegerList Identifier TOK_RIGHT_SHIFT_OP Identifier
	| IntegerList Identifier TOK_LEFT_SHIFT_ASSIGN Integer
	| IntegerList Identifier TOK_LEFT_SHIFT_ASSIGN Identifier
	| IntegerList Identifier TOK_RIGHT_SHIFT_ASSIGN Integer
	| IntegerList Identifier TOK_RIGHT_SHIFT_ASSIGN Identifier

GPhaseExpr::=
	  TOK_GPHASE TOK_LEFT_PAREN Identifier TOK_RIGHT_PAREN
	| TOK_GPHASE TOK_LEFT_PAREN BinaryOpExpr TOK_RIGHT_PAREN
	| TOK_GPHASE TOK_LEFT_PAREN UnaryOp TOK_RIGHT_PAREN

GPhaseStmt::=
	  GPhaseExpr TOK_SEMICOLON

GateCtrlExpr::=
	  TOK_CTRL TOK_ASSOCIATION_OP GateEOp
	| TOK_CTRL TOK_LEFT_PAREN Integer TOK_RIGHT_PAREN TOK_ASSOCIATION_OP GateEOp
	| TOK_CTRL TOK_ASSOCIATION_OP GateCtrlExpr
	| TOK_CTRL TOK_LEFT_PAREN Integer TOK_RIGHT_PAREN TOK_ASSOCIATION_OP GateCtrlExpr
	| TOK_CTRL TOK_ASSOCIATION_OP GateNegCtrlExpr
	| TOK_CTRL TOK_LEFT_PAREN Integer TOK_RIGHT_PAREN TOK_ASSOCIATION_OP GateNegCtrlExpr
	| TOK_CTRL TOK_ASSOCIATION_OP GateGPhaseExpr
	| TOK_CTRL TOK_LEFT_PAREN Integer TOK_RIGHT_PAREN TOK_ASSOCIATION_OP GateGPhaseExpr
	| TOK_CTRL TOK_ASSOCIATION_OP GateInvExpr
	| TOK_CTRL TOK_LEFT_PAREN Integer TOK_RIGHT_PAREN TOK_ASSOCIATION_OP GateInvExpr
	| TOK_CTRL TOK_ASSOCIATION_OP GatePowExpr
	| TOK_CTRL TOK_LEFT_PAREN Integer TOK_RIGHT_PAREN TOK_ASSOCIATION_OP GatePowExpr

GateCtrlStmt::=
	  GateCtrlExpr TOK_SEMICOLON

GateCtrlExprStmt::=
	  GateCtrlExpr TOK_SEMICOLON

GateNegCtrlExpr::=
	  TOK_NEGCTRL TOK_ASSOCIATION_OP GateEOp
	| TOK_NEGCTRL TOK_LEFT_PAREN Integer TOK_RIGHT_PAREN TOK_ASSOCIATION_OP GateEOp
	| TOK_NEGCTRL TOK_ASSOCIATION_OP GateNegCtrlExpr
	| TOK_NEGCTRL TOK_LEFT_PAREN Integer TOK_RIGHT_PAREN TOK_ASSOCIATION_OP GateNegCtrlExpr
	| TOK_NEGCTRL TOK_ASSOCIATION_OP GateGPhaseExpr
	| TOK_NEGCTRL TOK_LEFT_PAREN Integer TOK_RIGHT_PAREN TOK_ASSOCIATION_OP GateGPhaseExpr
	| TOK_NEGCTRL TOK_ASSOCIATION_OP GateInvExpr
	| TOK_NEGCTRL TOK_LEFT_PAREN Integer TOK_RIGHT_PAREN TOK_ASSOCIATION_OP GateInvExpr
	| TOK_NEGCTRL TOK_ASSOCIATION_OP GatePowExpr
	| TOK_NEGCTRL TOK_LEFT_PAREN Integer TOK_RIGHT_PAREN TOK_ASSOCIATION_OP GatePowExpr

GateNegCtrlStmt::=
	  GateNegCtrlExpr TOK_SEMICOLON

GateNegCtrlExprStmt::=
	  GateNegCtrlExpr TOK_SEMICOLON

GateInvExpr::=
	  TOK_INVERSE TOK_ASSOCIATION_OP GateEOp
	| TOK_INVERSE TOK_ASSOCIATION_OP GateCtrlExpr
	| TOK_INVERSE TOK_ASSOCIATION_OP GateNegCtrlExpr
	| TOK_INVERSE TOK_ASSOCIATION_OP GateGPhaseExpr
	| TOK_INVERSE TOK_ASSOCIATION_OP GateInvExpr
	| TOK_INVERSE TOK_ASSOCIATION_OP GatePowExpr

GateInvStmt::=
	  GateInvExpr TOK_SEMICOLON

GateInvExprStmt::=
	  GateInvExpr TOK_SEMICOLON

GatePowExpr::=
	  TOK_POW TOK_LEFT_PAREN Integer TOK_RIGHT_PAREN TOK_ASSOCIATION_OP GateEOp
	| TOK_POW TOK_LEFT_PAREN Identifier TOK_RIGHT_PAREN TOK_ASSOCIATION_OP GateEOp
	| TOK_POW TOK_LEFT_PAREN BinaryOpExpr TOK_RIGHT_PAREN TOK_ASSOCIATION_OP GateEOp
	| TOK_POW TOK_LEFT_PAREN UnaryOp TOK_RIGHT_PAREN TOK_ASSOCIATION_OP GateEOp
	| TOK_POW TOK_LEFT_PAREN Integer TOK_RIGHT_PAREN TOK_ASSOCIATION_OP GateCtrlExpr
	| TOK_POW TOK_LEFT_PAREN BinaryOpExpr TOK_RIGHT_PAREN TOK_ASSOCIATION_OP GateCtrlExpr
	| TOK_POW TOK_LEFT_PAREN UnaryOp TOK_RIGHT_PAREN TOK_ASSOCIATION_OP GateCtrlExpr
	| TOK_POW TOK_LEFT_PAREN Integer TOK_RIGHT_PAREN TOK_ASSOCIATION_OP GateNegCtrlExpr
	| TOK_POW TOK_LEFT_PAREN BinaryOpExpr TOK_RIGHT_PAREN TOK_ASSOCIATION_OP GateNegCtrlExpr
	| TOK_POW TOK_LEFT_PAREN UnaryOp TOK_RIGHT_PAREN TOK_ASSOCIATION_OP GateNegCtrlExpr
	| TOK_POW TOK_LEFT_PAREN Integer TOK_RIGHT_PAREN TOK_ASSOCIATION_OP GateGPhaseExpr
	| TOK_POW TOK_LEFT_PAREN BinaryOpExpr TOK_RIGHT_PAREN TOK_ASSOCIATION_OP GateGPhaseExpr
	| TOK_POW TOK_LEFT_PAREN UnaryOp TOK_RIGHT_PAREN TOK_ASSOCIATION_OP GateGPhaseExpr
	| TOK_POW TOK_LEFT_PAREN Integer TOK_RIGHT_PAREN TOK_ASSOCIATION_OP GateInvExpr
	| TOK_POW TOK_LEFT_PAREN BinaryOpExpr TOK_RIGHT_PAREN TOK_ASSOCIATION_OP GateInvExpr
	| TOK_POW TOK_LEFT_PAREN UnaryOp TOK_RIGHT_PAREN TOK_ASSOCIATION_OP GateInvExpr
	| TOK_POW TOK_LEFT_PAREN Integer TOK_RIGHT_PAREN TOK_ASSOCIATION_OP GatePowExpr
	| TOK_POW TOK_LEFT_PAREN BinaryOpExpr TOK_RIGHT_PAREN TOK_ASSOCIATION_OP GatePowExpr
	| TOK_POW TOK_LEFT_PAREN UnaryOp TOK_RIGHT_PAREN TOK_ASSOCIATION_OP GatePowExpr

GatePowStmt::=
	  GatePowExpr TOK_SEMICOLON

GatePowExprStmt::=
	  GatePowExpr TOK_SEMICOLON

GateGPhaseExpr::=
	  TOK_CTRL TOK_ASSOCIATION_OP GPhaseExpr IdentifierList

GateGPhaseStmt::=
	  GateGPhaseExpr TOK_SEMICOLON

SwitchCaseStmt::=
	  TOK_CASE Expr ':' TOK_LEFT_CURLY SwitchScopedStmtList TOK_RIGHT_CURLY
	| TOK_CASE Expr ':' TOK_LEFT_CURLY SwitchScopedStmtList TOK_RIGHT_CURLY BreakStmt
	| TOK_CASE Expr ':' SwitchUnscopedStmtList
	| TOK_CASE Expr ':' SwitchUnscopedStmtList BreakStmt

SwitchDefaultStmt::=
	  TOK_DEFAULT ':' TOK_LEFT_CURLY SwitchScopedStmtList TOK_RIGHT_CURLY
	| TOK_DEFAULT ':' TOK_LEFT_CURLY SwitchScopedStmtList TOK_RIGHT_CURLY BreakStmt
	| TOK_DEFAULT ':' SwitchUnscopedStmtList
	| TOK_DEFAULT ':' SwitchUnscopedStmtList BreakStmt

FunctionCallStmtExpr::=
	  ParenFunctionCallExpr

FunctionCallStmt::=
	  FunctionCallStmtExpr TOK_SEMICOLON

FunctionCallExpr::=
	  ParenFunctionCallExpr

ParenFunctionCallExpr::=
	  Identifier TOK_LEFT_PAREN ExprList TOK_RIGHT_PAREN

ComplexInitializerExpr::=
	  BinaryOp TOK_IMAGINARY
	| BinaryOpSelfAssign TOK_IMAGINARY
	| BinaryOpPrePost TOK_IMAGINARY
	| UnaryOp TOK_IMAGINARY

Delay::=
	  TOK_DELAY TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET
	| TOK_DELAY TOK_LEFT_BRACKET TimeUnit TOK_RIGHT_BRACKET IdentifierList
	| TOK_DELAY TOK_LEFT_BRACKET TimeUnit TOK_RIGHT_BRACKET
	| TOK_DELAY TOK_LEFT_BRACKET DurationOfDecl TOK_RIGHT_BRACKET
	| TOK_DELAY TOK_LEFT_BRACKET DurationOfDecl TOK_RIGHT_BRACKET IdentifierList
	| TOK_DELAY TOK_LEFT_BRACKET Identifier TOK_RIGHT_BRACKET IdentifierList
	| TOK_DELAY TOK_LEFT_BRACKET BinaryOp TOK_RIGHT_BRACKET
	| TOK_DELAY TOK_LEFT_BRACKET UnaryOp TOK_RIGHT_BRACKET
	| TOK_DELAY TOK_LEFT_PAREN Identifier TOK_RIGHT_PAREN Identifier

DelayStmt::=
	  Delay TOK_SEMICOLON

Stretch::=
	  TOK_STRETCH Identifier
	| TOK_STRETCH Identifier TOK_EQUAL_ASSIGN Integer
	| TOK_STRETCH Identifier TOK_EQUAL_ASSIGN Real
	| TOK_STRETCH Identifier TOK_EQUAL_ASSIGN BinaryOpExpr
	| TOK_STRETCH Identifier TOK_EQUAL_ASSIGN UnaryOp
	| TOK_STRETCH TOK_LEFT_BRACKET Integer TOK_RIGHT_BRACKET Identifier

StretchStmt::=
	  Stretch TOK_SEMICOLON

BoxStmt::=
	  TOK_BOX Identifier TOK_LEFT_CURLY BoxStmtList TOK_RIGHT_CURLY
	| TOK_BOXAS Identifier TOK_LEFT_CURLY BoxStmtList TOK_RIGHT_CURLY
	| TOK_BOXTO TimeUnit TOK_LEFT_CURLY BoxStmtList TOK_RIGHT_CURLY

Newline::=
	  TOK_NEWLINE

IncludeStmt::=
	  TOK_INCLUDE TOK_STRING_LITERAL
	| TOK_INCLUDE TOK_STRING_LITERAL TOK_SEMICOLON

LineDirective::=
	  TOK_LINE ':' TOK_INTEGER_CONSTANT
	| TOK_LINE ':' TOK_INTEGER_CONSTANT TOK_SEMICOLON

FileDirective::=
	  TOK_FILE ':' TOK_STRING_LITERAL
	| TOK_FILE ':' TOK_STRING_LITERAL TOK_SEMICOLON

//Tokens

TOK_MOD_OP ::= "%"
TOK_LEFT_PAREN ::= "("
TOK_RIGHT_PAREN ::= ")"
TOK_MUL_OP ::= "*"
TOK_ADD_OP ::= "+"
TOK_MINUS ::= "-"
TOK_PERIOD ::= "."
TOK_DIV_OP ::= "/"
TOK_SEMICOLON ::= ";"
TOK_LT_OP ::= "<"
TOK_EQUAL_ASSIGN ::= "="
TOK_GT_OP ::= ">"
TOK_LEFT_BRACKET ::= "["
TOK_RIGHT_BRACKET ::= "]"
TOK_XOR_OP ::= "^"
TOK_LEFT_CURLY ::= "{"
TOK_RIGHT_CURLY ::= "}"
TOK_TILDE ::= "~"
TOK_ADD_ASSIGN ::= "+="
TOK_AND_ASSIGN ::= "&="
TOK_AND_OP ::= "&&"
TOK_ANGLE ::= "angle"
TOK_ANNOTATION ::= "@"[a-zA-Z0-9]+
TOK_ARCCOS ::= "acos"|"arccos"
TOK_ARCSIN ::= "asin"|"arcsin"
TOK_ARCTAN ::= "atan"|"arctan"
TOK_ARRAY ::= "array"
TOK_ASSOCIATION_OP ::= "@"
TOK_BANG ::= "!"
TOK_BARRIER ::= "barrier"
TOK_BIT ::= "bit"|"cbit"
TOK_BOOL ::= "bool"
TOK_BOOLEAN_CONSTANT ::= "false"|"true"
TOK_BOUND_QUBIT ::= ("%"|"$")[0-9]+
TOK_BOX ::= "box"
TOK_BOXAS ::= "boxas"
TOK_BOXTO ::= "boxto"
TOK_BREAK ::= "break"
TOK_CAL ::= "cal"
TOK_CASE ::= "case"
TOK_CCX ::= "CCX"
TOK_CIMAG ::= "cimag"
TOK_CNOT ::= "CNOT"
TOK_COMMA ::= ","
TOK_COMPLEX ::= "complex"
TOK_CONST ::= "const"
TOK_CONTINUE ::= "continue"
TOK_COS ::= "cos"
TOK_CREAL ::= "creal"
TOK_CREG ::= "creg"
TOK_CTRL ::= "ctrl"
TOK_CX ::= "CX"
TOK_DEC_OP ::= "--"
TOK_DEFAULT ::= "default"
TOK_DEFCAL ::= "defcal"
TOK_DEFCAL_GRAMMAR ::= "defcalgrammar"
TOK_DELAY ::= "delay"
TOK_DIV_OP_ASSIGN ::= "/="
TOK_DO ::= "do"
TOK_DOUBLE ::= "double"|"real"
TOK_DURATION ::= "duration"
TOK_DURATIONOF ::= "durationof"
TOK_ELLIPSIS ::= "..."
TOK_ELSE ::= "else"
TOK_EQ_OP ::= "=="
TOK_EXP ::= "exp"
TOK_EXTERN ::= "extern"
TOK_FLOAT ::= "float"
TOK_FOR ::= "for"
TOK_FRAME ::= "frame"
TOK_FUNCTION_DEFINITION ::= "def"
TOK_GATE ::= "gate"
TOK_GE_OP ::= ">="
TOK_GPHASE ::= "gphase"
TOK_IBMQASM ::= "OPENQASM"
TOK_IF ::= "if"
TOK_IMAGINARY ::= "im"
TOK_IN ::= "in"
TOK_INCLUDE ::= "include"
TOK_INC_OP ::= "++"
TOK_INPUT ::= "input"
TOK_INT ::= "int"|"integer"
TOK_INVERSE ::= "inv"
TOK_LEFT_SHIFT_ASSIGN ::= "<<="
TOK_LEFT_SHIFT_OP ::= "<<"
TOK_LET ::= "let"
TOK_LE_OP ::= "<="
TOK_LN ::= "ln"
TOK_MEASURE ::= "measure"
TOK_MOD_ASSIGN ::= "%="
TOK_MUL_ASSIGN ::= "*="

TOK_NEGCTRL ::= "negctrl"
TOK_NEWFRAME ::= "newframe"
TOK_NE_OP ::= "!="
TOK_OPAQUE ::= "opaque"
TOK_OR_ASSIGN ::= "|="
TOK_OR_OP ::= "||"|"|"
TOK_OUTPUT ::= "output"
TOK_PLAY ::= "play"
TOK_POPCOUNT ::= "popcount"
TOK_PORT ::= "port"
TOK_POW ::= "pow"
TOK_PRAGMA ::= "pragma"
TOK_QREG ::= "qreg"
TOK_QUBIT ::= "qubit"
TOK_RESET ::= "reset"
TOK_RETURN ::= "return"
TOK_RIGHT_ARROW ::= "->"
TOK_RIGHT_SHIFT_ASSIGN ::= ">>="
TOK_RIGHT_SHIFT_OP ::= ">>"
TOK_ROTL ::= "rotl"
TOK_ROTR ::= "rotr"
TOK_SIN ::= "sin"
TOK_SQRT ::= "sqrt"
TOK_STRETCH ::= "stretch"
TOK_SUB_ASSIGN ::= "-="
TOK_SWITCH ::= "switch"
TOK_TAN ::= "tan"
TOK_TIME_UNIT ::= [0-9]+(ms|ns|us|μs|dt|s)
TOK_U ::= "U"
TOK_UINT ::= "uint"
TOK_UNBOUND_QUBIT ::= ("%"|"$")([a-zA-Z_]+|[a-zA-Z_][0-9]+)
TOK_WAVEFORM ::= "waveform"
TOK_WHILE ::= "while"
TOK_XOR_ASSIGN ::= "^="

@mingodad
Copy link
Author

mingodad commented Nov 8, 2024

And here the EBNF from qasm3Parser.g4/qasm3Lexer.g4, see how to view the railroad diagram following the instructions at the top of the previous message.

/* converted on Fri Nov 8, 2024, 18:29 (UTC+01) by antlr_4-to-w3c v0.68-SNAPSHOT which is Copyright (c) 2011-2024 by Gunther Rademacher <[email protected]> */

program  ::= version? statementOrScope* EOF
version  ::= OPENQASM VersionSpecifier SEMICOLON
statement
         ::= pragma
           | annotation* ( aliasDeclarationStatement | assignmentStatement | barrierStatement | boxStatement | breakStatement | calStatement | calibrationGrammarStatement | classicalDeclarationStatement | constDeclarationStatement | continueStatement | defStatement | defcalStatement | delayStatement | endStatement | expressionStatement | externStatement | forStatement | gateCallStatement | gateStatement | ifStatement | includeStatement | ioDeclarationStatement | measureArrowAssignmentStatement | oldStyleDeclarationStatement | quantumDeclarationStatement | resetStatement | returnStatement | switchStatement | whileStatement )
annotation
         ::= AnnotationKeyword RemainingLineContent?
scope    ::= LBRACE statementOrScope* RBRACE
pragma   ::= PRAGMA RemainingLineContent
statementOrScope
         ::= statement
           | scope
calibrationGrammarStatement
         ::= DEFCALGRAMMAR StringLiteral SEMICOLON
includeStatement
         ::= INCLUDE StringLiteral SEMICOLON
breakStatement
         ::= BREAK SEMICOLON
continueStatement
         ::= CONTINUE SEMICOLON
endStatement
         ::= END SEMICOLON
forStatement
         ::= FOR scalarType Identifier IN ( setExpression | LBRACKET rangeExpression RBRACKET | expression ) statementOrScope
ifStatement
         ::= IF LPAREN expression RPAREN statementOrScope ( ELSE statementOrScope )?
returnStatement
         ::= RETURN ( expression | measureExpression )? SEMICOLON
whileStatement
         ::= WHILE LPAREN expression RPAREN statementOrScope
switchStatement
         ::= SWITCH LPAREN expression RPAREN LBRACE switchCaseItem* RBRACE
switchCaseItem
         ::= ( CASE expressionList | DEFAULT ) scope
barrierStatement
         ::= BARRIER gateOperandList? SEMICOLON
boxStatement
         ::= BOX designator? scope
delayStatement
         ::= DELAY designator gateOperandList? SEMICOLON
gateCallStatement
         ::= gateModifier* ( Identifier ( LPAREN expressionList? RPAREN )? designator? gateOperandList | GPHASE ( LPAREN expressionList? RPAREN )? designator? gateOperandList? ) SEMICOLON
measureArrowAssignmentStatement
         ::= measureExpression ( ARROW indexedIdentifier )? SEMICOLON
resetStatement
         ::= RESET gateOperand SEMICOLON
aliasDeclarationStatement
         ::= LET Identifier EQUALS aliasExpression SEMICOLON
classicalDeclarationStatement
         ::= ( scalarType | arrayType ) Identifier ( EQUALS declarationExpression )? SEMICOLON
constDeclarationStatement
         ::= CONST scalarType Identifier EQUALS declarationExpression SEMICOLON
ioDeclarationStatement
         ::= ( INPUT | OUTPUT ) ( scalarType | arrayType ) Identifier SEMICOLON
oldStyleDeclarationStatement
         ::= ( CREG | QREG ) Identifier designator? SEMICOLON
quantumDeclarationStatement
         ::= qubitType Identifier SEMICOLON
defStatement
         ::= DEF Identifier LPAREN argumentDefinitionList? RPAREN returnSignature? scope
externStatement
         ::= EXTERN Identifier LPAREN externArgumentList? RPAREN returnSignature? SEMICOLON
gateStatement
         ::= GATE Identifier ( LPAREN identifierList? RPAREN )? identifierList scope
assignmentStatement
         ::= indexedIdentifier ( EQUALS | CompoundAssignmentOperator ) ( expression | measureExpression ) SEMICOLON
expressionStatement
         ::= expression SEMICOLON
calStatement
         ::= CAL LBRACE CalibrationBlock? RBRACE
defcalStatement
         ::= DEFCAL defcalTarget ( LPAREN defcalArgumentDefinitionList? RPAREN )? defcalOperandList returnSignature? LBRACE CalibrationBlock? RBRACE
expression
         ::= ( ( scalarType | arrayType )? LPAREN expression | DURATIONOF LPAREN scope ) RPAREN
           | expression ( indexOperator | ( DOUBLE_ASTERISK | ASTERISK | SLASH | PERCENT | PLUS | MINUS | BitshiftOperator | ComparisonOperator | EqualityOperator | AMPERSAND | CARET | PIPE | DOUBLE_AMPERSAND | DOUBLE_PIPE ) expression )
           | ( TILDE | EXCLAMATION_POINT | MINUS ) expression
           | Identifier ( LPAREN expressionList? RPAREN )?
           | BinaryIntegerLiteral
           | OctalIntegerLiteral
           | DecimalIntegerLiteral
           | HexIntegerLiteral
           | FloatLiteral
           | ImaginaryLiteral
           | BooleanLiteral
           | BitstringLiteral
           | TimingLiteral
           | HardwareQubit
aliasExpression
         ::= expression ( DOUBLE_PLUS expression )*
declarationExpression
         ::= arrayLiteral
           | expression
           | measureExpression
measureExpression
         ::= MEASURE gateOperand
rangeExpression
         ::= expression? COLON expression? ( COLON expression )?
setExpression
         ::= LBRACE expression ( COMMA expression )* COMMA? RBRACE
arrayLiteral
         ::= LBRACE ( expression | arrayLiteral ) ( COMMA ( expression | arrayLiteral ) )* COMMA? RBRACE
indexOperator
         ::= LBRACKET ( setExpression | ( expression | rangeExpression ) ( COMMA ( expression | rangeExpression ) )* COMMA? ) RBRACKET
indexedIdentifier
         ::= Identifier indexOperator*
returnSignature
         ::= ARROW scalarType
gateModifier
         ::= ( INV | POW LPAREN expression RPAREN | ( CTRL | NEGCTRL ) ( LPAREN expression RPAREN )? ) AT
scalarType
         ::= ( BIT | INT | UINT | FLOAT | ANGLE ) designator?
           | BOOL
           | DURATION
           | STRETCH
           | COMPLEX ( LBRACKET scalarType RBRACKET )?
qubitType
         ::= QUBIT designator?
arrayType
         ::= ARRAY LBRACKET scalarType COMMA expressionList RBRACKET
arrayReferenceType
         ::= ( READONLY | MUTABLE ) ARRAY LBRACKET scalarType COMMA ( expressionList | DIM EQUALS expression ) RBRACKET
designator
         ::= LBRACKET expression RBRACKET
defcalTarget
         ::= MEASURE
           | RESET
           | DELAY
           | Identifier
defcalArgumentDefinition
         ::= expression
           | argumentDefinition
defcalOperand
         ::= HardwareQubit
           | Identifier
gateOperand
         ::= indexedIdentifier
           | HardwareQubit
externArgument
         ::= scalarType
           | arrayReferenceType
           | CREG designator?
argumentDefinition
         ::= ( scalarType | qubitType | arrayReferenceType ) Identifier
           | ( CREG | QREG ) Identifier designator?
argumentDefinitionList
         ::= argumentDefinition ( COMMA argumentDefinition )* COMMA?
defcalArgumentDefinitionList
         ::= defcalArgumentDefinition ( COMMA defcalArgumentDefinition )* COMMA?
defcalOperandList
         ::= defcalOperand ( COMMA defcalOperand )* COMMA?
expressionList
         ::= expression ( COMMA expression )* COMMA?
identifierList
         ::= Identifier ( COMMA Identifier )* COMMA?
gateOperandList
         ::= gateOperand ( COMMA gateOperand )* COMMA?
externArgumentList
         ::= externArgument ( COMMA externArgument )* COMMA?

<?TOKENS?>

/* converted on Fri Nov 8, 2024, 18:32 (UTC+01) by antlr_4-to-w3c v0.68-SNAPSHOT which is Copyright (c) 2011-2024 by Gunther Rademacher <[email protected]> */

_        ::= Whitespace
           | Newline
           | LineComment
           | BlockComment
           | VERSION_IDENTIFER_WHITESPACE
           | ARBITRARY_STRING_WHITESPACE
           | EAT_INITIAL_SPACE
           | EAT_LINE_END
           | CAL_PRELUDE_WHITESPACE
           | CAL_PRELUDE_COMMENT
           | DEFCAL_PRELUDE_WHITESPACE
           | DEFCAL_PRELUDE_COMMENT
          /* ws: definition */


PRAGMA   ::= '#'? 'pragma'
AnnotationKeyword
         ::= '@' Identifier
BooleanLiteral
         ::= 'true'
           | 'false'
EqualityOperator
         ::= '=='
           | '!='
CompoundAssignmentOperator
         ::= '+='
           | '-='
           | '*='
           | '/='
           | '&='
           | '|='
           | '~='
           | '^='
           | '<<='
           | '>>='
           | '%='
           | '**='
ComparisonOperator
         ::= '>'
           | '<'
           | '>='
           | '<='
BitshiftOperator
         ::= '>>'
           | '<<'
ImaginaryLiteral
         ::= ( DecimalIntegerLiteral | FloatLiteral ) [ #x9]* 'im'
BinaryIntegerLiteral
         ::= ( '0b' | '0B' ) [0-1] ( '_'? [0-1] )*
OctalIntegerLiteral
         ::= '0o' [0-7] ( '_'? [0-7] )*
DecimalIntegerLiteral
         ::= [0-9] ( '_'? [0-9] )*
HexIntegerLiteral
         ::= ( '0x' | '0X' ) [0-9a-fA-F] ( '_'? [0-9a-fA-F] )*
Letter   ::= [A-Za-z]
FirstIdCharacter
         ::= '_'
           | Letter
GeneralIdCharacter
         ::= FirstIdCharacter
           | [0-9]
Identifier
         ::= FirstIdCharacter GeneralIdCharacter*
HardwareQubit
         ::= '$' [0-9]+
FloatLiteralExponent
         ::= [eE] ( '+' | '-' )? DecimalIntegerLiteral
FloatLiteral
         ::= DecimalIntegerLiteral ( FloatLiteralExponent | '.' DecimalIntegerLiteral? FloatLiteralExponent? )
           | '.' DecimalIntegerLiteral FloatLiteralExponent?
TimeUnit ::= 'dt'
           | 'ns'
           | 'us'
           | #xB5? 's'
           | 'ms'
TimingLiteral
         ::= ( DecimalIntegerLiteral | FloatLiteral ) [ #x9]* TimeUnit
BitstringLiteral
         ::= '"' [0-1] ( '_'? [0-1] )* '"'
Whitespace
         ::= [ #x9]+
Newline  ::= [#xd#xa]+
LineComment
         ::= '//' [^#xd#xa]*
BlockComment?
         ::= '/*' .* '*/'
VERSION_IDENTIFER_WHITESPACE
         ::= [ #x9#xd#xa]+
VersionSpecifier
         ::= [0-9]+ ( '.' [0-9]+ )?
ARBITRARY_STRING_WHITESPACE
         ::= [ #x9#xd#xa]+
StringLiteral
         ::= '"' [^"#xd#x9#xa]+ '"'
           | "'" [^'#xd#x9#xa]+ "'"
EAT_INITIAL_SPACE
         ::= [ #x9]+
EAT_LINE_END
         ::= [#xd#xa]
RemainingLineContent
         ::= [^ #x9#xd#xa] [^#xd#xa]*
CAL_PRELUDE_WHITESPACE
         ::= [ #x9#xd#xa]+
CAL_PRELUDE_COMMENT
         ::= LineComment
           | BlockComment
DEFCAL_PRELUDE_WHITESPACE
         ::= [ #x9#xd#xa]+
DEFCAL_PRELUDE_COMMENT
         ::= LineComment
           | BlockComment
DEFCAL_PRELUDE_BitshiftOperator
         ::= BitshiftOperator
DEFCAL_PRELUDE_BitstringLiteral
         ::= BitstringLiteral
DEFCAL_PRELUDE_BinaryIntegerLiteral
         ::= BinaryIntegerLiteral
DEFCAL_PRELUDE_OctalIntegerLiteral
         ::= OctalIntegerLiteral
DEFCAL_PRELUDE_DecimalIntegerLiteral
         ::= DecimalIntegerLiteral
DEFCAL_PRELUDE_HexIntegerLiteral
         ::= HexIntegerLiteral
DEFCAL_PRELUDE_FloatLiteral
         ::= FloatLiteral
DEFCAL_PRELUDE_Identifier
         ::= Identifier
DEFCAL_PRELUDE_HardwareQubit
         ::= HardwareQubit
NestedCalibrationBlock
         ::= '{' ( NestedCalibrationBlock | [^{}] )* '}'
CalibrationBlock
         ::= ( NestedCalibrationBlock | [^{}] )+

OPENQASM ::= 'OPENQASM'
INCLUDE ::= 'include'
DEFCALGRAMMAR ::= 'defcalgrammar'
DEF ::= 'def'
CAL ::= 'cal'
DEFCAL ::= 'defcal'
GATE ::= 'gate'
EXTERN ::= 'extern'
BOX ::= 'box'
LET ::= 'let'

BREAK ::= 'break'
CONTINUE ::= 'continue'
IF ::= 'if'
ELSE ::= 'else'
END ::= 'end'
RETURN ::= 'return'
FOR ::= 'for'
WHILE ::= 'while'
IN ::= 'in'
SWITCH ::= 'switch'
CASE ::= 'case'
DEFAULT ::= 'default'

PRAGMA ::= '#'? 'pragma'
AnnotationKeyword ::= '@'


/* Types. */

INPUT ::= 'input'
OUTPUT ::= 'output'
CONST ::= 'const'
READONLY ::= 'readonly'
MUTABLE ::= 'mutable'

QREG ::= 'qreg'
QUBIT ::= 'qubit'

CREG ::= 'creg'
BOOL ::= 'bool'
BIT ::= 'bit'
INT ::= 'int'
UINT ::= 'uint'
FLOAT ::= 'float'
ANGLE ::= 'angle'
COMPLEX ::= 'complex'
ARRAY ::= 'array'
VOID ::= 'void'

DURATION ::= 'duration'
STRETCH ::= 'stretch'


/* Builtin identifiers and operations */

GPHASE ::= 'gphase'
INV ::= 'inv'
POW ::= 'pow'
CTRL ::= 'ctrl'
NEGCTRL ::= 'negctrl'

DIM ::= '#dim'

DURATIONOF ::= 'durationof'

DELAY ::= 'delay'
RESET ::= 'reset'
MEASURE ::= 'measure'
BARRIER ::= 'barrier'

BooleanLiteral ::= 'true' | 'false'


/* Symbols */

LBRACKET ::= '['
RBRACKET ::= ']'
LBRACE ::= '{'
RBRACE ::= '}'
LPAREN ::= '('
RPAREN ::= ')'

COLON ::= ':'
SEMICOLON ::= ';'

DOT ::= '.'
COMMA ::= ','

EQUALS ::= '='
ARROW ::= '->'
PLUS ::= '+'
DOUBLE_PLUS ::= '++'
MINUS ::= '-'
ASTERISK ::= '*'
DOUBLE_ASTERISK ::= '**'
SLASH ::= '/'
PERCENT ::= '%'
PIPE ::= '|'
DOUBLE_PIPE ::= '||'
AMPERSAND ::= '&'
DOUBLE_AMPERSAND ::= '&&'
CARET ::= '^'
AT ::= '@'
TILDE ::= '~'
EXCLAMATION_POINT ::= '!'

EOF      ::= $

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant