# Generated from qasm3Parser.g4 by ANTLR 4.7.2
# encoding: utf-8
from antlr4 import *
from io import StringIO
from typing.io import TextIO
import sys


def serializedATN():
    with StringIO() as buf:
        buf.write("\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3o")
        buf.write("\u0320\4\2\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7")
        buf.write("\4\b\t\b\4\t\t\t\4\n\t\n\4\13\t\13\4\f\t\f\4\r\t\r\4\16")
        buf.write("\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22\t\22\4\23\t\23")
        buf.write("\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t\30\4\31")
        buf.write("\t\31\4\32\t\32\4\33\t\33\4\34\t\34\4\35\t\35\4\36\t\36")
        buf.write("\4\37\t\37\4 \t \4!\t!\4\"\t\"\4#\t#\4$\t$\4%\t%\4&\t")
        buf.write("&\4\'\t\'\4(\t(\4)\t)\4*\t*\4+\t+\4,\t,\4-\t-\4.\t.\4")
        buf.write("/\t/\4\60\t\60\4\61\t\61\4\62\t\62\4\63\t\63\4\64\t\64")
        buf.write("\4\65\t\65\4\66\t\66\4\67\t\67\48\t8\49\t9\4:\t:\4;\t")
        buf.write(";\4<\t<\4=\t=\4>\t>\4?\t?\4@\t@\4A\tA\3\2\5\2\u0084\n")
        buf.write("\2\3\2\7\2\u0087\n\2\f\2\16\2\u008a\13\2\3\2\3\2\3\3\3")
        buf.write("\3\3\3\3\3\3\4\3\4\7\4\u0094\n\4\f\4\16\4\u0097\13\4\3")
        buf.write("\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4")
        buf.write("\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3")
        buf.write("\4\5\4\u00b5\n\4\5\4\u00b7\n\4\3\5\3\5\5\5\u00bb\n\5\3")
        buf.write("\6\3\6\7\6\u00bf\n\6\f\6\16\6\u00c2\13\6\3\6\3\6\3\7\3")
        buf.write("\7\3\7\3\b\3\b\5\b\u00cb\n\b\3\t\3\t\3\t\3\t\3\n\3\n\3")
        buf.write("\n\3\n\3\13\3\13\3\13\3\f\3\f\3\f\3\r\3\r\3\r\3\16\3\16")
        buf.write("\3\16\3\16\3\16\3\16\3\16\3\16\3\16\3\16\5\16\u00e8\n")
        buf.write("\16\3\16\3\16\3\17\3\17\3\17\3\17\3\17\3\17\3\17\5\17")
        buf.write("\u00f3\n\17\3\20\3\20\3\20\5\20\u00f8\n\20\3\20\3\20\3")
        buf.write("\21\3\21\3\21\3\21\3\21\3\21\3\22\3\22\5\22\u0104\n\22")
        buf.write("\3\22\3\22\3\23\3\23\5\23\u010a\n\23\3\23\3\23\3\24\3")
        buf.write("\24\3\24\5\24\u0111\n\24\3\24\3\24\3\25\7\25\u0116\n\25")
        buf.write("\f\25\16\25\u0119\13\25\3\25\3\25\3\25\5\25\u011e\n\25")
        buf.write("\3\25\5\25\u0121\n\25\3\25\5\25\u0124\n\25\3\25\3\25\3")
        buf.write("\25\3\25\7\25\u012a\n\25\f\25\16\25\u012d\13\25\3\25\3")
        buf.write("\25\3\25\5\25\u0132\n\25\3\25\5\25\u0135\n\25\3\25\5\25")
        buf.write("\u0138\n\25\3\25\5\25\u013b\n\25\3\25\5\25\u013e\n\25")
        buf.write("\3\26\3\26\3\26\5\26\u0143\n\26\3\26\3\26\3\27\3\27\3")
        buf.write("\27\3\27\3\30\3\30\3\30\3\30\3\30\3\30\3\31\3\31\5\31")
        buf.write("\u0153\n\31\3\31\3\31\3\31\5\31\u0158\n\31\3\31\3\31\3")
        buf.write("\32\3\32\3\32\3\32\3\32\3\32\3\32\3\33\3\33\3\33\5\33")
        buf.write("\u0166\n\33\3\33\3\33\3\33\3\34\3\34\3\34\5\34\u016e\n")
        buf.write("\34\3\34\3\34\3\35\3\35\3\35\3\35\3\36\3\36\3\36\3\36")
        buf.write("\5\36\u017a\n\36\3\36\3\36\5\36\u017e\n\36\3\36\3\36\3")
        buf.write("\37\3\37\3\37\3\37\5\37\u0186\n\37\3\37\3\37\5\37\u018a")
        buf.write("\n\37\3\37\3\37\3 \3 \3 \3 \5 \u0192\n \3 \5 \u0195\n")
        buf.write(" \3 \3 \3 \3!\3!\3!\3!\5!\u019e\n!\3!\3!\3\"\3\"\3\"\3")
        buf.write("#\3#\3#\5#\u01a8\n#\3#\3#\3$\3$\3$\3$\5$\u01b0\n$\3$\5")
        buf.write("$\u01b3\n$\3$\3$\5$\u01b7\n$\3$\3$\5$\u01bb\n$\3$\3$\3")
        buf.write("%\3%\3%\3%\3%\3%\3%\3%\3%\5%\u01c8\n%\3%\3%\3%\3%\3%\3")
        buf.write("%\3%\3%\3%\3%\3%\3%\5%\u01d6\n%\3%\3%\5%\u01da\n%\3%\3")
        buf.write("%\3%\3%\3%\3%\3%\3%\3%\3%\3%\3%\3%\3%\3%\3%\3%\3%\3%\3")
        buf.write("%\3%\3%\3%\3%\3%\3%\3%\3%\3%\3%\3%\3%\3%\3%\3%\7%\u01ff")
        buf.write("\n%\f%\16%\u0202\13%\3&\3&\3&\7&\u0207\n&\f&\16&\u020a")
        buf.write("\13&\3\'\3\'\3\'\5\'\u020f\n\'\3(\3(\3(\3)\5)\u0215\n")
        buf.write(")\3)\3)\5)\u0219\n)\3)\3)\5)\u021d\n)\3*\3*\3*\3*\7*\u0223")
        buf.write("\n*\f*\16*\u0226\13*\3*\5*\u0229\n*\3*\3*\3+\3+\3+\5+")
        buf.write("\u0230\n+\3+\3+\3+\5+\u0235\n+\7+\u0237\n+\f+\16+\u023a")
        buf.write("\13+\3+\5+\u023d\n+\3+\3+\3,\3,\3,\3,\5,\u0245\n,\3,\3")
        buf.write(",\3,\5,\u024a\n,\7,\u024c\n,\f,\16,\u024f\13,\3,\5,\u0252")
        buf.write("\n,\5,\u0254\n,\3,\3,\3-\3-\7-\u025a\n-\f-\16-\u025d\13")
        buf.write("-\3.\3.\3.\3/\3/\3/\3/\3/\3/\3/\3/\3/\3/\3/\5/\u026d\n")
        buf.write("/\5/\u026f\n/\3/\3/\3\60\3\60\5\60\u0275\n\60\3\60\3\60")
        buf.write("\5\60\u0279\n\60\3\60\3\60\5\60\u027d\n\60\3\60\3\60\5")
        buf.write("\60\u0281\n\60\3\60\3\60\5\60\u0285\n\60\3\60\3\60\3\60")
        buf.write("\3\60\3\60\3\60\3\60\3\60\5\60\u028f\n\60\5\60\u0291\n")
        buf.write("\60\3\61\3\61\5\61\u0295\n\61\3\62\3\62\3\62\3\62\3\62")
        buf.write("\3\62\3\62\3\63\3\63\3\63\3\63\3\63\3\63\3\63\3\63\3\63")
        buf.write("\5\63\u02a7\n\63\3\63\3\63\3\64\3\64\3\64\3\64\3\65\3")
        buf.write("\65\3\66\3\66\5\66\u02b3\n\66\3\67\3\67\38\38\58\u02b9")
        buf.write("\n8\39\39\39\39\59\u02bf\n9\59\u02c1\n9\3:\3:\3:\3:\3")
        buf.write(":\3:\3:\3:\3:\5:\u02cc\n:\3:\3:\3:\5:\u02d1\n:\3;\3;\3")
        buf.write(";\7;\u02d6\n;\f;\16;\u02d9\13;\3;\5;\u02dc\n;\3<\3<\3")
        buf.write("<\7<\u02e1\n<\f<\16<\u02e4\13<\3<\5<\u02e7\n<\3=\3=\3")
        buf.write("=\7=\u02ec\n=\f=\16=\u02ef\13=\3=\5=\u02f2\n=\3>\3>\3")
        buf.write(">\7>\u02f7\n>\f>\16>\u02fa\13>\3>\5>\u02fd\n>\3?\3?\3")
        buf.write("?\7?\u0302\n?\f?\16?\u0305\13?\3?\5?\u0308\n?\3@\3@\3")
        buf.write("@\7@\u030d\n@\f@\16@\u0310\13@\3@\5@\u0313\n@\3A\3A\3")
        buf.write("A\7A\u0318\nA\fA\16A\u031b\13A\3A\5A\u031e\nA\3A\2\3H")
        buf.write("B\2\4\6\b\n\f\16\20\22\24\26\30\32\34\36 \"$&(*,.\60\62")
        buf.write("\64\668:<>@BDFHJLNPRTVXZ\\^`bdfhjlnprtvxz|~\u0080\2\r")
        buf.write("\3\2\30\31\4\2\35\35\37\37\4\2AASS\4\2EEPQ\4\2\66\66W")
        buf.write("`\4\2FFHI\4\2CCEE\3\2./\3\2\33\34\4\2\62\64\\\\\3\2\\")
        buf.write("]\2\u0373\2\u0083\3\2\2\2\4\u008d\3\2\2\2\6\u00b6\3\2")
        buf.write("\2\2\b\u00b8\3\2\2\2\n\u00bc\3\2\2\2\f\u00c5\3\2\2\2\16")
        buf.write("\u00ca\3\2\2\2\20\u00cc\3\2\2\2\22\u00d0\3\2\2\2\24\u00d4")
        buf.write("\3\2\2\2\26\u00d7\3\2\2\2\30\u00da\3\2\2\2\32\u00dd\3")
        buf.write("\2\2\2\34\u00eb\3\2\2\2\36\u00f4\3\2\2\2 \u00fb\3\2\2")
        buf.write("\2\"\u0101\3\2\2\2$\u0107\3\2\2\2&\u010d\3\2\2\2(\u013d")
        buf.write("\3\2\2\2*\u013f\3\2\2\2,\u0146\3\2\2\2.\u014a\3\2\2\2")
        buf.write("\60\u0152\3\2\2\2\62\u015b\3\2\2\2\64\u0162\3\2\2\2\66")
        buf.write("\u016a\3\2\2\28\u0171\3\2\2\2:\u0175\3\2\2\2<\u0181\3")
        buf.write("\2\2\2>\u018d\3\2\2\2@\u0199\3\2\2\2B\u01a1\3\2\2\2D\u01a4")
        buf.write("\3\2\2\2F\u01ab\3\2\2\2H\u01d9\3\2\2\2J\u0203\3\2\2\2")
        buf.write("L\u020e\3\2\2\2N\u0210\3\2\2\2P\u0214\3\2\2\2R\u021e\3")
        buf.write("\2\2\2T\u022c\3\2\2\2V\u0240\3\2\2\2X\u0257\3\2\2\2Z\u025e")
        buf.write("\3\2\2\2\\\u026e\3\2\2\2^\u0290\3\2\2\2`\u0292\3\2\2\2")
        buf.write("b\u0296\3\2\2\2d\u029d\3\2\2\2f\u02aa\3\2\2\2h\u02ae\3")
        buf.write("\2\2\2j\u02b2\3\2\2\2l\u02b4\3\2\2\2n\u02b8\3\2\2\2p\u02c0")
        buf.write("\3\2\2\2r\u02d0\3\2\2\2t\u02d2\3\2\2\2v\u02dd\3\2\2\2")
        buf.write("x\u02e8\3\2\2\2z\u02f3\3\2\2\2|\u02fe\3\2\2\2~\u0309\3")
        buf.write("\2\2\2\u0080\u0314\3\2\2\2\u0082\u0084\5\4\3\2\u0083\u0082")
        buf.write("\3\2\2\2\u0083\u0084\3\2\2\2\u0084\u0088\3\2\2\2\u0085")
        buf.write("\u0087\5\6\4\2\u0086\u0085\3\2\2\2\u0087\u008a\3\2\2\2")
        buf.write("\u0088\u0086\3\2\2\2\u0088\u0089\3\2\2\2\u0089\u008b\3")
        buf.write("\2\2\2\u008a\u0088\3\2\2\2\u008b\u008c\7\2\2\3\u008c\3")
        buf.write("\3\2\2\2\u008d\u008e\7\3\2\2\u008e\u008f\7g\2\2\u008f")
        buf.write("\u0090\7>\2\2\u0090\5\3\2\2\2\u0091\u00b7\5\f\7\2\u0092")
        buf.write("\u0094\5\b\5\2\u0093\u0092\3\2\2\2\u0094\u0097\3\2\2\2")
        buf.write("\u0095\u0093\3\2\2\2\u0095\u0096\3\2\2\2\u0096\u00b4\3")
        buf.write("\2\2\2\u0097\u0095\3\2\2\2\u0098\u00b5\5.\30\2\u0099\u00b5")
        buf.write("\5@!\2\u009a\u00b5\5\"\22\2\u009b\u00b5\5$\23\2\u009c")
        buf.write("\u00b5\5\24\13\2\u009d\u00b5\5D#\2\u009e\u00b5\5\20\t")
        buf.write("\2\u009f\u00b5\5\60\31\2\u00a0\u00b5\5\62\32\2\u00a1\u00b5")
        buf.write("\5\26\f\2\u00a2\u00b5\5:\36\2\u00a3\u00b5\5F$\2\u00a4")
        buf.write("\u00b5\5&\24\2\u00a5\u00b5\5\30\r\2\u00a6\u00b5\5B\"\2")
        buf.write("\u00a7\u00b5\5<\37\2\u00a8\u00b5\5\32\16\2\u00a9\u00b5")
        buf.write("\5(\25\2\u00aa\u00b5\5> \2\u00ab\u00b5\5\34\17\2\u00ac")
        buf.write("\u00b5\5\22\n\2\u00ad\u00b5\5\64\33\2\u00ae\u00b5\5*\26")
        buf.write("\2\u00af\u00b5\5\66\34\2\u00b0\u00b5\58\35\2\u00b1\u00b5")
        buf.write("\5,\27\2\u00b2\u00b5\5\36\20\2\u00b3\u00b5\5 \21\2\u00b4")
        buf.write("\u0098\3\2\2\2\u00b4\u0099\3\2\2\2\u00b4\u009a\3\2\2\2")
        buf.write("\u00b4\u009b\3\2\2\2\u00b4\u009c\3\2\2\2\u00b4\u009d\3")
        buf.write("\2\2\2\u00b4\u009e\3\2\2\2\u00b4\u009f\3\2\2\2\u00b4\u00a0")
        buf.write("\3\2\2\2\u00b4\u00a1\3\2\2\2\u00b4\u00a2\3\2\2\2\u00b4")
        buf.write("\u00a3\3\2\2\2\u00b4\u00a4\3\2\2\2\u00b4\u00a5\3\2\2\2")
        buf.write("\u00b4\u00a6\3\2\2\2\u00b4\u00a7\3\2\2\2\u00b4\u00a8\3")
        buf.write("\2\2\2\u00b4\u00a9\3\2\2\2\u00b4\u00aa\3\2\2\2\u00b4\u00ab")
        buf.write("\3\2\2\2\u00b4\u00ac\3\2\2\2\u00b4\u00ad\3\2\2\2\u00b4")
        buf.write("\u00ae\3\2\2\2\u00b4\u00af\3\2\2\2\u00b4\u00b0\3\2\2\2")
        buf.write("\u00b4\u00b1\3\2\2\2\u00b4\u00b2\3\2\2\2\u00b4\u00b3\3")
        buf.write("\2\2\2\u00b5\u00b7\3\2\2\2\u00b6\u0091\3\2\2\2\u00b6\u0095")
        buf.write("\3\2\2\2\u00b7\7\3\2\2\2\u00b8\u00ba\7\27\2\2\u00b9\u00bb")
        buf.write("\7j\2\2\u00ba\u00b9\3\2\2\2\u00ba\u00bb\3\2\2\2\u00bb")
        buf.write("\t\3\2\2\2\u00bc\u00c0\79\2\2\u00bd\u00bf\5\6\4\2\u00be")
        buf.write("\u00bd\3\2\2\2\u00bf\u00c2\3\2\2\2\u00c0\u00be\3\2\2\2")
        buf.write("\u00c0\u00c1\3\2\2\2\u00c1\u00c3\3\2\2\2\u00c2\u00c0\3")
        buf.write("\2\2\2\u00c3\u00c4\7:\2\2\u00c4\13\3\2\2\2\u00c5\u00c6")
        buf.write("\7\26\2\2\u00c6\u00c7\7j\2\2\u00c7\r\3\2\2\2\u00c8\u00cb")
        buf.write("\5\6\4\2\u00c9\u00cb\5\n\6\2\u00ca\u00c8\3\2\2\2\u00ca")
        buf.write("\u00c9\3\2\2\2\u00cb\17\3\2\2\2\u00cc\u00cd\7\5\2\2\u00cd")
        buf.write("\u00ce\7a\2\2\u00ce\u00cf\7>\2\2\u00cf\21\3\2\2\2\u00d0")
        buf.write("\u00d1\7\4\2\2\u00d1\u00d2\7a\2\2\u00d2\u00d3\7>\2\2\u00d3")
        buf.write("\23\3\2\2\2\u00d4\u00d5\7\r\2\2\u00d5\u00d6\7>\2\2\u00d6")
        buf.write("\25\3\2\2\2\u00d7\u00d8\7\16\2\2\u00d8\u00d9\7>\2\2\u00d9")
        buf.write("\27\3\2\2\2\u00da\u00db\7\21\2\2\u00db\u00dc\7>\2\2\u00dc")
        buf.write("\31\3\2\2\2\u00dd\u00de\7\23\2\2\u00de\u00df\5^\60\2\u00df")
        buf.write("\u00e0\7\\\2\2\u00e0\u00e7\7\25\2\2\u00e1\u00e8\5R*\2")
        buf.write("\u00e2\u00e3\7\67\2\2\u00e3\u00e4\5P)\2\u00e4\u00e5\7")
        buf.write("8\2\2\u00e5\u00e8\3\2\2\2\u00e6\u00e8\5H%\2\u00e7\u00e1")
        buf.write("\3\2\2\2\u00e7\u00e2\3\2\2\2\u00e7\u00e6\3\2\2\2\u00e8")
        buf.write("\u00e9\3\2\2\2\u00e9\u00ea\5\16\b\2\u00ea\33\3\2\2\2\u00eb")
        buf.write("\u00ec\7\17\2\2\u00ec\u00ed\7;\2\2\u00ed\u00ee\5H%\2\u00ee")
        buf.write("\u00ef\7<\2\2\u00ef\u00f2\5\16\b\2\u00f0\u00f1\7\20\2")
        buf.write("\2\u00f1\u00f3\5\16\b\2\u00f2\u00f0\3\2\2\2\u00f2\u00f3")
        buf.write("\3\2\2\2\u00f3\35\3\2\2\2\u00f4\u00f7\7\22\2\2\u00f5\u00f8")
        buf.write("\5H%\2\u00f6\u00f8\5N(\2\u00f7\u00f5\3\2\2\2\u00f7\u00f6")
        buf.write("\3\2\2\2\u00f7\u00f8\3\2\2\2\u00f8\u00f9\3\2\2\2\u00f9")
        buf.write("\u00fa\7>\2\2\u00fa\37\3\2\2\2\u00fb\u00fc\7\24\2\2\u00fc")
        buf.write("\u00fd\7;\2\2\u00fd\u00fe\5H%\2\u00fe\u00ff\7<\2\2\u00ff")
        buf.write("\u0100\5\16\b\2\u0100!\3\2\2\2\u0101\u0103\7\65\2\2\u0102")
        buf.write("\u0104\5~@\2\u0103\u0102\3\2\2\2\u0103\u0104\3\2\2\2\u0104")
        buf.write("\u0105\3\2\2\2\u0105\u0106\7>\2\2\u0106#\3\2\2\2\u0107")
        buf.write("\u0109\7\13\2\2\u0108\u010a\5f\64\2\u0109\u0108\3\2\2")
        buf.write("\2\u0109\u010a\3\2\2\2\u010a\u010b\3\2\2\2\u010b\u010c")
        buf.write("\5\n\6\2\u010c%\3\2\2\2\u010d\u010e\7\62\2\2\u010e\u0110")
        buf.write("\5f\64\2\u010f\u0111\5~@\2\u0110\u010f\3\2\2\2\u0110\u0111")
        buf.write("\3\2\2\2\u0111\u0112\3\2\2\2\u0112\u0113\7>\2\2\u0113")
        buf.write("\'\3\2\2\2\u0114\u0116\5\\/\2\u0115\u0114\3\2\2\2\u0116")
        buf.write("\u0119\3\2\2\2\u0117\u0115\3\2\2\2\u0117\u0118\3\2\2\2")
        buf.write("\u0118\u011a\3\2\2\2\u0119\u0117\3\2\2\2\u011a\u0120\7")
        buf.write("\\\2\2\u011b\u011d\7;\2\2\u011c\u011e\5z>\2\u011d\u011c")
        buf.write("\3\2\2\2\u011d\u011e\3\2\2\2\u011e\u011f\3\2\2\2\u011f")
        buf.write("\u0121\7<\2\2\u0120\u011b\3\2\2\2\u0120\u0121\3\2\2\2")
        buf.write("\u0121\u0123\3\2\2\2\u0122\u0124\5f\64\2\u0123\u0122\3")
        buf.write("\2\2\2\u0123\u0124\3\2\2\2\u0124\u0125\3\2\2\2\u0125\u0126")
        buf.write("\5~@\2\u0126\u0127\7>\2\2\u0127\u013e\3\2\2\2\u0128\u012a")
        buf.write("\5\\/\2\u0129\u0128\3\2\2\2\u012a\u012d\3\2\2\2\u012b")
        buf.write("\u0129\3\2\2\2\u012b\u012c\3\2\2\2\u012c\u012e\3\2\2\2")
        buf.write("\u012d\u012b\3\2\2\2\u012e\u0134\7+\2\2\u012f\u0131\7")
        buf.write(";\2\2\u0130\u0132\5z>\2\u0131\u0130\3\2\2\2\u0131\u0132")
        buf.write("\3\2\2\2\u0132\u0133\3\2\2\2\u0133\u0135\7<\2\2\u0134")
        buf.write("\u012f\3\2\2\2\u0134\u0135\3\2\2\2\u0135\u0137\3\2\2\2")
        buf.write("\u0136\u0138\5f\64\2\u0137\u0136\3\2\2\2\u0137\u0138\3")
        buf.write("\2\2\2\u0138\u013a\3\2\2\2\u0139\u013b\5~@\2\u013a\u0139")
        buf.write("\3\2\2\2\u013a\u013b\3\2\2\2\u013b\u013c\3\2\2\2\u013c")
        buf.write("\u013e\7>\2\2\u013d\u0117\3\2\2\2\u013d\u012b\3\2\2\2")
        buf.write("\u013e)\3\2\2\2\u013f\u0142\5N(\2\u0140\u0141\7B\2\2\u0141")
        buf.write("\u0143\5X-\2\u0142\u0140\3\2\2\2\u0142\u0143\3\2\2\2\u0143")
        buf.write("\u0144\3\2\2\2\u0144\u0145\7>\2\2\u0145+\3\2\2\2\u0146")
        buf.write("\u0147\7\63\2\2\u0147\u0148\5n8\2\u0148\u0149\7>\2\2\u0149")
        buf.write("-\3\2\2\2\u014a\u014b\7\f\2\2\u014b\u014c\7\\\2\2\u014c")
        buf.write("\u014d\7A\2\2\u014d\u014e\5J&\2\u014e\u014f\7>\2\2\u014f")
        buf.write("/\3\2\2\2\u0150\u0153\5^\60\2\u0151\u0153\5b\62\2\u0152")
        buf.write("\u0150\3\2\2\2\u0152\u0151\3\2\2\2\u0153\u0154\3\2\2\2")
        buf.write("\u0154\u0157\7\\\2\2\u0155\u0156\7A\2\2\u0156\u0158\5")
        buf.write("L\'\2\u0157\u0155\3\2\2\2\u0157\u0158\3\2\2\2\u0158\u0159")
        buf.write("\3\2\2\2\u0159\u015a\7>\2\2\u015a\61\3\2\2\2\u015b\u015c")
        buf.write("\7\32\2\2\u015c\u015d\5^\60\2\u015d\u015e\7\\\2\2\u015e")
        buf.write("\u015f\7A\2\2\u015f\u0160\5L\'\2\u0160\u0161\7>\2\2\u0161")
        buf.write("\63\3\2\2\2\u0162\u0165\t\2\2\2\u0163\u0166\5^\60\2\u0164")
        buf.write("\u0166\5b\62\2\u0165\u0163\3\2\2\2\u0165\u0164\3\2\2\2")
        buf.write("\u0166\u0167\3\2\2\2\u0167\u0168\7\\\2\2\u0168\u0169\7")
        buf.write(">\2\2\u0169\65\3\2\2\2\u016a\u016b\t\3\2\2\u016b\u016d")
        buf.write("\7\\\2\2\u016c\u016e\5f\64\2\u016d\u016c\3\2\2\2\u016d")
        buf.write("\u016e\3\2\2\2\u016e\u016f\3\2\2\2\u016f\u0170\7>\2\2")
        buf.write("\u0170\67\3\2\2\2\u0171\u0172\5`\61\2\u0172\u0173\7\\")
        buf.write("\2\2\u0173\u0174\7>\2\2\u01749\3\2\2\2\u0175\u0176\7\6")
        buf.write("\2\2\u0176\u0177\7\\\2\2\u0177\u0179\7;\2\2\u0178\u017a")
        buf.write("\5t;\2\u0179\u0178\3\2\2\2\u0179\u017a\3\2\2\2\u017a\u017b")
        buf.write("\3\2\2\2\u017b\u017d\7<\2\2\u017c\u017e\5Z.\2\u017d\u017c")
        buf.write("\3\2\2\2\u017d\u017e\3\2\2\2\u017e\u017f\3\2\2\2\u017f")
        buf.write("\u0180\5\n\6\2\u0180;\3\2\2\2\u0181\u0182\7\n\2\2\u0182")
        buf.write("\u0183\7\\\2\2\u0183\u0185\7;\2\2\u0184\u0186\5\u0080")
        buf.write("A\2\u0185\u0184\3\2\2\2\u0185\u0186\3\2\2\2\u0186\u0187")
        buf.write("\3\2\2\2\u0187\u0189\7<\2\2\u0188\u018a\5Z.\2\u0189\u0188")
        buf.write("\3\2\2\2\u0189\u018a\3\2\2\2\u018a\u018b\3\2\2\2\u018b")
        buf.write("\u018c\7>\2\2\u018c=\3\2\2\2\u018d\u018e\7\t\2\2\u018e")
        buf.write("\u0194\7\\\2\2\u018f\u0191\7;\2\2\u0190\u0192\5|?\2\u0191")
        buf.write("\u0190\3\2\2\2\u0191\u0192\3\2\2\2\u0192\u0193\3\2\2\2")
        buf.write("\u0193\u0195\7<\2\2\u0194\u018f\3\2\2\2\u0194\u0195\3")
        buf.write("\2\2\2\u0195\u0196\3\2\2\2\u0196\u0197\5|?\2\u0197\u0198")
        buf.write("\5\n\6\2\u0198?\3\2\2\2\u0199\u019a\5X-\2\u019a\u019d")
        buf.write("\t\4\2\2\u019b\u019e\5H%\2\u019c\u019e\5N(\2\u019d\u019b")
        buf.write("\3\2\2\2\u019d\u019c\3\2\2\2\u019e\u019f\3\2\2\2\u019f")
        buf.write("\u01a0\7>\2\2\u01a0A\3\2\2\2\u01a1\u01a2\5H%\2\u01a2\u01a3")
        buf.write("\7>\2\2\u01a3C\3\2\2\2\u01a4\u01a5\7\7\2\2\u01a5\u01a7")
        buf.write("\79\2\2\u01a6\u01a8\7o\2\2\u01a7\u01a6\3\2\2\2\u01a7\u01a8")
        buf.write("\3\2\2\2\u01a8\u01a9\3\2\2\2\u01a9\u01aa\7:\2\2\u01aa")
        buf.write("E\3\2\2\2\u01ab\u01ac\7\b\2\2\u01ac\u01b2\5h\65\2\u01ad")
        buf.write("\u01af\7;\2\2\u01ae\u01b0\5v<\2\u01af\u01ae\3\2\2\2\u01af")
        buf.write("\u01b0\3\2\2\2\u01b0\u01b1\3\2\2\2\u01b1\u01b3\7<\2\2")
        buf.write("\u01b2\u01ad\3\2\2\2\u01b2\u01b3\3\2\2\2\u01b3\u01b4\3")
        buf.write("\2\2\2\u01b4\u01b6\5x=\2\u01b5\u01b7\5Z.\2\u01b6\u01b5")
        buf.write("\3\2\2\2\u01b6\u01b7\3\2\2\2\u01b7\u01b8\3\2\2\2\u01b8")
        buf.write("\u01ba\79\2\2\u01b9\u01bb\7o\2\2\u01ba\u01b9\3\2\2\2\u01ba")
        buf.write("\u01bb\3\2\2\2\u01bb\u01bc\3\2\2\2\u01bc\u01bd\7:\2\2")
        buf.write("\u01bdG\3\2\2\2\u01be\u01bf\b%\1\2\u01bf\u01c0\7;\2\2")
        buf.write("\u01c0\u01c1\5H%\2\u01c1\u01c2\7<\2\2\u01c2\u01da\3\2")
        buf.write("\2\2\u01c3\u01c4\t\5\2\2\u01c4\u01da\5H%\21\u01c5\u01c8")
        buf.write("\5^\60\2\u01c6\u01c8\5b\62\2\u01c7\u01c5\3\2\2\2\u01c7")
        buf.write("\u01c6\3\2\2\2\u01c8\u01c9\3\2\2\2\u01c9\u01ca\7;\2\2")
        buf.write("\u01ca\u01cb\5H%\2\u01cb\u01cc\7<\2\2\u01cc\u01da\3\2")
        buf.write("\2\2\u01cd\u01ce\7\61\2\2\u01ce\u01cf\7;\2\2\u01cf\u01d0")
        buf.write("\5\n\6\2\u01d0\u01d1\7<\2\2\u01d1\u01da\3\2\2\2\u01d2")
        buf.write("\u01d3\7\\\2\2\u01d3\u01d5\7;\2\2\u01d4\u01d6\5z>\2\u01d5")
        buf.write("\u01d4\3\2\2\2\u01d5\u01d6\3\2\2\2\u01d6\u01d7\3\2\2\2")
        buf.write("\u01d7\u01da\7<\2\2\u01d8\u01da\t\6\2\2\u01d9\u01be\3")
        buf.write("\2\2\2\u01d9\u01c3\3\2\2\2\u01d9\u01c7\3\2\2\2\u01d9\u01cd")
        buf.write("\3\2\2\2\u01d9\u01d2\3\2\2\2\u01d9\u01d8\3\2\2\2\u01da")
        buf.write("\u0200\3\2\2\2\u01db\u01dc\f\22\2\2\u01dc\u01dd\7G\2\2")
        buf.write("\u01dd\u01ff\5H%\22\u01de\u01df\f\20\2\2\u01df\u01e0\t")
        buf.write("\7\2\2\u01e0\u01ff\5H%\21\u01e1\u01e2\f\17\2\2\u01e2\u01e3")
        buf.write("\t\b\2\2\u01e3\u01ff\5H%\20\u01e4\u01e5\f\16\2\2\u01e5")
        buf.write("\u01e6\7U\2\2\u01e6\u01ff\5H%\17\u01e7\u01e8\f\r\2\2\u01e8")
        buf.write("\u01e9\7T\2\2\u01e9\u01ff\5H%\16\u01ea\u01eb\f\f\2\2\u01eb")
        buf.write("\u01ec\7R\2\2\u01ec\u01ff\5H%\r\u01ed\u01ee\f\13\2\2\u01ee")
        buf.write("\u01ef\7L\2\2\u01ef\u01ff\5H%\f\u01f0\u01f1\f\n\2\2\u01f1")
        buf.write("\u01f2\7N\2\2\u01f2\u01ff\5H%\13\u01f3\u01f4\f\t\2\2\u01f4")
        buf.write("\u01f5\7J\2\2\u01f5\u01ff\5H%\n\u01f6\u01f7\f\b\2\2\u01f7")
        buf.write("\u01f8\7M\2\2\u01f8\u01ff\5H%\t\u01f9\u01fa\f\7\2\2\u01fa")
        buf.write("\u01fb\7K\2\2\u01fb\u01ff\5H%\b\u01fc\u01fd\f\23\2\2\u01fd")
        buf.write("\u01ff\5V,\2\u01fe\u01db\3\2\2\2\u01fe\u01de\3\2\2\2\u01fe")
        buf.write("\u01e1\3\2\2\2\u01fe\u01e4\3\2\2\2\u01fe\u01e7\3\2\2\2")
        buf.write("\u01fe\u01ea\3\2\2\2\u01fe\u01ed\3\2\2\2\u01fe\u01f0\3")
        buf.write("\2\2\2\u01fe\u01f3\3\2\2\2\u01fe\u01f6\3\2\2\2\u01fe\u01f9")
        buf.write("\3\2\2\2\u01fe\u01fc\3\2\2\2\u01ff\u0202\3\2\2\2\u0200")
        buf.write("\u01fe\3\2\2\2\u0200\u0201\3\2\2\2\u0201I\3\2\2\2\u0202")
        buf.write("\u0200\3\2\2\2\u0203\u0208\5H%\2\u0204\u0205\7D\2\2\u0205")
        buf.write("\u0207\5H%\2\u0206\u0204\3\2\2\2\u0207\u020a\3\2\2\2\u0208")
        buf.write("\u0206\3\2\2\2\u0208\u0209\3\2\2\2\u0209K\3\2\2\2\u020a")
        buf.write("\u0208\3\2\2\2\u020b\u020f\5T+\2\u020c\u020f\5H%\2\u020d")
        buf.write("\u020f\5N(\2\u020e\u020b\3\2\2\2\u020e\u020c\3\2\2\2\u020e")
        buf.write("\u020d\3\2\2\2\u020fM\3\2\2\2\u0210\u0211\7\64\2\2\u0211")
        buf.write("\u0212\5n8\2\u0212O\3\2\2\2\u0213\u0215\5H%\2\u0214\u0213")
        buf.write("\3\2\2\2\u0214\u0215\3\2\2\2\u0215\u0216\3\2\2\2\u0216")
        buf.write("\u0218\7=\2\2\u0217\u0219\5H%\2\u0218\u0217\3\2\2\2\u0218")
        buf.write("\u0219\3\2\2\2\u0219\u021c\3\2\2\2\u021a\u021b\7=\2\2")
        buf.write("\u021b\u021d\5H%\2\u021c\u021a\3\2\2\2\u021c\u021d\3\2")
        buf.write("\2\2\u021dQ\3\2\2\2\u021e\u021f\79\2\2\u021f\u0224\5H")
        buf.write("%\2\u0220\u0221\7@\2\2\u0221\u0223\5H%\2\u0222\u0220\3")
        buf.write("\2\2\2\u0223\u0226\3\2\2\2\u0224\u0222\3\2\2\2\u0224\u0225")
        buf.write("\3\2\2\2\u0225\u0228\3\2\2\2\u0226\u0224\3\2\2\2\u0227")
        buf.write("\u0229\7@\2\2\u0228\u0227\3\2\2\2\u0228\u0229\3\2\2\2")
        buf.write("\u0229\u022a\3\2\2\2\u022a\u022b\7:\2\2\u022bS\3\2\2\2")
        buf.write("\u022c\u022f\79\2\2\u022d\u0230\5H%\2\u022e\u0230\5T+")
        buf.write("\2\u022f\u022d\3\2\2\2\u022f\u022e\3\2\2\2\u0230\u0238")
        buf.write("\3\2\2\2\u0231\u0234\7@\2\2\u0232\u0235\5H%\2\u0233\u0235")
        buf.write("\5T+\2\u0234\u0232\3\2\2\2\u0234\u0233\3\2\2\2\u0235\u0237")
        buf.write("\3\2\2\2\u0236\u0231\3\2\2\2\u0237\u023a\3\2\2\2\u0238")
        buf.write("\u0236\3\2\2\2\u0238\u0239\3\2\2\2\u0239\u023c\3\2\2\2")
        buf.write("\u023a\u0238\3\2\2\2\u023b\u023d\7@\2\2\u023c\u023b\3")
        buf.write("\2\2\2\u023c\u023d\3\2\2\2\u023d\u023e\3\2\2\2\u023e\u023f")
        buf.write("\7:\2\2\u023fU\3\2\2\2\u0240\u0253\7\67\2\2\u0241\u0254")
        buf.write("\5R*\2\u0242\u0245\5H%\2\u0243\u0245\5P)\2\u0244\u0242")
        buf.write("\3\2\2\2\u0244\u0243\3\2\2\2\u0245\u024d\3\2\2\2\u0246")
        buf.write("\u0249\7@\2\2\u0247\u024a\5H%\2\u0248\u024a\5P)\2\u0249")
        buf.write("\u0247\3\2\2\2\u0249\u0248\3\2\2\2\u024a\u024c\3\2\2\2")
        buf.write("\u024b\u0246\3\2\2\2\u024c\u024f\3\2\2\2\u024d\u024b\3")
        buf.write("\2\2\2\u024d\u024e\3\2\2\2\u024e\u0251\3\2\2\2\u024f\u024d")
        buf.write("\3\2\2\2\u0250\u0252\7@\2\2\u0251\u0250\3\2\2\2\u0251")
        buf.write("\u0252\3\2\2\2\u0252\u0254\3\2\2\2\u0253\u0241\3\2\2\2")
        buf.write("\u0253\u0244\3\2\2\2\u0254\u0255\3\2\2\2\u0255\u0256\7")
        buf.write("8\2\2\u0256W\3\2\2\2\u0257\u025b\7\\\2\2\u0258\u025a\5")
        buf.write("V,\2\u0259\u0258\3\2\2\2\u025a\u025d\3\2\2\2\u025b\u0259")
        buf.write("\3\2\2\2\u025b\u025c\3\2\2\2\u025cY\3\2\2\2\u025d\u025b")
        buf.write("\3\2\2\2\u025e\u025f\7B\2\2\u025f\u0260\5^\60\2\u0260")
        buf.write("[\3\2\2\2\u0261\u026f\7,\2\2\u0262\u0263\7-\2\2\u0263")
        buf.write("\u0264\7;\2\2\u0264\u0265\5H%\2\u0265\u0266\7<\2\2\u0266")
        buf.write("\u026f\3\2\2\2\u0267\u026c\t\t\2\2\u0268\u0269\7;\2\2")
        buf.write("\u0269\u026a\5H%\2\u026a\u026b\7<\2\2\u026b\u026d\3\2")
        buf.write("\2\2\u026c\u0268\3\2\2\2\u026c\u026d\3\2\2\2\u026d\u026f")
        buf.write("\3\2\2\2\u026e\u0261\3\2\2\2\u026e\u0262\3\2\2\2\u026e")
        buf.write("\u0267\3\2\2\2\u026f\u0270\3\2\2\2\u0270\u0271\7O\2\2")
        buf.write("\u0271]\3\2\2\2\u0272\u0274\7!\2\2\u0273\u0275\5f\64\2")
        buf.write("\u0274\u0273\3\2\2\2\u0274\u0275\3\2\2\2\u0275\u0291\3")
        buf.write("\2\2\2\u0276\u0278\7\"\2\2\u0277\u0279\5f\64\2\u0278\u0277")
        buf.write("\3\2\2\2\u0278\u0279\3\2\2\2\u0279\u0291\3\2\2\2\u027a")
        buf.write("\u027c\7#\2\2\u027b\u027d\5f\64\2\u027c\u027b\3\2\2\2")
        buf.write("\u027c\u027d\3\2\2\2\u027d\u0291\3\2\2\2\u027e\u0280\7")
        buf.write("$\2\2\u027f\u0281\5f\64\2\u0280\u027f\3\2\2\2\u0280\u0281")
        buf.write("\3\2\2\2\u0281\u0291\3\2\2\2\u0282\u0284\7%\2\2\u0283")
        buf.write("\u0285\5f\64\2\u0284\u0283\3\2\2\2\u0284\u0285\3\2\2\2")
        buf.write("\u0285\u0291\3\2\2\2\u0286\u0291\7 \2\2\u0287\u0291\7")
        buf.write(")\2\2\u0288\u0291\7*\2\2\u0289\u028e\7&\2\2\u028a\u028b")
        buf.write("\7\67\2\2\u028b\u028c\5^\60\2\u028c\u028d\78\2\2\u028d")
        buf.write("\u028f\3\2\2\2\u028e\u028a\3\2\2\2\u028e\u028f\3\2\2\2")
        buf.write("\u028f\u0291\3\2\2\2\u0290\u0272\3\2\2\2\u0290\u0276\3")
        buf.write("\2\2\2\u0290\u027a\3\2\2\2\u0290\u027e\3\2\2\2\u0290\u0282")
        buf.write("\3\2\2\2\u0290\u0286\3\2\2\2\u0290\u0287\3\2\2\2\u0290")
        buf.write("\u0288\3\2\2\2\u0290\u0289\3\2\2\2\u0291_\3\2\2\2\u0292")
        buf.write("\u0294\7\36\2\2\u0293\u0295\5f\64\2\u0294\u0293\3\2\2")
        buf.write("\2\u0294\u0295\3\2\2\2\u0295a\3\2\2\2\u0296\u0297\7\'")
        buf.write("\2\2\u0297\u0298\7\67\2\2\u0298\u0299\5^\60\2\u0299\u029a")
        buf.write("\7@\2\2\u029a\u029b\5z>\2\u029b\u029c\78\2\2\u029cc\3")
        buf.write("\2\2\2\u029d\u029e\t\n\2\2\u029e\u029f\7\'\2\2\u029f\u02a0")
        buf.write("\7\67\2\2\u02a0\u02a1\5^\60\2\u02a1\u02a6\7@\2\2\u02a2")
        buf.write("\u02a7\5z>\2\u02a3\u02a4\7\60\2\2\u02a4\u02a5\7A\2\2\u02a5")
        buf.write("\u02a7\5H%\2\u02a6\u02a2\3\2\2\2\u02a6\u02a3\3\2\2\2\u02a7")
        buf.write("\u02a8\3\2\2\2\u02a8\u02a9\78\2\2\u02a9e\3\2\2\2\u02aa")
        buf.write("\u02ab\7\67\2\2\u02ab\u02ac\5H%\2\u02ac\u02ad\78\2\2\u02ad")
        buf.write("g\3\2\2\2\u02ae\u02af\t\13\2\2\u02afi\3\2\2\2\u02b0\u02b3")
        buf.write("\5H%\2\u02b1\u02b3\5r:\2\u02b2\u02b0\3\2\2\2\u02b2\u02b1")
        buf.write("\3\2\2\2\u02b3k\3\2\2\2\u02b4\u02b5\t\f\2\2\u02b5m\3\2")
        buf.write("\2\2\u02b6\u02b9\5X-\2\u02b7\u02b9\7]\2\2\u02b8\u02b6")
        buf.write("\3\2\2\2\u02b8\u02b7\3\2\2\2\u02b9o\3\2\2\2\u02ba\u02c1")
        buf.write("\5^\60\2\u02bb\u02c1\5d\63\2\u02bc\u02be\7\37\2\2\u02bd")
        buf.write("\u02bf\5f\64\2\u02be\u02bd\3\2\2\2\u02be\u02bf\3\2\2\2")
        buf.write("\u02bf\u02c1\3\2\2\2\u02c0\u02ba\3\2\2\2\u02c0\u02bb\3")
        buf.write("\2\2\2\u02c0\u02bc\3\2\2\2\u02c1q\3\2\2\2\u02c2\u02c3")
        buf.write("\5^\60\2\u02c3\u02c4\7\\\2\2\u02c4\u02d1\3\2\2\2\u02c5")
        buf.write("\u02c6\5`\61\2\u02c6\u02c7\7\\\2\2\u02c7\u02d1\3\2\2\2")
        buf.write("\u02c8\u02c9\t\3\2\2\u02c9\u02cb\7\\\2\2\u02ca\u02cc\5")
        buf.write("f\64\2\u02cb\u02ca\3\2\2\2\u02cb\u02cc\3\2\2\2\u02cc\u02d1")
        buf.write("\3\2\2\2\u02cd\u02ce\5d\63\2\u02ce\u02cf\7\\\2\2\u02cf")
        buf.write("\u02d1\3\2\2\2\u02d0\u02c2\3\2\2\2\u02d0\u02c5\3\2\2\2")
        buf.write("\u02d0\u02c8\3\2\2\2\u02d0\u02cd\3\2\2\2\u02d1s\3\2\2")
        buf.write("\2\u02d2\u02d7\5r:\2\u02d3\u02d4\7@\2\2\u02d4\u02d6\5")
        buf.write("r:\2\u02d5\u02d3\3\2\2\2\u02d6\u02d9\3\2\2\2\u02d7\u02d5")
        buf.write("\3\2\2\2\u02d7\u02d8\3\2\2\2\u02d8\u02db\3\2\2\2\u02d9")
        buf.write("\u02d7\3\2\2\2\u02da\u02dc\7@\2\2\u02db\u02da\3\2\2\2")
        buf.write("\u02db\u02dc\3\2\2\2\u02dcu\3\2\2\2\u02dd\u02e2\5j\66")
        buf.write("\2\u02de\u02df\7@\2\2\u02df\u02e1\5j\66\2\u02e0\u02de")
        buf.write("\3\2\2\2\u02e1\u02e4\3\2\2\2\u02e2\u02e0\3\2\2\2\u02e2")
        buf.write("\u02e3\3\2\2\2\u02e3\u02e6\3\2\2\2\u02e4\u02e2\3\2\2\2")
        buf.write("\u02e5\u02e7\7@\2\2\u02e6\u02e5\3\2\2\2\u02e6\u02e7\3")
        buf.write("\2\2\2\u02e7w\3\2\2\2\u02e8\u02ed\5l\67\2\u02e9\u02ea")
        buf.write("\7@\2\2\u02ea\u02ec\5l\67\2\u02eb\u02e9\3\2\2\2\u02ec")
        buf.write("\u02ef\3\2\2\2\u02ed\u02eb\3\2\2\2\u02ed\u02ee\3\2\2\2")
        buf.write("\u02ee\u02f1\3\2\2\2\u02ef\u02ed\3\2\2\2\u02f0\u02f2\7")
        buf.write("@\2\2\u02f1\u02f0\3\2\2\2\u02f1\u02f2\3\2\2\2\u02f2y\3")
        buf.write("\2\2\2\u02f3\u02f8\5H%\2\u02f4\u02f5\7@\2\2\u02f5\u02f7")
        buf.write("\5H%\2\u02f6\u02f4\3\2\2\2\u02f7\u02fa\3\2\2\2\u02f8\u02f6")
        buf.write("\3\2\2\2\u02f8\u02f9\3\2\2\2\u02f9\u02fc\3\2\2\2\u02fa")
        buf.write("\u02f8\3\2\2\2\u02fb\u02fd\7@\2\2\u02fc\u02fb\3\2\2\2")
        buf.write("\u02fc\u02fd\3\2\2\2\u02fd{\3\2\2\2\u02fe\u0303\7\\\2")
        buf.write("\2\u02ff\u0300\7@\2\2\u0300\u0302\7\\\2\2\u0301\u02ff")
        buf.write("\3\2\2\2\u0302\u0305\3\2\2\2\u0303\u0301\3\2\2\2\u0303")
        buf.write("\u0304\3\2\2\2\u0304\u0307\3\2\2\2\u0305\u0303\3\2\2\2")
        buf.write("\u0306\u0308\7@\2\2\u0307\u0306\3\2\2\2\u0307\u0308\3")
        buf.write("\2\2\2\u0308}\3\2\2\2\u0309\u030e\5n8\2\u030a\u030b\7")
        buf.write("@\2\2\u030b\u030d\5n8\2\u030c\u030a\3\2\2\2\u030d\u0310")
        buf.write("\3\2\2\2\u030e\u030c\3\2\2\2\u030e\u030f\3\2\2\2\u030f")
        buf.write("\u0312\3\2\2\2\u0310\u030e\3\2\2\2\u0311\u0313\7@\2\2")
        buf.write("\u0312\u0311\3\2\2\2\u0312\u0313\3\2\2\2\u0313\177\3\2")
        buf.write("\2\2\u0314\u0319\5p9\2\u0315\u0316\7@\2\2\u0316\u0318")
        buf.write("\5p9\2\u0317\u0315\3\2\2\2\u0318\u031b\3\2\2\2\u0319\u0317")
        buf.write("\3\2\2\2\u0319\u031a\3\2\2\2\u031a\u031d\3\2\2\2\u031b")
        buf.write("\u0319\3\2\2\2\u031c\u031e\7@\2\2\u031d\u031c\3\2\2\2")
        buf.write("\u031d\u031e\3\2\2\2\u031e\u0081\3\2\2\2`\u0083\u0088")
        buf.write("\u0095\u00b4\u00b6\u00ba\u00c0\u00ca\u00e7\u00f2\u00f7")
        buf.write("\u0103\u0109\u0110\u0117\u011d\u0120\u0123\u012b\u0131")
        buf.write("\u0134\u0137\u013a\u013d\u0142\u0152\u0157\u0165\u016d")
        buf.write("\u0179\u017d\u0185\u0189\u0191\u0194\u019d\u01a7\u01af")
        buf.write("\u01b2\u01b6\u01ba\u01c7\u01d5\u01d9\u01fe\u0200\u0208")
        buf.write("\u020e\u0214\u0218\u021c\u0224\u0228\u022f\u0234\u0238")
        buf.write("\u023c\u0244\u0249\u024d\u0251\u0253\u025b\u026c\u026e")
        buf.write("\u0274\u0278\u027c\u0280\u0284\u028e\u0290\u0294\u02a6")
        buf.write("\u02b2\u02b8\u02be\u02c0\u02cb\u02d0\u02d7\u02db\u02e2")
        buf.write("\u02e6\u02ed\u02f1\u02f8\u02fc\u0303\u0307\u030e\u0312")
        buf.write("\u0319\u031d")
        return buf.getvalue()


class qasm3Parser ( Parser ):

    grammarFileName = "qasm3Parser.g4"

    atn = ATNDeserializer().deserialize(serializedATN())

    decisionsToDFA = [ DFA(ds, i) for i, ds in enumerate(atn.decisionToState) ]

    sharedContextCache = PredictionContextCache()

    literalNames = [ "<INVALID>", "'OPENQASM'", "'include'", "'defcalgrammar'", 
                     "'def'", "'cal'", "'defcal'", "'gate'", "'extern'", 
                     "'box'", "'let'", "'break'", "'continue'", "'if'", 
                     "'else'", "'end'", "'return'", "'for'", "'while'", 
                     "'in'", "<INVALID>", "<INVALID>", "'input'", "'output'", 
                     "'const'", "'readonly'", "'mutable'", "'qreg'", "'qubit'", 
                     "'creg'", "'bool'", "'bit'", "'int'", "'uint'", "'float'", 
                     "'angle'", "'complex'", "'array'", "'void'", "'duration'", 
                     "'stretch'", "'gphase'", "'inv'", "'pow'", "'ctrl'", 
                     "'negctrl'", "'#dim'", "'durationof'", "'delay'", "'reset'", 
                     "'measure'", "'barrier'", "<INVALID>", "'['", "']'", 
                     "'{'", "'}'", "'('", "')'", "':'", "';'", "'.'", "','", 
                     "'='", "'->'", "'+'", "'++'", "'-'", "'*'", "'**'", 
                     "'/'", "'%'", "'|'", "'||'", "'&'", "'&&'", "'^'", 
                     "'@'", "'~'", "'!'", "<INVALID>", "<INVALID>", "<INVALID>", 
                     "<INVALID>", "'im'" ]

    symbolicNames = [ "<INVALID>", "OPENQASM", "INCLUDE", "DEFCALGRAMMAR", 
                      "DEF", "CAL", "DEFCAL", "GATE", "EXTERN", "BOX", "LET", 
                      "BREAK", "CONTINUE", "IF", "ELSE", "END", "RETURN", 
                      "FOR", "WHILE", "IN", "PRAGMA", "AnnotationKeyword", 
                      "INPUT", "OUTPUT", "CONST", "READONLY", "MUTABLE", 
                      "QREG", "QUBIT", "CREG", "BOOL", "BIT", "INT", "UINT", 
                      "FLOAT", "ANGLE", "COMPLEX", "ARRAY", "VOID", "DURATION", 
                      "STRETCH", "GPHASE", "INV", "POW", "CTRL", "NEGCTRL", 
                      "DIM", "DURATIONOF", "DELAY", "RESET", "MEASURE", 
                      "BARRIER", "BooleanLiteral", "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", "EqualityOperator", 
                      "CompoundAssignmentOperator", "ComparisonOperator", 
                      "BitshiftOperator", "IMAG", "ImaginaryLiteral", "BinaryIntegerLiteral", 
                      "OctalIntegerLiteral", "DecimalIntegerLiteral", "HexIntegerLiteral", 
                      "Identifier", "HardwareQubit", "FloatLiteral", "TimingLiteral", 
                      "BitstringLiteral", "StringLiteral", "Whitespace", 
                      "Newline", "LineComment", "BlockComment", "VERSION_IDENTIFER_WHITESPACE", 
                      "VersionSpecifier", "EAT_INITIAL_SPACE", "EAT_LINE_END", 
                      "RemainingLineContent", "CAL_PRELUDE_WHITESPACE", 
                      "CAL_PRELUDE_COMMENT", "DEFCAL_PRELUDE_WHITESPACE", 
                      "DEFCAL_PRELUDE_COMMENT", "CalibrationBlock" ]

    RULE_program = 0
    RULE_version = 1
    RULE_statement = 2
    RULE_annotation = 3
    RULE_scope = 4
    RULE_pragma = 5
    RULE_statementOrScope = 6
    RULE_calibrationGrammarStatement = 7
    RULE_includeStatement = 8
    RULE_breakStatement = 9
    RULE_continueStatement = 10
    RULE_endStatement = 11
    RULE_forStatement = 12
    RULE_ifStatement = 13
    RULE_returnStatement = 14
    RULE_whileStatement = 15
    RULE_barrierStatement = 16
    RULE_boxStatement = 17
    RULE_delayStatement = 18
    RULE_gateCallStatement = 19
    RULE_measureArrowAssignmentStatement = 20
    RULE_resetStatement = 21
    RULE_aliasDeclarationStatement = 22
    RULE_classicalDeclarationStatement = 23
    RULE_constDeclarationStatement = 24
    RULE_ioDeclarationStatement = 25
    RULE_oldStyleDeclarationStatement = 26
    RULE_quantumDeclarationStatement = 27
    RULE_defStatement = 28
    RULE_externStatement = 29
    RULE_gateStatement = 30
    RULE_assignmentStatement = 31
    RULE_expressionStatement = 32
    RULE_calStatement = 33
    RULE_defcalStatement = 34
    RULE_expression = 35
    RULE_aliasExpression = 36
    RULE_declarationExpression = 37
    RULE_measureExpression = 38
    RULE_rangeExpression = 39
    RULE_setExpression = 40
    RULE_arrayLiteral = 41
    RULE_indexOperator = 42
    RULE_indexedIdentifier = 43
    RULE_returnSignature = 44
    RULE_gateModifier = 45
    RULE_scalarType = 46
    RULE_qubitType = 47
    RULE_arrayType = 48
    RULE_arrayReferenceType = 49
    RULE_designator = 50
    RULE_defcalTarget = 51
    RULE_defcalArgumentDefinition = 52
    RULE_defcalOperand = 53
    RULE_gateOperand = 54
    RULE_externArgument = 55
    RULE_argumentDefinition = 56
    RULE_argumentDefinitionList = 57
    RULE_defcalArgumentDefinitionList = 58
    RULE_defcalOperandList = 59
    RULE_expressionList = 60
    RULE_identifierList = 61
    RULE_gateOperandList = 62
    RULE_externArgumentList = 63

    ruleNames =  [ "program", "version", "statement", "annotation", "scope", 
                   "pragma", "statementOrScope", "calibrationGrammarStatement", 
                   "includeStatement", "breakStatement", "continueStatement", 
                   "endStatement", "forStatement", "ifStatement", "returnStatement", 
                   "whileStatement", "barrierStatement", "boxStatement", 
                   "delayStatement", "gateCallStatement", "measureArrowAssignmentStatement", 
                   "resetStatement", "aliasDeclarationStatement", "classicalDeclarationStatement", 
                   "constDeclarationStatement", "ioDeclarationStatement", 
                   "oldStyleDeclarationStatement", "quantumDeclarationStatement", 
                   "defStatement", "externStatement", "gateStatement", "assignmentStatement", 
                   "expressionStatement", "calStatement", "defcalStatement", 
                   "expression", "aliasExpression", "declarationExpression", 
                   "measureExpression", "rangeExpression", "setExpression", 
                   "arrayLiteral", "indexOperator", "indexedIdentifier", 
                   "returnSignature", "gateModifier", "scalarType", "qubitType", 
                   "arrayType", "arrayReferenceType", "designator", "defcalTarget", 
                   "defcalArgumentDefinition", "defcalOperand", "gateOperand", 
                   "externArgument", "argumentDefinition", "argumentDefinitionList", 
                   "defcalArgumentDefinitionList", "defcalOperandList", 
                   "expressionList", "identifierList", "gateOperandList", 
                   "externArgumentList" ]

    EOF = Token.EOF
    OPENQASM=1
    INCLUDE=2
    DEFCALGRAMMAR=3
    DEF=4
    CAL=5
    DEFCAL=6
    GATE=7
    EXTERN=8
    BOX=9
    LET=10
    BREAK=11
    CONTINUE=12
    IF=13
    ELSE=14
    END=15
    RETURN=16
    FOR=17
    WHILE=18
    IN=19
    PRAGMA=20
    AnnotationKeyword=21
    INPUT=22
    OUTPUT=23
    CONST=24
    READONLY=25
    MUTABLE=26
    QREG=27
    QUBIT=28
    CREG=29
    BOOL=30
    BIT=31
    INT=32
    UINT=33
    FLOAT=34
    ANGLE=35
    COMPLEX=36
    ARRAY=37
    VOID=38
    DURATION=39
    STRETCH=40
    GPHASE=41
    INV=42
    POW=43
    CTRL=44
    NEGCTRL=45
    DIM=46
    DURATIONOF=47
    DELAY=48
    RESET=49
    MEASURE=50
    BARRIER=51
    BooleanLiteral=52
    LBRACKET=53
    RBRACKET=54
    LBRACE=55
    RBRACE=56
    LPAREN=57
    RPAREN=58
    COLON=59
    SEMICOLON=60
    DOT=61
    COMMA=62
    EQUALS=63
    ARROW=64
    PLUS=65
    DOUBLE_PLUS=66
    MINUS=67
    ASTERISK=68
    DOUBLE_ASTERISK=69
    SLASH=70
    PERCENT=71
    PIPE=72
    DOUBLE_PIPE=73
    AMPERSAND=74
    DOUBLE_AMPERSAND=75
    CARET=76
    AT=77
    TILDE=78
    EXCLAMATION_POINT=79
    EqualityOperator=80
    CompoundAssignmentOperator=81
    ComparisonOperator=82
    BitshiftOperator=83
    IMAG=84
    ImaginaryLiteral=85
    BinaryIntegerLiteral=86
    OctalIntegerLiteral=87
    DecimalIntegerLiteral=88
    HexIntegerLiteral=89
    Identifier=90
    HardwareQubit=91
    FloatLiteral=92
    TimingLiteral=93
    BitstringLiteral=94
    StringLiteral=95
    Whitespace=96
    Newline=97
    LineComment=98
    BlockComment=99
    VERSION_IDENTIFER_WHITESPACE=100
    VersionSpecifier=101
    EAT_INITIAL_SPACE=102
    EAT_LINE_END=103
    RemainingLineContent=104
    CAL_PRELUDE_WHITESPACE=105
    CAL_PRELUDE_COMMENT=106
    DEFCAL_PRELUDE_WHITESPACE=107
    DEFCAL_PRELUDE_COMMENT=108
    CalibrationBlock=109

    def __init__(self, input:TokenStream, output:TextIO = sys.stdout):
        super().__init__(input, output)
        self.checkVersion("4.7.2")
        self._interp = ParserATNSimulator(self, self.atn, self.decisionsToDFA, self.sharedContextCache)
        self._predicates = None




    class ProgramContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def EOF(self):
            return self.getToken(qasm3Parser.EOF, 0)

        def version(self):
            return self.getTypedRuleContext(qasm3Parser.VersionContext,0)


        def statement(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(qasm3Parser.StatementContext)
            else:
                return self.getTypedRuleContext(qasm3Parser.StatementContext,i)


        def getRuleIndex(self):
            return qasm3Parser.RULE_program

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterProgram" ):
                listener.enterProgram(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitProgram" ):
                listener.exitProgram(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitProgram" ):
                return visitor.visitProgram(self)
            else:
                return visitor.visitChildren(self)




    def program(self):

        localctx = qasm3Parser.ProgramContext(self, self._ctx, self.state)
        self.enterRule(localctx, 0, self.RULE_program)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 129
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.OPENQASM:
                self.state = 128
                self.version()


            self.state = 134
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << qasm3Parser.INCLUDE) | (1 << qasm3Parser.DEFCALGRAMMAR) | (1 << qasm3Parser.DEF) | (1 << qasm3Parser.CAL) | (1 << qasm3Parser.DEFCAL) | (1 << qasm3Parser.GATE) | (1 << qasm3Parser.EXTERN) | (1 << qasm3Parser.BOX) | (1 << qasm3Parser.LET) | (1 << qasm3Parser.BREAK) | (1 << qasm3Parser.CONTINUE) | (1 << qasm3Parser.IF) | (1 << qasm3Parser.END) | (1 << qasm3Parser.RETURN) | (1 << qasm3Parser.FOR) | (1 << qasm3Parser.WHILE) | (1 << qasm3Parser.PRAGMA) | (1 << qasm3Parser.AnnotationKeyword) | (1 << qasm3Parser.INPUT) | (1 << qasm3Parser.OUTPUT) | (1 << qasm3Parser.CONST) | (1 << qasm3Parser.QREG) | (1 << qasm3Parser.QUBIT) | (1 << qasm3Parser.CREG) | (1 << qasm3Parser.BOOL) | (1 << qasm3Parser.BIT) | (1 << qasm3Parser.INT) | (1 << qasm3Parser.UINT) | (1 << qasm3Parser.FLOAT) | (1 << qasm3Parser.ANGLE) | (1 << qasm3Parser.COMPLEX) | (1 << qasm3Parser.ARRAY) | (1 << qasm3Parser.DURATION) | (1 << qasm3Parser.STRETCH) | (1 << qasm3Parser.GPHASE) | (1 << qasm3Parser.INV) | (1 << qasm3Parser.POW) | (1 << qasm3Parser.CTRL) | (1 << qasm3Parser.NEGCTRL) | (1 << qasm3Parser.DURATIONOF) | (1 << qasm3Parser.DELAY) | (1 << qasm3Parser.RESET) | (1 << qasm3Parser.MEASURE) | (1 << qasm3Parser.BARRIER) | (1 << qasm3Parser.BooleanLiteral) | (1 << qasm3Parser.LPAREN))) != 0) or ((((_la - 67)) & ~0x3f) == 0 and ((1 << (_la - 67)) & ((1 << (qasm3Parser.MINUS - 67)) | (1 << (qasm3Parser.TILDE - 67)) | (1 << (qasm3Parser.EXCLAMATION_POINT - 67)) | (1 << (qasm3Parser.ImaginaryLiteral - 67)) | (1 << (qasm3Parser.BinaryIntegerLiteral - 67)) | (1 << (qasm3Parser.OctalIntegerLiteral - 67)) | (1 << (qasm3Parser.DecimalIntegerLiteral - 67)) | (1 << (qasm3Parser.HexIntegerLiteral - 67)) | (1 << (qasm3Parser.Identifier - 67)) | (1 << (qasm3Parser.HardwareQubit - 67)) | (1 << (qasm3Parser.FloatLiteral - 67)) | (1 << (qasm3Parser.TimingLiteral - 67)) | (1 << (qasm3Parser.BitstringLiteral - 67)))) != 0):
                self.state = 131
                self.statement()
                self.state = 136
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 137
            self.match(qasm3Parser.EOF)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class VersionContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def OPENQASM(self):
            return self.getToken(qasm3Parser.OPENQASM, 0)

        def VersionSpecifier(self):
            return self.getToken(qasm3Parser.VersionSpecifier, 0)

        def SEMICOLON(self):
            return self.getToken(qasm3Parser.SEMICOLON, 0)

        def getRuleIndex(self):
            return qasm3Parser.RULE_version

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterVersion" ):
                listener.enterVersion(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitVersion" ):
                listener.exitVersion(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitVersion" ):
                return visitor.visitVersion(self)
            else:
                return visitor.visitChildren(self)




    def version(self):

        localctx = qasm3Parser.VersionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 2, self.RULE_version)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 139
            self.match(qasm3Parser.OPENQASM)
            self.state = 140
            self.match(qasm3Parser.VersionSpecifier)
            self.state = 141
            self.match(qasm3Parser.SEMICOLON)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class StatementContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def pragma(self):
            return self.getTypedRuleContext(qasm3Parser.PragmaContext,0)


        def aliasDeclarationStatement(self):
            return self.getTypedRuleContext(qasm3Parser.AliasDeclarationStatementContext,0)


        def assignmentStatement(self):
            return self.getTypedRuleContext(qasm3Parser.AssignmentStatementContext,0)


        def barrierStatement(self):
            return self.getTypedRuleContext(qasm3Parser.BarrierStatementContext,0)


        def boxStatement(self):
            return self.getTypedRuleContext(qasm3Parser.BoxStatementContext,0)


        def breakStatement(self):
            return self.getTypedRuleContext(qasm3Parser.BreakStatementContext,0)


        def calStatement(self):
            return self.getTypedRuleContext(qasm3Parser.CalStatementContext,0)


        def calibrationGrammarStatement(self):
            return self.getTypedRuleContext(qasm3Parser.CalibrationGrammarStatementContext,0)


        def classicalDeclarationStatement(self):
            return self.getTypedRuleContext(qasm3Parser.ClassicalDeclarationStatementContext,0)


        def constDeclarationStatement(self):
            return self.getTypedRuleContext(qasm3Parser.ConstDeclarationStatementContext,0)


        def continueStatement(self):
            return self.getTypedRuleContext(qasm3Parser.ContinueStatementContext,0)


        def defStatement(self):
            return self.getTypedRuleContext(qasm3Parser.DefStatementContext,0)


        def defcalStatement(self):
            return self.getTypedRuleContext(qasm3Parser.DefcalStatementContext,0)


        def delayStatement(self):
            return self.getTypedRuleContext(qasm3Parser.DelayStatementContext,0)


        def endStatement(self):
            return self.getTypedRuleContext(qasm3Parser.EndStatementContext,0)


        def expressionStatement(self):
            return self.getTypedRuleContext(qasm3Parser.ExpressionStatementContext,0)


        def externStatement(self):
            return self.getTypedRuleContext(qasm3Parser.ExternStatementContext,0)


        def forStatement(self):
            return self.getTypedRuleContext(qasm3Parser.ForStatementContext,0)


        def gateCallStatement(self):
            return self.getTypedRuleContext(qasm3Parser.GateCallStatementContext,0)


        def gateStatement(self):
            return self.getTypedRuleContext(qasm3Parser.GateStatementContext,0)


        def ifStatement(self):
            return self.getTypedRuleContext(qasm3Parser.IfStatementContext,0)


        def includeStatement(self):
            return self.getTypedRuleContext(qasm3Parser.IncludeStatementContext,0)


        def ioDeclarationStatement(self):
            return self.getTypedRuleContext(qasm3Parser.IoDeclarationStatementContext,0)


        def measureArrowAssignmentStatement(self):
            return self.getTypedRuleContext(qasm3Parser.MeasureArrowAssignmentStatementContext,0)


        def oldStyleDeclarationStatement(self):
            return self.getTypedRuleContext(qasm3Parser.OldStyleDeclarationStatementContext,0)


        def quantumDeclarationStatement(self):
            return self.getTypedRuleContext(qasm3Parser.QuantumDeclarationStatementContext,0)


        def resetStatement(self):
            return self.getTypedRuleContext(qasm3Parser.ResetStatementContext,0)


        def returnStatement(self):
            return self.getTypedRuleContext(qasm3Parser.ReturnStatementContext,0)


        def whileStatement(self):
            return self.getTypedRuleContext(qasm3Parser.WhileStatementContext,0)


        def annotation(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(qasm3Parser.AnnotationContext)
            else:
                return self.getTypedRuleContext(qasm3Parser.AnnotationContext,i)


        def getRuleIndex(self):
            return qasm3Parser.RULE_statement

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterStatement" ):
                listener.enterStatement(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitStatement" ):
                listener.exitStatement(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitStatement" ):
                return visitor.visitStatement(self)
            else:
                return visitor.visitChildren(self)




    def statement(self):

        localctx = qasm3Parser.StatementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 4, self.RULE_statement)
        self._la = 0 # Token type
        try:
            self.state = 180
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [qasm3Parser.PRAGMA]:
                self.enterOuterAlt(localctx, 1)
                self.state = 143
                self.pragma()
                pass
            elif token in [qasm3Parser.INCLUDE, qasm3Parser.DEFCALGRAMMAR, qasm3Parser.DEF, qasm3Parser.CAL, qasm3Parser.DEFCAL, qasm3Parser.GATE, qasm3Parser.EXTERN, qasm3Parser.BOX, qasm3Parser.LET, qasm3Parser.BREAK, qasm3Parser.CONTINUE, qasm3Parser.IF, qasm3Parser.END, qasm3Parser.RETURN, qasm3Parser.FOR, qasm3Parser.WHILE, qasm3Parser.AnnotationKeyword, qasm3Parser.INPUT, qasm3Parser.OUTPUT, qasm3Parser.CONST, qasm3Parser.QREG, qasm3Parser.QUBIT, qasm3Parser.CREG, qasm3Parser.BOOL, qasm3Parser.BIT, qasm3Parser.INT, qasm3Parser.UINT, qasm3Parser.FLOAT, qasm3Parser.ANGLE, qasm3Parser.COMPLEX, qasm3Parser.ARRAY, qasm3Parser.DURATION, qasm3Parser.STRETCH, qasm3Parser.GPHASE, qasm3Parser.INV, qasm3Parser.POW, qasm3Parser.CTRL, qasm3Parser.NEGCTRL, qasm3Parser.DURATIONOF, qasm3Parser.DELAY, qasm3Parser.RESET, qasm3Parser.MEASURE, qasm3Parser.BARRIER, qasm3Parser.BooleanLiteral, qasm3Parser.LPAREN, qasm3Parser.MINUS, qasm3Parser.TILDE, qasm3Parser.EXCLAMATION_POINT, qasm3Parser.ImaginaryLiteral, qasm3Parser.BinaryIntegerLiteral, qasm3Parser.OctalIntegerLiteral, qasm3Parser.DecimalIntegerLiteral, qasm3Parser.HexIntegerLiteral, qasm3Parser.Identifier, qasm3Parser.HardwareQubit, qasm3Parser.FloatLiteral, qasm3Parser.TimingLiteral, qasm3Parser.BitstringLiteral]:
                self.enterOuterAlt(localctx, 2)
                self.state = 147
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==qasm3Parser.AnnotationKeyword:
                    self.state = 144
                    self.annotation()
                    self.state = 149
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

                self.state = 178
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,3,self._ctx)
                if la_ == 1:
                    self.state = 150
                    self.aliasDeclarationStatement()
                    pass

                elif la_ == 2:
                    self.state = 151
                    self.assignmentStatement()
                    pass

                elif la_ == 3:
                    self.state = 152
                    self.barrierStatement()
                    pass

                elif la_ == 4:
                    self.state = 153
                    self.boxStatement()
                    pass

                elif la_ == 5:
                    self.state = 154
                    self.breakStatement()
                    pass

                elif la_ == 6:
                    self.state = 155
                    self.calStatement()
                    pass

                elif la_ == 7:
                    self.state = 156
                    self.calibrationGrammarStatement()
                    pass

                elif la_ == 8:
                    self.state = 157
                    self.classicalDeclarationStatement()
                    pass

                elif la_ == 9:
                    self.state = 158
                    self.constDeclarationStatement()
                    pass

                elif la_ == 10:
                    self.state = 159
                    self.continueStatement()
                    pass

                elif la_ == 11:
                    self.state = 160
                    self.defStatement()
                    pass

                elif la_ == 12:
                    self.state = 161
                    self.defcalStatement()
                    pass

                elif la_ == 13:
                    self.state = 162
                    self.delayStatement()
                    pass

                elif la_ == 14:
                    self.state = 163
                    self.endStatement()
                    pass

                elif la_ == 15:
                    self.state = 164
                    self.expressionStatement()
                    pass

                elif la_ == 16:
                    self.state = 165
                    self.externStatement()
                    pass

                elif la_ == 17:
                    self.state = 166
                    self.forStatement()
                    pass

                elif la_ == 18:
                    self.state = 167
                    self.gateCallStatement()
                    pass

                elif la_ == 19:
                    self.state = 168
                    self.gateStatement()
                    pass

                elif la_ == 20:
                    self.state = 169
                    self.ifStatement()
                    pass

                elif la_ == 21:
                    self.state = 170
                    self.includeStatement()
                    pass

                elif la_ == 22:
                    self.state = 171
                    self.ioDeclarationStatement()
                    pass

                elif la_ == 23:
                    self.state = 172
                    self.measureArrowAssignmentStatement()
                    pass

                elif la_ == 24:
                    self.state = 173
                    self.oldStyleDeclarationStatement()
                    pass

                elif la_ == 25:
                    self.state = 174
                    self.quantumDeclarationStatement()
                    pass

                elif la_ == 26:
                    self.state = 175
                    self.resetStatement()
                    pass

                elif la_ == 27:
                    self.state = 176
                    self.returnStatement()
                    pass

                elif la_ == 28:
                    self.state = 177
                    self.whileStatement()
                    pass


                pass
            else:
                raise NoViableAltException(self)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class AnnotationContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def AnnotationKeyword(self):
            return self.getToken(qasm3Parser.AnnotationKeyword, 0)

        def RemainingLineContent(self):
            return self.getToken(qasm3Parser.RemainingLineContent, 0)

        def getRuleIndex(self):
            return qasm3Parser.RULE_annotation

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterAnnotation" ):
                listener.enterAnnotation(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitAnnotation" ):
                listener.exitAnnotation(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitAnnotation" ):
                return visitor.visitAnnotation(self)
            else:
                return visitor.visitChildren(self)




    def annotation(self):

        localctx = qasm3Parser.AnnotationContext(self, self._ctx, self.state)
        self.enterRule(localctx, 6, self.RULE_annotation)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 182
            self.match(qasm3Parser.AnnotationKeyword)
            self.state = 184
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.RemainingLineContent:
                self.state = 183
                self.match(qasm3Parser.RemainingLineContent)


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ScopeContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def LBRACE(self):
            return self.getToken(qasm3Parser.LBRACE, 0)

        def RBRACE(self):
            return self.getToken(qasm3Parser.RBRACE, 0)

        def statement(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(qasm3Parser.StatementContext)
            else:
                return self.getTypedRuleContext(qasm3Parser.StatementContext,i)


        def getRuleIndex(self):
            return qasm3Parser.RULE_scope

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterScope" ):
                listener.enterScope(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitScope" ):
                listener.exitScope(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitScope" ):
                return visitor.visitScope(self)
            else:
                return visitor.visitChildren(self)




    def scope(self):

        localctx = qasm3Parser.ScopeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 8, self.RULE_scope)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 186
            self.match(qasm3Parser.LBRACE)
            self.state = 190
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << qasm3Parser.INCLUDE) | (1 << qasm3Parser.DEFCALGRAMMAR) | (1 << qasm3Parser.DEF) | (1 << qasm3Parser.CAL) | (1 << qasm3Parser.DEFCAL) | (1 << qasm3Parser.GATE) | (1 << qasm3Parser.EXTERN) | (1 << qasm3Parser.BOX) | (1 << qasm3Parser.LET) | (1 << qasm3Parser.BREAK) | (1 << qasm3Parser.CONTINUE) | (1 << qasm3Parser.IF) | (1 << qasm3Parser.END) | (1 << qasm3Parser.RETURN) | (1 << qasm3Parser.FOR) | (1 << qasm3Parser.WHILE) | (1 << qasm3Parser.PRAGMA) | (1 << qasm3Parser.AnnotationKeyword) | (1 << qasm3Parser.INPUT) | (1 << qasm3Parser.OUTPUT) | (1 << qasm3Parser.CONST) | (1 << qasm3Parser.QREG) | (1 << qasm3Parser.QUBIT) | (1 << qasm3Parser.CREG) | (1 << qasm3Parser.BOOL) | (1 << qasm3Parser.BIT) | (1 << qasm3Parser.INT) | (1 << qasm3Parser.UINT) | (1 << qasm3Parser.FLOAT) | (1 << qasm3Parser.ANGLE) | (1 << qasm3Parser.COMPLEX) | (1 << qasm3Parser.ARRAY) | (1 << qasm3Parser.DURATION) | (1 << qasm3Parser.STRETCH) | (1 << qasm3Parser.GPHASE) | (1 << qasm3Parser.INV) | (1 << qasm3Parser.POW) | (1 << qasm3Parser.CTRL) | (1 << qasm3Parser.NEGCTRL) | (1 << qasm3Parser.DURATIONOF) | (1 << qasm3Parser.DELAY) | (1 << qasm3Parser.RESET) | (1 << qasm3Parser.MEASURE) | (1 << qasm3Parser.BARRIER) | (1 << qasm3Parser.BooleanLiteral) | (1 << qasm3Parser.LPAREN))) != 0) or ((((_la - 67)) & ~0x3f) == 0 and ((1 << (_la - 67)) & ((1 << (qasm3Parser.MINUS - 67)) | (1 << (qasm3Parser.TILDE - 67)) | (1 << (qasm3Parser.EXCLAMATION_POINT - 67)) | (1 << (qasm3Parser.ImaginaryLiteral - 67)) | (1 << (qasm3Parser.BinaryIntegerLiteral - 67)) | (1 << (qasm3Parser.OctalIntegerLiteral - 67)) | (1 << (qasm3Parser.DecimalIntegerLiteral - 67)) | (1 << (qasm3Parser.HexIntegerLiteral - 67)) | (1 << (qasm3Parser.Identifier - 67)) | (1 << (qasm3Parser.HardwareQubit - 67)) | (1 << (qasm3Parser.FloatLiteral - 67)) | (1 << (qasm3Parser.TimingLiteral - 67)) | (1 << (qasm3Parser.BitstringLiteral - 67)))) != 0):
                self.state = 187
                self.statement()
                self.state = 192
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 193
            self.match(qasm3Parser.RBRACE)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class PragmaContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def PRAGMA(self):
            return self.getToken(qasm3Parser.PRAGMA, 0)

        def RemainingLineContent(self):
            return self.getToken(qasm3Parser.RemainingLineContent, 0)

        def getRuleIndex(self):
            return qasm3Parser.RULE_pragma

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterPragma" ):
                listener.enterPragma(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitPragma" ):
                listener.exitPragma(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitPragma" ):
                return visitor.visitPragma(self)
            else:
                return visitor.visitChildren(self)




    def pragma(self):

        localctx = qasm3Parser.PragmaContext(self, self._ctx, self.state)
        self.enterRule(localctx, 10, self.RULE_pragma)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 195
            self.match(qasm3Parser.PRAGMA)
            self.state = 196
            self.match(qasm3Parser.RemainingLineContent)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class StatementOrScopeContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def statement(self):
            return self.getTypedRuleContext(qasm3Parser.StatementContext,0)


        def scope(self):
            return self.getTypedRuleContext(qasm3Parser.ScopeContext,0)


        def getRuleIndex(self):
            return qasm3Parser.RULE_statementOrScope

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterStatementOrScope" ):
                listener.enterStatementOrScope(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitStatementOrScope" ):
                listener.exitStatementOrScope(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitStatementOrScope" ):
                return visitor.visitStatementOrScope(self)
            else:
                return visitor.visitChildren(self)




    def statementOrScope(self):

        localctx = qasm3Parser.StatementOrScopeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 12, self.RULE_statementOrScope)
        try:
            self.state = 200
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [qasm3Parser.INCLUDE, qasm3Parser.DEFCALGRAMMAR, qasm3Parser.DEF, qasm3Parser.CAL, qasm3Parser.DEFCAL, qasm3Parser.GATE, qasm3Parser.EXTERN, qasm3Parser.BOX, qasm3Parser.LET, qasm3Parser.BREAK, qasm3Parser.CONTINUE, qasm3Parser.IF, qasm3Parser.END, qasm3Parser.RETURN, qasm3Parser.FOR, qasm3Parser.WHILE, qasm3Parser.PRAGMA, qasm3Parser.AnnotationKeyword, qasm3Parser.INPUT, qasm3Parser.OUTPUT, qasm3Parser.CONST, qasm3Parser.QREG, qasm3Parser.QUBIT, qasm3Parser.CREG, qasm3Parser.BOOL, qasm3Parser.BIT, qasm3Parser.INT, qasm3Parser.UINT, qasm3Parser.FLOAT, qasm3Parser.ANGLE, qasm3Parser.COMPLEX, qasm3Parser.ARRAY, qasm3Parser.DURATION, qasm3Parser.STRETCH, qasm3Parser.GPHASE, qasm3Parser.INV, qasm3Parser.POW, qasm3Parser.CTRL, qasm3Parser.NEGCTRL, qasm3Parser.DURATIONOF, qasm3Parser.DELAY, qasm3Parser.RESET, qasm3Parser.MEASURE, qasm3Parser.BARRIER, qasm3Parser.BooleanLiteral, qasm3Parser.LPAREN, qasm3Parser.MINUS, qasm3Parser.TILDE, qasm3Parser.EXCLAMATION_POINT, qasm3Parser.ImaginaryLiteral, qasm3Parser.BinaryIntegerLiteral, qasm3Parser.OctalIntegerLiteral, qasm3Parser.DecimalIntegerLiteral, qasm3Parser.HexIntegerLiteral, qasm3Parser.Identifier, qasm3Parser.HardwareQubit, qasm3Parser.FloatLiteral, qasm3Parser.TimingLiteral, qasm3Parser.BitstringLiteral]:
                self.enterOuterAlt(localctx, 1)
                self.state = 198
                self.statement()
                pass
            elif token in [qasm3Parser.LBRACE]:
                self.enterOuterAlt(localctx, 2)
                self.state = 199
                self.scope()
                pass
            else:
                raise NoViableAltException(self)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class CalibrationGrammarStatementContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def DEFCALGRAMMAR(self):
            return self.getToken(qasm3Parser.DEFCALGRAMMAR, 0)

        def StringLiteral(self):
            return self.getToken(qasm3Parser.StringLiteral, 0)

        def SEMICOLON(self):
            return self.getToken(qasm3Parser.SEMICOLON, 0)

        def getRuleIndex(self):
            return qasm3Parser.RULE_calibrationGrammarStatement

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterCalibrationGrammarStatement" ):
                listener.enterCalibrationGrammarStatement(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitCalibrationGrammarStatement" ):
                listener.exitCalibrationGrammarStatement(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitCalibrationGrammarStatement" ):
                return visitor.visitCalibrationGrammarStatement(self)
            else:
                return visitor.visitChildren(self)




    def calibrationGrammarStatement(self):

        localctx = qasm3Parser.CalibrationGrammarStatementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 14, self.RULE_calibrationGrammarStatement)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 202
            self.match(qasm3Parser.DEFCALGRAMMAR)
            self.state = 203
            self.match(qasm3Parser.StringLiteral)
            self.state = 204
            self.match(qasm3Parser.SEMICOLON)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class IncludeStatementContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def INCLUDE(self):
            return self.getToken(qasm3Parser.INCLUDE, 0)

        def StringLiteral(self):
            return self.getToken(qasm3Parser.StringLiteral, 0)

        def SEMICOLON(self):
            return self.getToken(qasm3Parser.SEMICOLON, 0)

        def getRuleIndex(self):
            return qasm3Parser.RULE_includeStatement

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterIncludeStatement" ):
                listener.enterIncludeStatement(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitIncludeStatement" ):
                listener.exitIncludeStatement(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitIncludeStatement" ):
                return visitor.visitIncludeStatement(self)
            else:
                return visitor.visitChildren(self)




    def includeStatement(self):

        localctx = qasm3Parser.IncludeStatementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 16, self.RULE_includeStatement)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 206
            self.match(qasm3Parser.INCLUDE)
            self.state = 207
            self.match(qasm3Parser.StringLiteral)
            self.state = 208
            self.match(qasm3Parser.SEMICOLON)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class BreakStatementContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def BREAK(self):
            return self.getToken(qasm3Parser.BREAK, 0)

        def SEMICOLON(self):
            return self.getToken(qasm3Parser.SEMICOLON, 0)

        def getRuleIndex(self):
            return qasm3Parser.RULE_breakStatement

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterBreakStatement" ):
                listener.enterBreakStatement(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitBreakStatement" ):
                listener.exitBreakStatement(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitBreakStatement" ):
                return visitor.visitBreakStatement(self)
            else:
                return visitor.visitChildren(self)




    def breakStatement(self):

        localctx = qasm3Parser.BreakStatementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 18, self.RULE_breakStatement)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 210
            self.match(qasm3Parser.BREAK)
            self.state = 211
            self.match(qasm3Parser.SEMICOLON)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ContinueStatementContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def CONTINUE(self):
            return self.getToken(qasm3Parser.CONTINUE, 0)

        def SEMICOLON(self):
            return self.getToken(qasm3Parser.SEMICOLON, 0)

        def getRuleIndex(self):
            return qasm3Parser.RULE_continueStatement

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterContinueStatement" ):
                listener.enterContinueStatement(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitContinueStatement" ):
                listener.exitContinueStatement(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitContinueStatement" ):
                return visitor.visitContinueStatement(self)
            else:
                return visitor.visitChildren(self)




    def continueStatement(self):

        localctx = qasm3Parser.ContinueStatementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 20, self.RULE_continueStatement)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 213
            self.match(qasm3Parser.CONTINUE)
            self.state = 214
            self.match(qasm3Parser.SEMICOLON)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class EndStatementContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def END(self):
            return self.getToken(qasm3Parser.END, 0)

        def SEMICOLON(self):
            return self.getToken(qasm3Parser.SEMICOLON, 0)

        def getRuleIndex(self):
            return qasm3Parser.RULE_endStatement

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterEndStatement" ):
                listener.enterEndStatement(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitEndStatement" ):
                listener.exitEndStatement(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitEndStatement" ):
                return visitor.visitEndStatement(self)
            else:
                return visitor.visitChildren(self)




    def endStatement(self):

        localctx = qasm3Parser.EndStatementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 22, self.RULE_endStatement)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 216
            self.match(qasm3Parser.END)
            self.state = 217
            self.match(qasm3Parser.SEMICOLON)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ForStatementContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser
            self.body = None # StatementOrScopeContext

        def FOR(self):
            return self.getToken(qasm3Parser.FOR, 0)

        def scalarType(self):
            return self.getTypedRuleContext(qasm3Parser.ScalarTypeContext,0)


        def Identifier(self):
            return self.getToken(qasm3Parser.Identifier, 0)

        def IN(self):
            return self.getToken(qasm3Parser.IN, 0)

        def statementOrScope(self):
            return self.getTypedRuleContext(qasm3Parser.StatementOrScopeContext,0)


        def setExpression(self):
            return self.getTypedRuleContext(qasm3Parser.SetExpressionContext,0)


        def LBRACKET(self):
            return self.getToken(qasm3Parser.LBRACKET, 0)

        def rangeExpression(self):
            return self.getTypedRuleContext(qasm3Parser.RangeExpressionContext,0)


        def RBRACKET(self):
            return self.getToken(qasm3Parser.RBRACKET, 0)

        def expression(self):
            return self.getTypedRuleContext(qasm3Parser.ExpressionContext,0)


        def getRuleIndex(self):
            return qasm3Parser.RULE_forStatement

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterForStatement" ):
                listener.enterForStatement(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitForStatement" ):
                listener.exitForStatement(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitForStatement" ):
                return visitor.visitForStatement(self)
            else:
                return visitor.visitChildren(self)




    def forStatement(self):

        localctx = qasm3Parser.ForStatementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 24, self.RULE_forStatement)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 219
            self.match(qasm3Parser.FOR)
            self.state = 220
            self.scalarType()
            self.state = 221
            self.match(qasm3Parser.Identifier)
            self.state = 222
            self.match(qasm3Parser.IN)
            self.state = 229
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [qasm3Parser.LBRACE]:
                self.state = 223
                self.setExpression()
                pass
            elif token in [qasm3Parser.LBRACKET]:
                self.state = 224
                self.match(qasm3Parser.LBRACKET)
                self.state = 225
                self.rangeExpression()
                self.state = 226
                self.match(qasm3Parser.RBRACKET)
                pass
            elif token in [qasm3Parser.BOOL, qasm3Parser.BIT, qasm3Parser.INT, qasm3Parser.UINT, qasm3Parser.FLOAT, qasm3Parser.ANGLE, qasm3Parser.COMPLEX, qasm3Parser.ARRAY, qasm3Parser.DURATION, qasm3Parser.STRETCH, qasm3Parser.DURATIONOF, qasm3Parser.BooleanLiteral, qasm3Parser.LPAREN, qasm3Parser.MINUS, qasm3Parser.TILDE, qasm3Parser.EXCLAMATION_POINT, qasm3Parser.ImaginaryLiteral, qasm3Parser.BinaryIntegerLiteral, qasm3Parser.OctalIntegerLiteral, qasm3Parser.DecimalIntegerLiteral, qasm3Parser.HexIntegerLiteral, qasm3Parser.Identifier, qasm3Parser.HardwareQubit, qasm3Parser.FloatLiteral, qasm3Parser.TimingLiteral, qasm3Parser.BitstringLiteral]:
                self.state = 228
                self.expression(0)
                pass
            else:
                raise NoViableAltException(self)

            self.state = 231
            localctx.body = self.statementOrScope()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class IfStatementContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser
            self.if_body = None # StatementOrScopeContext
            self.else_body = None # StatementOrScopeContext

        def IF(self):
            return self.getToken(qasm3Parser.IF, 0)

        def LPAREN(self):
            return self.getToken(qasm3Parser.LPAREN, 0)

        def expression(self):
            return self.getTypedRuleContext(qasm3Parser.ExpressionContext,0)


        def RPAREN(self):
            return self.getToken(qasm3Parser.RPAREN, 0)

        def statementOrScope(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(qasm3Parser.StatementOrScopeContext)
            else:
                return self.getTypedRuleContext(qasm3Parser.StatementOrScopeContext,i)


        def ELSE(self):
            return self.getToken(qasm3Parser.ELSE, 0)

        def getRuleIndex(self):
            return qasm3Parser.RULE_ifStatement

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterIfStatement" ):
                listener.enterIfStatement(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitIfStatement" ):
                listener.exitIfStatement(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitIfStatement" ):
                return visitor.visitIfStatement(self)
            else:
                return visitor.visitChildren(self)




    def ifStatement(self):

        localctx = qasm3Parser.IfStatementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 26, self.RULE_ifStatement)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 233
            self.match(qasm3Parser.IF)
            self.state = 234
            self.match(qasm3Parser.LPAREN)
            self.state = 235
            self.expression(0)
            self.state = 236
            self.match(qasm3Parser.RPAREN)
            self.state = 237
            localctx.if_body = self.statementOrScope()
            self.state = 240
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,9,self._ctx)
            if la_ == 1:
                self.state = 238
                self.match(qasm3Parser.ELSE)
                self.state = 239
                localctx.else_body = self.statementOrScope()


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ReturnStatementContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def RETURN(self):
            return self.getToken(qasm3Parser.RETURN, 0)

        def SEMICOLON(self):
            return self.getToken(qasm3Parser.SEMICOLON, 0)

        def expression(self):
            return self.getTypedRuleContext(qasm3Parser.ExpressionContext,0)


        def measureExpression(self):
            return self.getTypedRuleContext(qasm3Parser.MeasureExpressionContext,0)


        def getRuleIndex(self):
            return qasm3Parser.RULE_returnStatement

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterReturnStatement" ):
                listener.enterReturnStatement(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitReturnStatement" ):
                listener.exitReturnStatement(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitReturnStatement" ):
                return visitor.visitReturnStatement(self)
            else:
                return visitor.visitChildren(self)




    def returnStatement(self):

        localctx = qasm3Parser.ReturnStatementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 28, self.RULE_returnStatement)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 242
            self.match(qasm3Parser.RETURN)
            self.state = 245
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [qasm3Parser.BOOL, qasm3Parser.BIT, qasm3Parser.INT, qasm3Parser.UINT, qasm3Parser.FLOAT, qasm3Parser.ANGLE, qasm3Parser.COMPLEX, qasm3Parser.ARRAY, qasm3Parser.DURATION, qasm3Parser.STRETCH, qasm3Parser.DURATIONOF, qasm3Parser.BooleanLiteral, qasm3Parser.LPAREN, qasm3Parser.MINUS, qasm3Parser.TILDE, qasm3Parser.EXCLAMATION_POINT, qasm3Parser.ImaginaryLiteral, qasm3Parser.BinaryIntegerLiteral, qasm3Parser.OctalIntegerLiteral, qasm3Parser.DecimalIntegerLiteral, qasm3Parser.HexIntegerLiteral, qasm3Parser.Identifier, qasm3Parser.HardwareQubit, qasm3Parser.FloatLiteral, qasm3Parser.TimingLiteral, qasm3Parser.BitstringLiteral]:
                self.state = 243
                self.expression(0)
                pass
            elif token in [qasm3Parser.MEASURE]:
                self.state = 244
                self.measureExpression()
                pass
            elif token in [qasm3Parser.SEMICOLON]:
                pass
            else:
                pass
            self.state = 247
            self.match(qasm3Parser.SEMICOLON)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class WhileStatementContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser
            self.body = None # StatementOrScopeContext

        def WHILE(self):
            return self.getToken(qasm3Parser.WHILE, 0)

        def LPAREN(self):
            return self.getToken(qasm3Parser.LPAREN, 0)

        def expression(self):
            return self.getTypedRuleContext(qasm3Parser.ExpressionContext,0)


        def RPAREN(self):
            return self.getToken(qasm3Parser.RPAREN, 0)

        def statementOrScope(self):
            return self.getTypedRuleContext(qasm3Parser.StatementOrScopeContext,0)


        def getRuleIndex(self):
            return qasm3Parser.RULE_whileStatement

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterWhileStatement" ):
                listener.enterWhileStatement(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitWhileStatement" ):
                listener.exitWhileStatement(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitWhileStatement" ):
                return visitor.visitWhileStatement(self)
            else:
                return visitor.visitChildren(self)




    def whileStatement(self):

        localctx = qasm3Parser.WhileStatementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 30, self.RULE_whileStatement)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 249
            self.match(qasm3Parser.WHILE)
            self.state = 250
            self.match(qasm3Parser.LPAREN)
            self.state = 251
            self.expression(0)
            self.state = 252
            self.match(qasm3Parser.RPAREN)
            self.state = 253
            localctx.body = self.statementOrScope()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class BarrierStatementContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def BARRIER(self):
            return self.getToken(qasm3Parser.BARRIER, 0)

        def SEMICOLON(self):
            return self.getToken(qasm3Parser.SEMICOLON, 0)

        def gateOperandList(self):
            return self.getTypedRuleContext(qasm3Parser.GateOperandListContext,0)


        def getRuleIndex(self):
            return qasm3Parser.RULE_barrierStatement

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterBarrierStatement" ):
                listener.enterBarrierStatement(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitBarrierStatement" ):
                listener.exitBarrierStatement(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitBarrierStatement" ):
                return visitor.visitBarrierStatement(self)
            else:
                return visitor.visitChildren(self)




    def barrierStatement(self):

        localctx = qasm3Parser.BarrierStatementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 32, self.RULE_barrierStatement)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 255
            self.match(qasm3Parser.BARRIER)
            self.state = 257
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.Identifier or _la==qasm3Parser.HardwareQubit:
                self.state = 256
                self.gateOperandList()


            self.state = 259
            self.match(qasm3Parser.SEMICOLON)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class BoxStatementContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def BOX(self):
            return self.getToken(qasm3Parser.BOX, 0)

        def scope(self):
            return self.getTypedRuleContext(qasm3Parser.ScopeContext,0)


        def designator(self):
            return self.getTypedRuleContext(qasm3Parser.DesignatorContext,0)


        def getRuleIndex(self):
            return qasm3Parser.RULE_boxStatement

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterBoxStatement" ):
                listener.enterBoxStatement(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitBoxStatement" ):
                listener.exitBoxStatement(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitBoxStatement" ):
                return visitor.visitBoxStatement(self)
            else:
                return visitor.visitChildren(self)




    def boxStatement(self):

        localctx = qasm3Parser.BoxStatementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 34, self.RULE_boxStatement)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 261
            self.match(qasm3Parser.BOX)
            self.state = 263
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.LBRACKET:
                self.state = 262
                self.designator()


            self.state = 265
            self.scope()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class DelayStatementContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def DELAY(self):
            return self.getToken(qasm3Parser.DELAY, 0)

        def designator(self):
            return self.getTypedRuleContext(qasm3Parser.DesignatorContext,0)


        def SEMICOLON(self):
            return self.getToken(qasm3Parser.SEMICOLON, 0)

        def gateOperandList(self):
            return self.getTypedRuleContext(qasm3Parser.GateOperandListContext,0)


        def getRuleIndex(self):
            return qasm3Parser.RULE_delayStatement

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterDelayStatement" ):
                listener.enterDelayStatement(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitDelayStatement" ):
                listener.exitDelayStatement(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitDelayStatement" ):
                return visitor.visitDelayStatement(self)
            else:
                return visitor.visitChildren(self)




    def delayStatement(self):

        localctx = qasm3Parser.DelayStatementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 36, self.RULE_delayStatement)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 267
            self.match(qasm3Parser.DELAY)
            self.state = 268
            self.designator()
            self.state = 270
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.Identifier or _la==qasm3Parser.HardwareQubit:
                self.state = 269
                self.gateOperandList()


            self.state = 272
            self.match(qasm3Parser.SEMICOLON)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class GateCallStatementContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def Identifier(self):
            return self.getToken(qasm3Parser.Identifier, 0)

        def gateOperandList(self):
            return self.getTypedRuleContext(qasm3Parser.GateOperandListContext,0)


        def SEMICOLON(self):
            return self.getToken(qasm3Parser.SEMICOLON, 0)

        def gateModifier(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(qasm3Parser.GateModifierContext)
            else:
                return self.getTypedRuleContext(qasm3Parser.GateModifierContext,i)


        def LPAREN(self):
            return self.getToken(qasm3Parser.LPAREN, 0)

        def RPAREN(self):
            return self.getToken(qasm3Parser.RPAREN, 0)

        def designator(self):
            return self.getTypedRuleContext(qasm3Parser.DesignatorContext,0)


        def expressionList(self):
            return self.getTypedRuleContext(qasm3Parser.ExpressionListContext,0)


        def GPHASE(self):
            return self.getToken(qasm3Parser.GPHASE, 0)

        def getRuleIndex(self):
            return qasm3Parser.RULE_gateCallStatement

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterGateCallStatement" ):
                listener.enterGateCallStatement(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitGateCallStatement" ):
                listener.exitGateCallStatement(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitGateCallStatement" ):
                return visitor.visitGateCallStatement(self)
            else:
                return visitor.visitChildren(self)




    def gateCallStatement(self):

        localctx = qasm3Parser.GateCallStatementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 38, self.RULE_gateCallStatement)
        self._la = 0 # Token type
        try:
            self.state = 315
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,23,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 277
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << qasm3Parser.INV) | (1 << qasm3Parser.POW) | (1 << qasm3Parser.CTRL) | (1 << qasm3Parser.NEGCTRL))) != 0):
                    self.state = 274
                    self.gateModifier()
                    self.state = 279
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

                self.state = 280
                self.match(qasm3Parser.Identifier)
                self.state = 286
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==qasm3Parser.LPAREN:
                    self.state = 281
                    self.match(qasm3Parser.LPAREN)
                    self.state = 283
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << qasm3Parser.BOOL) | (1 << qasm3Parser.BIT) | (1 << qasm3Parser.INT) | (1 << qasm3Parser.UINT) | (1 << qasm3Parser.FLOAT) | (1 << qasm3Parser.ANGLE) | (1 << qasm3Parser.COMPLEX) | (1 << qasm3Parser.ARRAY) | (1 << qasm3Parser.DURATION) | (1 << qasm3Parser.STRETCH) | (1 << qasm3Parser.DURATIONOF) | (1 << qasm3Parser.BooleanLiteral) | (1 << qasm3Parser.LPAREN))) != 0) or ((((_la - 67)) & ~0x3f) == 0 and ((1 << (_la - 67)) & ((1 << (qasm3Parser.MINUS - 67)) | (1 << (qasm3Parser.TILDE - 67)) | (1 << (qasm3Parser.EXCLAMATION_POINT - 67)) | (1 << (qasm3Parser.ImaginaryLiteral - 67)) | (1 << (qasm3Parser.BinaryIntegerLiteral - 67)) | (1 << (qasm3Parser.OctalIntegerLiteral - 67)) | (1 << (qasm3Parser.DecimalIntegerLiteral - 67)) | (1 << (qasm3Parser.HexIntegerLiteral - 67)) | (1 << (qasm3Parser.Identifier - 67)) | (1 << (qasm3Parser.HardwareQubit - 67)) | (1 << (qasm3Parser.FloatLiteral - 67)) | (1 << (qasm3Parser.TimingLiteral - 67)) | (1 << (qasm3Parser.BitstringLiteral - 67)))) != 0):
                        self.state = 282
                        self.expressionList()


                    self.state = 285
                    self.match(qasm3Parser.RPAREN)


                self.state = 289
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==qasm3Parser.LBRACKET:
                    self.state = 288
                    self.designator()


                self.state = 291
                self.gateOperandList()
                self.state = 292
                self.match(qasm3Parser.SEMICOLON)
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 297
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << qasm3Parser.INV) | (1 << qasm3Parser.POW) | (1 << qasm3Parser.CTRL) | (1 << qasm3Parser.NEGCTRL))) != 0):
                    self.state = 294
                    self.gateModifier()
                    self.state = 299
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

                self.state = 300
                self.match(qasm3Parser.GPHASE)
                self.state = 306
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==qasm3Parser.LPAREN:
                    self.state = 301
                    self.match(qasm3Parser.LPAREN)
                    self.state = 303
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << qasm3Parser.BOOL) | (1 << qasm3Parser.BIT) | (1 << qasm3Parser.INT) | (1 << qasm3Parser.UINT) | (1 << qasm3Parser.FLOAT) | (1 << qasm3Parser.ANGLE) | (1 << qasm3Parser.COMPLEX) | (1 << qasm3Parser.ARRAY) | (1 << qasm3Parser.DURATION) | (1 << qasm3Parser.STRETCH) | (1 << qasm3Parser.DURATIONOF) | (1 << qasm3Parser.BooleanLiteral) | (1 << qasm3Parser.LPAREN))) != 0) or ((((_la - 67)) & ~0x3f) == 0 and ((1 << (_la - 67)) & ((1 << (qasm3Parser.MINUS - 67)) | (1 << (qasm3Parser.TILDE - 67)) | (1 << (qasm3Parser.EXCLAMATION_POINT - 67)) | (1 << (qasm3Parser.ImaginaryLiteral - 67)) | (1 << (qasm3Parser.BinaryIntegerLiteral - 67)) | (1 << (qasm3Parser.OctalIntegerLiteral - 67)) | (1 << (qasm3Parser.DecimalIntegerLiteral - 67)) | (1 << (qasm3Parser.HexIntegerLiteral - 67)) | (1 << (qasm3Parser.Identifier - 67)) | (1 << (qasm3Parser.HardwareQubit - 67)) | (1 << (qasm3Parser.FloatLiteral - 67)) | (1 << (qasm3Parser.TimingLiteral - 67)) | (1 << (qasm3Parser.BitstringLiteral - 67)))) != 0):
                        self.state = 302
                        self.expressionList()


                    self.state = 305
                    self.match(qasm3Parser.RPAREN)


                self.state = 309
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==qasm3Parser.LBRACKET:
                    self.state = 308
                    self.designator()


                self.state = 312
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==qasm3Parser.Identifier or _la==qasm3Parser.HardwareQubit:
                    self.state = 311
                    self.gateOperandList()


                self.state = 314
                self.match(qasm3Parser.SEMICOLON)
                pass


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class MeasureArrowAssignmentStatementContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def measureExpression(self):
            return self.getTypedRuleContext(qasm3Parser.MeasureExpressionContext,0)


        def SEMICOLON(self):
            return self.getToken(qasm3Parser.SEMICOLON, 0)

        def ARROW(self):
            return self.getToken(qasm3Parser.ARROW, 0)

        def indexedIdentifier(self):
            return self.getTypedRuleContext(qasm3Parser.IndexedIdentifierContext,0)


        def getRuleIndex(self):
            return qasm3Parser.RULE_measureArrowAssignmentStatement

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterMeasureArrowAssignmentStatement" ):
                listener.enterMeasureArrowAssignmentStatement(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitMeasureArrowAssignmentStatement" ):
                listener.exitMeasureArrowAssignmentStatement(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitMeasureArrowAssignmentStatement" ):
                return visitor.visitMeasureArrowAssignmentStatement(self)
            else:
                return visitor.visitChildren(self)




    def measureArrowAssignmentStatement(self):

        localctx = qasm3Parser.MeasureArrowAssignmentStatementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 40, self.RULE_measureArrowAssignmentStatement)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 317
            self.measureExpression()
            self.state = 320
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.ARROW:
                self.state = 318
                self.match(qasm3Parser.ARROW)
                self.state = 319
                self.indexedIdentifier()


            self.state = 322
            self.match(qasm3Parser.SEMICOLON)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ResetStatementContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def RESET(self):
            return self.getToken(qasm3Parser.RESET, 0)

        def gateOperand(self):
            return self.getTypedRuleContext(qasm3Parser.GateOperandContext,0)


        def SEMICOLON(self):
            return self.getToken(qasm3Parser.SEMICOLON, 0)

        def getRuleIndex(self):
            return qasm3Parser.RULE_resetStatement

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterResetStatement" ):
                listener.enterResetStatement(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitResetStatement" ):
                listener.exitResetStatement(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitResetStatement" ):
                return visitor.visitResetStatement(self)
            else:
                return visitor.visitChildren(self)




    def resetStatement(self):

        localctx = qasm3Parser.ResetStatementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 42, self.RULE_resetStatement)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 324
            self.match(qasm3Parser.RESET)
            self.state = 325
            self.gateOperand()
            self.state = 326
            self.match(qasm3Parser.SEMICOLON)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class AliasDeclarationStatementContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def LET(self):
            return self.getToken(qasm3Parser.LET, 0)

        def Identifier(self):
            return self.getToken(qasm3Parser.Identifier, 0)

        def EQUALS(self):
            return self.getToken(qasm3Parser.EQUALS, 0)

        def aliasExpression(self):
            return self.getTypedRuleContext(qasm3Parser.AliasExpressionContext,0)


        def SEMICOLON(self):
            return self.getToken(qasm3Parser.SEMICOLON, 0)

        def getRuleIndex(self):
            return qasm3Parser.RULE_aliasDeclarationStatement

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterAliasDeclarationStatement" ):
                listener.enterAliasDeclarationStatement(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitAliasDeclarationStatement" ):
                listener.exitAliasDeclarationStatement(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitAliasDeclarationStatement" ):
                return visitor.visitAliasDeclarationStatement(self)
            else:
                return visitor.visitChildren(self)




    def aliasDeclarationStatement(self):

        localctx = qasm3Parser.AliasDeclarationStatementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 44, self.RULE_aliasDeclarationStatement)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 328
            self.match(qasm3Parser.LET)
            self.state = 329
            self.match(qasm3Parser.Identifier)
            self.state = 330
            self.match(qasm3Parser.EQUALS)
            self.state = 331
            self.aliasExpression()
            self.state = 332
            self.match(qasm3Parser.SEMICOLON)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ClassicalDeclarationStatementContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def Identifier(self):
            return self.getToken(qasm3Parser.Identifier, 0)

        def SEMICOLON(self):
            return self.getToken(qasm3Parser.SEMICOLON, 0)

        def scalarType(self):
            return self.getTypedRuleContext(qasm3Parser.ScalarTypeContext,0)


        def arrayType(self):
            return self.getTypedRuleContext(qasm3Parser.ArrayTypeContext,0)


        def EQUALS(self):
            return self.getToken(qasm3Parser.EQUALS, 0)

        def declarationExpression(self):
            return self.getTypedRuleContext(qasm3Parser.DeclarationExpressionContext,0)


        def getRuleIndex(self):
            return qasm3Parser.RULE_classicalDeclarationStatement

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterClassicalDeclarationStatement" ):
                listener.enterClassicalDeclarationStatement(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitClassicalDeclarationStatement" ):
                listener.exitClassicalDeclarationStatement(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitClassicalDeclarationStatement" ):
                return visitor.visitClassicalDeclarationStatement(self)
            else:
                return visitor.visitChildren(self)




    def classicalDeclarationStatement(self):

        localctx = qasm3Parser.ClassicalDeclarationStatementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 46, self.RULE_classicalDeclarationStatement)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 336
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [qasm3Parser.BOOL, qasm3Parser.BIT, qasm3Parser.INT, qasm3Parser.UINT, qasm3Parser.FLOAT, qasm3Parser.ANGLE, qasm3Parser.COMPLEX, qasm3Parser.DURATION, qasm3Parser.STRETCH]:
                self.state = 334
                self.scalarType()
                pass
            elif token in [qasm3Parser.ARRAY]:
                self.state = 335
                self.arrayType()
                pass
            else:
                raise NoViableAltException(self)

            self.state = 338
            self.match(qasm3Parser.Identifier)
            self.state = 341
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.EQUALS:
                self.state = 339
                self.match(qasm3Parser.EQUALS)
                self.state = 340
                self.declarationExpression()


            self.state = 343
            self.match(qasm3Parser.SEMICOLON)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ConstDeclarationStatementContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def CONST(self):
            return self.getToken(qasm3Parser.CONST, 0)

        def scalarType(self):
            return self.getTypedRuleContext(qasm3Parser.ScalarTypeContext,0)


        def Identifier(self):
            return self.getToken(qasm3Parser.Identifier, 0)

        def EQUALS(self):
            return self.getToken(qasm3Parser.EQUALS, 0)

        def declarationExpression(self):
            return self.getTypedRuleContext(qasm3Parser.DeclarationExpressionContext,0)


        def SEMICOLON(self):
            return self.getToken(qasm3Parser.SEMICOLON, 0)

        def getRuleIndex(self):
            return qasm3Parser.RULE_constDeclarationStatement

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterConstDeclarationStatement" ):
                listener.enterConstDeclarationStatement(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitConstDeclarationStatement" ):
                listener.exitConstDeclarationStatement(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitConstDeclarationStatement" ):
                return visitor.visitConstDeclarationStatement(self)
            else:
                return visitor.visitChildren(self)




    def constDeclarationStatement(self):

        localctx = qasm3Parser.ConstDeclarationStatementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 48, self.RULE_constDeclarationStatement)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 345
            self.match(qasm3Parser.CONST)
            self.state = 346
            self.scalarType()
            self.state = 347
            self.match(qasm3Parser.Identifier)
            self.state = 348
            self.match(qasm3Parser.EQUALS)
            self.state = 349
            self.declarationExpression()
            self.state = 350
            self.match(qasm3Parser.SEMICOLON)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class IoDeclarationStatementContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def Identifier(self):
            return self.getToken(qasm3Parser.Identifier, 0)

        def SEMICOLON(self):
            return self.getToken(qasm3Parser.SEMICOLON, 0)

        def INPUT(self):
            return self.getToken(qasm3Parser.INPUT, 0)

        def OUTPUT(self):
            return self.getToken(qasm3Parser.OUTPUT, 0)

        def scalarType(self):
            return self.getTypedRuleContext(qasm3Parser.ScalarTypeContext,0)


        def arrayType(self):
            return self.getTypedRuleContext(qasm3Parser.ArrayTypeContext,0)


        def getRuleIndex(self):
            return qasm3Parser.RULE_ioDeclarationStatement

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterIoDeclarationStatement" ):
                listener.enterIoDeclarationStatement(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitIoDeclarationStatement" ):
                listener.exitIoDeclarationStatement(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitIoDeclarationStatement" ):
                return visitor.visitIoDeclarationStatement(self)
            else:
                return visitor.visitChildren(self)




    def ioDeclarationStatement(self):

        localctx = qasm3Parser.IoDeclarationStatementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 50, self.RULE_ioDeclarationStatement)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 352
            _la = self._input.LA(1)
            if not(_la==qasm3Parser.INPUT or _la==qasm3Parser.OUTPUT):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
            self.state = 355
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [qasm3Parser.BOOL, qasm3Parser.BIT, qasm3Parser.INT, qasm3Parser.UINT, qasm3Parser.FLOAT, qasm3Parser.ANGLE, qasm3Parser.COMPLEX, qasm3Parser.DURATION, qasm3Parser.STRETCH]:
                self.state = 353
                self.scalarType()
                pass
            elif token in [qasm3Parser.ARRAY]:
                self.state = 354
                self.arrayType()
                pass
            else:
                raise NoViableAltException(self)

            self.state = 357
            self.match(qasm3Parser.Identifier)
            self.state = 358
            self.match(qasm3Parser.SEMICOLON)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class OldStyleDeclarationStatementContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def Identifier(self):
            return self.getToken(qasm3Parser.Identifier, 0)

        def SEMICOLON(self):
            return self.getToken(qasm3Parser.SEMICOLON, 0)

        def CREG(self):
            return self.getToken(qasm3Parser.CREG, 0)

        def QREG(self):
            return self.getToken(qasm3Parser.QREG, 0)

        def designator(self):
            return self.getTypedRuleContext(qasm3Parser.DesignatorContext,0)


        def getRuleIndex(self):
            return qasm3Parser.RULE_oldStyleDeclarationStatement

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterOldStyleDeclarationStatement" ):
                listener.enterOldStyleDeclarationStatement(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitOldStyleDeclarationStatement" ):
                listener.exitOldStyleDeclarationStatement(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitOldStyleDeclarationStatement" ):
                return visitor.visitOldStyleDeclarationStatement(self)
            else:
                return visitor.visitChildren(self)




    def oldStyleDeclarationStatement(self):

        localctx = qasm3Parser.OldStyleDeclarationStatementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 52, self.RULE_oldStyleDeclarationStatement)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 360
            _la = self._input.LA(1)
            if not(_la==qasm3Parser.QREG or _la==qasm3Parser.CREG):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
            self.state = 361
            self.match(qasm3Parser.Identifier)
            self.state = 363
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.LBRACKET:
                self.state = 362
                self.designator()


            self.state = 365
            self.match(qasm3Parser.SEMICOLON)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class QuantumDeclarationStatementContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def qubitType(self):
            return self.getTypedRuleContext(qasm3Parser.QubitTypeContext,0)


        def Identifier(self):
            return self.getToken(qasm3Parser.Identifier, 0)

        def SEMICOLON(self):
            return self.getToken(qasm3Parser.SEMICOLON, 0)

        def getRuleIndex(self):
            return qasm3Parser.RULE_quantumDeclarationStatement

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterQuantumDeclarationStatement" ):
                listener.enterQuantumDeclarationStatement(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitQuantumDeclarationStatement" ):
                listener.exitQuantumDeclarationStatement(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitQuantumDeclarationStatement" ):
                return visitor.visitQuantumDeclarationStatement(self)
            else:
                return visitor.visitChildren(self)




    def quantumDeclarationStatement(self):

        localctx = qasm3Parser.QuantumDeclarationStatementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 54, self.RULE_quantumDeclarationStatement)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 367
            self.qubitType()
            self.state = 368
            self.match(qasm3Parser.Identifier)
            self.state = 369
            self.match(qasm3Parser.SEMICOLON)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class DefStatementContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def DEF(self):
            return self.getToken(qasm3Parser.DEF, 0)

        def Identifier(self):
            return self.getToken(qasm3Parser.Identifier, 0)

        def LPAREN(self):
            return self.getToken(qasm3Parser.LPAREN, 0)

        def RPAREN(self):
            return self.getToken(qasm3Parser.RPAREN, 0)

        def scope(self):
            return self.getTypedRuleContext(qasm3Parser.ScopeContext,0)


        def argumentDefinitionList(self):
            return self.getTypedRuleContext(qasm3Parser.ArgumentDefinitionListContext,0)


        def returnSignature(self):
            return self.getTypedRuleContext(qasm3Parser.ReturnSignatureContext,0)


        def getRuleIndex(self):
            return qasm3Parser.RULE_defStatement

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterDefStatement" ):
                listener.enterDefStatement(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitDefStatement" ):
                listener.exitDefStatement(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitDefStatement" ):
                return visitor.visitDefStatement(self)
            else:
                return visitor.visitChildren(self)




    def defStatement(self):

        localctx = qasm3Parser.DefStatementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 56, self.RULE_defStatement)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 371
            self.match(qasm3Parser.DEF)
            self.state = 372
            self.match(qasm3Parser.Identifier)
            self.state = 373
            self.match(qasm3Parser.LPAREN)
            self.state = 375
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << qasm3Parser.READONLY) | (1 << qasm3Parser.MUTABLE) | (1 << qasm3Parser.QREG) | (1 << qasm3Parser.QUBIT) | (1 << qasm3Parser.CREG) | (1 << qasm3Parser.BOOL) | (1 << qasm3Parser.BIT) | (1 << qasm3Parser.INT) | (1 << qasm3Parser.UINT) | (1 << qasm3Parser.FLOAT) | (1 << qasm3Parser.ANGLE) | (1 << qasm3Parser.COMPLEX) | (1 << qasm3Parser.DURATION) | (1 << qasm3Parser.STRETCH))) != 0):
                self.state = 374
                self.argumentDefinitionList()


            self.state = 377
            self.match(qasm3Parser.RPAREN)
            self.state = 379
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.ARROW:
                self.state = 378
                self.returnSignature()


            self.state = 381
            self.scope()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ExternStatementContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def EXTERN(self):
            return self.getToken(qasm3Parser.EXTERN, 0)

        def Identifier(self):
            return self.getToken(qasm3Parser.Identifier, 0)

        def LPAREN(self):
            return self.getToken(qasm3Parser.LPAREN, 0)

        def RPAREN(self):
            return self.getToken(qasm3Parser.RPAREN, 0)

        def SEMICOLON(self):
            return self.getToken(qasm3Parser.SEMICOLON, 0)

        def externArgumentList(self):
            return self.getTypedRuleContext(qasm3Parser.ExternArgumentListContext,0)


        def returnSignature(self):
            return self.getTypedRuleContext(qasm3Parser.ReturnSignatureContext,0)


        def getRuleIndex(self):
            return qasm3Parser.RULE_externStatement

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterExternStatement" ):
                listener.enterExternStatement(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitExternStatement" ):
                listener.exitExternStatement(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitExternStatement" ):
                return visitor.visitExternStatement(self)
            else:
                return visitor.visitChildren(self)




    def externStatement(self):

        localctx = qasm3Parser.ExternStatementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 58, self.RULE_externStatement)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 383
            self.match(qasm3Parser.EXTERN)
            self.state = 384
            self.match(qasm3Parser.Identifier)
            self.state = 385
            self.match(qasm3Parser.LPAREN)
            self.state = 387
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << qasm3Parser.READONLY) | (1 << qasm3Parser.MUTABLE) | (1 << qasm3Parser.CREG) | (1 << qasm3Parser.BOOL) | (1 << qasm3Parser.BIT) | (1 << qasm3Parser.INT) | (1 << qasm3Parser.UINT) | (1 << qasm3Parser.FLOAT) | (1 << qasm3Parser.ANGLE) | (1 << qasm3Parser.COMPLEX) | (1 << qasm3Parser.DURATION) | (1 << qasm3Parser.STRETCH))) != 0):
                self.state = 386
                self.externArgumentList()


            self.state = 389
            self.match(qasm3Parser.RPAREN)
            self.state = 391
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.ARROW:
                self.state = 390
                self.returnSignature()


            self.state = 393
            self.match(qasm3Parser.SEMICOLON)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class GateStatementContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser
            self.params = None # IdentifierListContext
            self.qubits = None # IdentifierListContext

        def GATE(self):
            return self.getToken(qasm3Parser.GATE, 0)

        def Identifier(self):
            return self.getToken(qasm3Parser.Identifier, 0)

        def scope(self):
            return self.getTypedRuleContext(qasm3Parser.ScopeContext,0)


        def identifierList(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(qasm3Parser.IdentifierListContext)
            else:
                return self.getTypedRuleContext(qasm3Parser.IdentifierListContext,i)


        def LPAREN(self):
            return self.getToken(qasm3Parser.LPAREN, 0)

        def RPAREN(self):
            return self.getToken(qasm3Parser.RPAREN, 0)

        def getRuleIndex(self):
            return qasm3Parser.RULE_gateStatement

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterGateStatement" ):
                listener.enterGateStatement(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitGateStatement" ):
                listener.exitGateStatement(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitGateStatement" ):
                return visitor.visitGateStatement(self)
            else:
                return visitor.visitChildren(self)




    def gateStatement(self):

        localctx = qasm3Parser.GateStatementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 60, self.RULE_gateStatement)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 395
            self.match(qasm3Parser.GATE)
            self.state = 396
            self.match(qasm3Parser.Identifier)
            self.state = 402
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.LPAREN:
                self.state = 397
                self.match(qasm3Parser.LPAREN)
                self.state = 399
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==qasm3Parser.Identifier:
                    self.state = 398
                    localctx.params = self.identifierList()


                self.state = 401
                self.match(qasm3Parser.RPAREN)


            self.state = 404
            localctx.qubits = self.identifierList()
            self.state = 405
            self.scope()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class AssignmentStatementContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser
            self.op = None # Token

        def indexedIdentifier(self):
            return self.getTypedRuleContext(qasm3Parser.IndexedIdentifierContext,0)


        def SEMICOLON(self):
            return self.getToken(qasm3Parser.SEMICOLON, 0)

        def EQUALS(self):
            return self.getToken(qasm3Parser.EQUALS, 0)

        def CompoundAssignmentOperator(self):
            return self.getToken(qasm3Parser.CompoundAssignmentOperator, 0)

        def expression(self):
            return self.getTypedRuleContext(qasm3Parser.ExpressionContext,0)


        def measureExpression(self):
            return self.getTypedRuleContext(qasm3Parser.MeasureExpressionContext,0)


        def getRuleIndex(self):
            return qasm3Parser.RULE_assignmentStatement

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterAssignmentStatement" ):
                listener.enterAssignmentStatement(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitAssignmentStatement" ):
                listener.exitAssignmentStatement(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitAssignmentStatement" ):
                return visitor.visitAssignmentStatement(self)
            else:
                return visitor.visitChildren(self)




    def assignmentStatement(self):

        localctx = qasm3Parser.AssignmentStatementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 62, self.RULE_assignmentStatement)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 407
            self.indexedIdentifier()
            self.state = 408
            localctx.op = self._input.LT(1)
            _la = self._input.LA(1)
            if not(_la==qasm3Parser.EQUALS or _la==qasm3Parser.CompoundAssignmentOperator):
                localctx.op = self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
            self.state = 411
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [qasm3Parser.BOOL, qasm3Parser.BIT, qasm3Parser.INT, qasm3Parser.UINT, qasm3Parser.FLOAT, qasm3Parser.ANGLE, qasm3Parser.COMPLEX, qasm3Parser.ARRAY, qasm3Parser.DURATION, qasm3Parser.STRETCH, qasm3Parser.DURATIONOF, qasm3Parser.BooleanLiteral, qasm3Parser.LPAREN, qasm3Parser.MINUS, qasm3Parser.TILDE, qasm3Parser.EXCLAMATION_POINT, qasm3Parser.ImaginaryLiteral, qasm3Parser.BinaryIntegerLiteral, qasm3Parser.OctalIntegerLiteral, qasm3Parser.DecimalIntegerLiteral, qasm3Parser.HexIntegerLiteral, qasm3Parser.Identifier, qasm3Parser.HardwareQubit, qasm3Parser.FloatLiteral, qasm3Parser.TimingLiteral, qasm3Parser.BitstringLiteral]:
                self.state = 409
                self.expression(0)
                pass
            elif token in [qasm3Parser.MEASURE]:
                self.state = 410
                self.measureExpression()
                pass
            else:
                raise NoViableAltException(self)

            self.state = 413
            self.match(qasm3Parser.SEMICOLON)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ExpressionStatementContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def expression(self):
            return self.getTypedRuleContext(qasm3Parser.ExpressionContext,0)


        def SEMICOLON(self):
            return self.getToken(qasm3Parser.SEMICOLON, 0)

        def getRuleIndex(self):
            return qasm3Parser.RULE_expressionStatement

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterExpressionStatement" ):
                listener.enterExpressionStatement(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitExpressionStatement" ):
                listener.exitExpressionStatement(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitExpressionStatement" ):
                return visitor.visitExpressionStatement(self)
            else:
                return visitor.visitChildren(self)




    def expressionStatement(self):

        localctx = qasm3Parser.ExpressionStatementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 64, self.RULE_expressionStatement)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 415
            self.expression(0)
            self.state = 416
            self.match(qasm3Parser.SEMICOLON)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class CalStatementContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def CAL(self):
            return self.getToken(qasm3Parser.CAL, 0)

        def LBRACE(self):
            return self.getToken(qasm3Parser.LBRACE, 0)

        def RBRACE(self):
            return self.getToken(qasm3Parser.RBRACE, 0)

        def CalibrationBlock(self):
            return self.getToken(qasm3Parser.CalibrationBlock, 0)

        def getRuleIndex(self):
            return qasm3Parser.RULE_calStatement

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterCalStatement" ):
                listener.enterCalStatement(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitCalStatement" ):
                listener.exitCalStatement(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitCalStatement" ):
                return visitor.visitCalStatement(self)
            else:
                return visitor.visitChildren(self)




    def calStatement(self):

        localctx = qasm3Parser.CalStatementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 66, self.RULE_calStatement)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 418
            self.match(qasm3Parser.CAL)
            self.state = 419
            self.match(qasm3Parser.LBRACE)
            self.state = 421
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.CalibrationBlock:
                self.state = 420
                self.match(qasm3Parser.CalibrationBlock)


            self.state = 423
            self.match(qasm3Parser.RBRACE)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class DefcalStatementContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def DEFCAL(self):
            return self.getToken(qasm3Parser.DEFCAL, 0)

        def defcalTarget(self):
            return self.getTypedRuleContext(qasm3Parser.DefcalTargetContext,0)


        def defcalOperandList(self):
            return self.getTypedRuleContext(qasm3Parser.DefcalOperandListContext,0)


        def LBRACE(self):
            return self.getToken(qasm3Parser.LBRACE, 0)

        def RBRACE(self):
            return self.getToken(qasm3Parser.RBRACE, 0)

        def LPAREN(self):
            return self.getToken(qasm3Parser.LPAREN, 0)

        def RPAREN(self):
            return self.getToken(qasm3Parser.RPAREN, 0)

        def returnSignature(self):
            return self.getTypedRuleContext(qasm3Parser.ReturnSignatureContext,0)


        def CalibrationBlock(self):
            return self.getToken(qasm3Parser.CalibrationBlock, 0)

        def defcalArgumentDefinitionList(self):
            return self.getTypedRuleContext(qasm3Parser.DefcalArgumentDefinitionListContext,0)


        def getRuleIndex(self):
            return qasm3Parser.RULE_defcalStatement

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterDefcalStatement" ):
                listener.enterDefcalStatement(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitDefcalStatement" ):
                listener.exitDefcalStatement(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitDefcalStatement" ):
                return visitor.visitDefcalStatement(self)
            else:
                return visitor.visitChildren(self)




    def defcalStatement(self):

        localctx = qasm3Parser.DefcalStatementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 68, self.RULE_defcalStatement)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 425
            self.match(qasm3Parser.DEFCAL)
            self.state = 426
            self.defcalTarget()
            self.state = 432
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.LPAREN:
                self.state = 427
                self.match(qasm3Parser.LPAREN)
                self.state = 429
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << qasm3Parser.READONLY) | (1 << qasm3Parser.MUTABLE) | (1 << qasm3Parser.QREG) | (1 << qasm3Parser.QUBIT) | (1 << qasm3Parser.CREG) | (1 << qasm3Parser.BOOL) | (1 << qasm3Parser.BIT) | (1 << qasm3Parser.INT) | (1 << qasm3Parser.UINT) | (1 << qasm3Parser.FLOAT) | (1 << qasm3Parser.ANGLE) | (1 << qasm3Parser.COMPLEX) | (1 << qasm3Parser.ARRAY) | (1 << qasm3Parser.DURATION) | (1 << qasm3Parser.STRETCH) | (1 << qasm3Parser.DURATIONOF) | (1 << qasm3Parser.BooleanLiteral) | (1 << qasm3Parser.LPAREN))) != 0) or ((((_la - 67)) & ~0x3f) == 0 and ((1 << (_la - 67)) & ((1 << (qasm3Parser.MINUS - 67)) | (1 << (qasm3Parser.TILDE - 67)) | (1 << (qasm3Parser.EXCLAMATION_POINT - 67)) | (1 << (qasm3Parser.ImaginaryLiteral - 67)) | (1 << (qasm3Parser.BinaryIntegerLiteral - 67)) | (1 << (qasm3Parser.OctalIntegerLiteral - 67)) | (1 << (qasm3Parser.DecimalIntegerLiteral - 67)) | (1 << (qasm3Parser.HexIntegerLiteral - 67)) | (1 << (qasm3Parser.Identifier - 67)) | (1 << (qasm3Parser.HardwareQubit - 67)) | (1 << (qasm3Parser.FloatLiteral - 67)) | (1 << (qasm3Parser.TimingLiteral - 67)) | (1 << (qasm3Parser.BitstringLiteral - 67)))) != 0):
                    self.state = 428
                    self.defcalArgumentDefinitionList()


                self.state = 431
                self.match(qasm3Parser.RPAREN)


            self.state = 434
            self.defcalOperandList()
            self.state = 436
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.ARROW:
                self.state = 435
                self.returnSignature()


            self.state = 438
            self.match(qasm3Parser.LBRACE)
            self.state = 440
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.CalibrationBlock:
                self.state = 439
                self.match(qasm3Parser.CalibrationBlock)


            self.state = 442
            self.match(qasm3Parser.RBRACE)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ExpressionContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser


        def getRuleIndex(self):
            return qasm3Parser.RULE_expression

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)


    class BitwiseXorExpressionContext(ExpressionContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a qasm3Parser.ExpressionContext
            super().__init__(parser)
            self.op = None # Token
            self.copyFrom(ctx)

        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(qasm3Parser.ExpressionContext)
            else:
                return self.getTypedRuleContext(qasm3Parser.ExpressionContext,i)

        def CARET(self):
            return self.getToken(qasm3Parser.CARET, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterBitwiseXorExpression" ):
                listener.enterBitwiseXorExpression(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitBitwiseXorExpression" ):
                listener.exitBitwiseXorExpression(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitBitwiseXorExpression" ):
                return visitor.visitBitwiseXorExpression(self)
            else:
                return visitor.visitChildren(self)


    class AdditiveExpressionContext(ExpressionContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a qasm3Parser.ExpressionContext
            super().__init__(parser)
            self.op = None # Token
            self.copyFrom(ctx)

        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(qasm3Parser.ExpressionContext)
            else:
                return self.getTypedRuleContext(qasm3Parser.ExpressionContext,i)

        def PLUS(self):
            return self.getToken(qasm3Parser.PLUS, 0)
        def MINUS(self):
            return self.getToken(qasm3Parser.MINUS, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterAdditiveExpression" ):
                listener.enterAdditiveExpression(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitAdditiveExpression" ):
                listener.exitAdditiveExpression(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitAdditiveExpression" ):
                return visitor.visitAdditiveExpression(self)
            else:
                return visitor.visitChildren(self)


    class DurationofExpressionContext(ExpressionContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a qasm3Parser.ExpressionContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def DURATIONOF(self):
            return self.getToken(qasm3Parser.DURATIONOF, 0)
        def LPAREN(self):
            return self.getToken(qasm3Parser.LPAREN, 0)
        def scope(self):
            return self.getTypedRuleContext(qasm3Parser.ScopeContext,0)

        def RPAREN(self):
            return self.getToken(qasm3Parser.RPAREN, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterDurationofExpression" ):
                listener.enterDurationofExpression(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitDurationofExpression" ):
                listener.exitDurationofExpression(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitDurationofExpression" ):
                return visitor.visitDurationofExpression(self)
            else:
                return visitor.visitChildren(self)


    class ParenthesisExpressionContext(ExpressionContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a qasm3Parser.ExpressionContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def LPAREN(self):
            return self.getToken(qasm3Parser.LPAREN, 0)
        def expression(self):
            return self.getTypedRuleContext(qasm3Parser.ExpressionContext,0)

        def RPAREN(self):
            return self.getToken(qasm3Parser.RPAREN, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterParenthesisExpression" ):
                listener.enterParenthesisExpression(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitParenthesisExpression" ):
                listener.exitParenthesisExpression(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitParenthesisExpression" ):
                return visitor.visitParenthesisExpression(self)
            else:
                return visitor.visitChildren(self)


    class ComparisonExpressionContext(ExpressionContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a qasm3Parser.ExpressionContext
            super().__init__(parser)
            self.op = None # Token
            self.copyFrom(ctx)

        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(qasm3Parser.ExpressionContext)
            else:
                return self.getTypedRuleContext(qasm3Parser.ExpressionContext,i)

        def ComparisonOperator(self):
            return self.getToken(qasm3Parser.ComparisonOperator, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterComparisonExpression" ):
                listener.enterComparisonExpression(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitComparisonExpression" ):
                listener.exitComparisonExpression(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitComparisonExpression" ):
                return visitor.visitComparisonExpression(self)
            else:
                return visitor.visitChildren(self)


    class MultiplicativeExpressionContext(ExpressionContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a qasm3Parser.ExpressionContext
            super().__init__(parser)
            self.op = None # Token
            self.copyFrom(ctx)

        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(qasm3Parser.ExpressionContext)
            else:
                return self.getTypedRuleContext(qasm3Parser.ExpressionContext,i)

        def ASTERISK(self):
            return self.getToken(qasm3Parser.ASTERISK, 0)
        def SLASH(self):
            return self.getToken(qasm3Parser.SLASH, 0)
        def PERCENT(self):
            return self.getToken(qasm3Parser.PERCENT, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterMultiplicativeExpression" ):
                listener.enterMultiplicativeExpression(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitMultiplicativeExpression" ):
                listener.exitMultiplicativeExpression(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitMultiplicativeExpression" ):
                return visitor.visitMultiplicativeExpression(self)
            else:
                return visitor.visitChildren(self)


    class LogicalOrExpressionContext(ExpressionContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a qasm3Parser.ExpressionContext
            super().__init__(parser)
            self.op = None # Token
            self.copyFrom(ctx)

        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(qasm3Parser.ExpressionContext)
            else:
                return self.getTypedRuleContext(qasm3Parser.ExpressionContext,i)

        def DOUBLE_PIPE(self):
            return self.getToken(qasm3Parser.DOUBLE_PIPE, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterLogicalOrExpression" ):
                listener.enterLogicalOrExpression(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitLogicalOrExpression" ):
                listener.exitLogicalOrExpression(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitLogicalOrExpression" ):
                return visitor.visitLogicalOrExpression(self)
            else:
                return visitor.visitChildren(self)


    class CastExpressionContext(ExpressionContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a qasm3Parser.ExpressionContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def LPAREN(self):
            return self.getToken(qasm3Parser.LPAREN, 0)
        def expression(self):
            return self.getTypedRuleContext(qasm3Parser.ExpressionContext,0)

        def RPAREN(self):
            return self.getToken(qasm3Parser.RPAREN, 0)
        def scalarType(self):
            return self.getTypedRuleContext(qasm3Parser.ScalarTypeContext,0)

        def arrayType(self):
            return self.getTypedRuleContext(qasm3Parser.ArrayTypeContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterCastExpression" ):
                listener.enterCastExpression(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitCastExpression" ):
                listener.exitCastExpression(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitCastExpression" ):
                return visitor.visitCastExpression(self)
            else:
                return visitor.visitChildren(self)


    class PowerExpressionContext(ExpressionContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a qasm3Parser.ExpressionContext
            super().__init__(parser)
            self.op = None # Token
            self.copyFrom(ctx)

        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(qasm3Parser.ExpressionContext)
            else:
                return self.getTypedRuleContext(qasm3Parser.ExpressionContext,i)

        def DOUBLE_ASTERISK(self):
            return self.getToken(qasm3Parser.DOUBLE_ASTERISK, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterPowerExpression" ):
                listener.enterPowerExpression(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitPowerExpression" ):
                listener.exitPowerExpression(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitPowerExpression" ):
                return visitor.visitPowerExpression(self)
            else:
                return visitor.visitChildren(self)


    class BitwiseOrExpressionContext(ExpressionContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a qasm3Parser.ExpressionContext
            super().__init__(parser)
            self.op = None # Token
            self.copyFrom(ctx)

        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(qasm3Parser.ExpressionContext)
            else:
                return self.getTypedRuleContext(qasm3Parser.ExpressionContext,i)

        def PIPE(self):
            return self.getToken(qasm3Parser.PIPE, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterBitwiseOrExpression" ):
                listener.enterBitwiseOrExpression(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitBitwiseOrExpression" ):
                listener.exitBitwiseOrExpression(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitBitwiseOrExpression" ):
                return visitor.visitBitwiseOrExpression(self)
            else:
                return visitor.visitChildren(self)


    class CallExpressionContext(ExpressionContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a qasm3Parser.ExpressionContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def Identifier(self):
            return self.getToken(qasm3Parser.Identifier, 0)
        def LPAREN(self):
            return self.getToken(qasm3Parser.LPAREN, 0)
        def RPAREN(self):
            return self.getToken(qasm3Parser.RPAREN, 0)
        def expressionList(self):
            return self.getTypedRuleContext(qasm3Parser.ExpressionListContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterCallExpression" ):
                listener.enterCallExpression(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitCallExpression" ):
                listener.exitCallExpression(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitCallExpression" ):
                return visitor.visitCallExpression(self)
            else:
                return visitor.visitChildren(self)


    class BitshiftExpressionContext(ExpressionContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a qasm3Parser.ExpressionContext
            super().__init__(parser)
            self.op = None # Token
            self.copyFrom(ctx)

        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(qasm3Parser.ExpressionContext)
            else:
                return self.getTypedRuleContext(qasm3Parser.ExpressionContext,i)

        def BitshiftOperator(self):
            return self.getToken(qasm3Parser.BitshiftOperator, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterBitshiftExpression" ):
                listener.enterBitshiftExpression(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitBitshiftExpression" ):
                listener.exitBitshiftExpression(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitBitshiftExpression" ):
                return visitor.visitBitshiftExpression(self)
            else:
                return visitor.visitChildren(self)


    class BitwiseAndExpressionContext(ExpressionContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a qasm3Parser.ExpressionContext
            super().__init__(parser)
            self.op = None # Token
            self.copyFrom(ctx)

        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(qasm3Parser.ExpressionContext)
            else:
                return self.getTypedRuleContext(qasm3Parser.ExpressionContext,i)

        def AMPERSAND(self):
            return self.getToken(qasm3Parser.AMPERSAND, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterBitwiseAndExpression" ):
                listener.enterBitwiseAndExpression(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitBitwiseAndExpression" ):
                listener.exitBitwiseAndExpression(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitBitwiseAndExpression" ):
                return visitor.visitBitwiseAndExpression(self)
            else:
                return visitor.visitChildren(self)


    class EqualityExpressionContext(ExpressionContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a qasm3Parser.ExpressionContext
            super().__init__(parser)
            self.op = None # Token
            self.copyFrom(ctx)

        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(qasm3Parser.ExpressionContext)
            else:
                return self.getTypedRuleContext(qasm3Parser.ExpressionContext,i)

        def EqualityOperator(self):
            return self.getToken(qasm3Parser.EqualityOperator, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterEqualityExpression" ):
                listener.enterEqualityExpression(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitEqualityExpression" ):
                listener.exitEqualityExpression(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitEqualityExpression" ):
                return visitor.visitEqualityExpression(self)
            else:
                return visitor.visitChildren(self)


    class LogicalAndExpressionContext(ExpressionContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a qasm3Parser.ExpressionContext
            super().__init__(parser)
            self.op = None # Token
            self.copyFrom(ctx)

        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(qasm3Parser.ExpressionContext)
            else:
                return self.getTypedRuleContext(qasm3Parser.ExpressionContext,i)

        def DOUBLE_AMPERSAND(self):
            return self.getToken(qasm3Parser.DOUBLE_AMPERSAND, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterLogicalAndExpression" ):
                listener.enterLogicalAndExpression(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitLogicalAndExpression" ):
                listener.exitLogicalAndExpression(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitLogicalAndExpression" ):
                return visitor.visitLogicalAndExpression(self)
            else:
                return visitor.visitChildren(self)


    class IndexExpressionContext(ExpressionContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a qasm3Parser.ExpressionContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def expression(self):
            return self.getTypedRuleContext(qasm3Parser.ExpressionContext,0)

        def indexOperator(self):
            return self.getTypedRuleContext(qasm3Parser.IndexOperatorContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterIndexExpression" ):
                listener.enterIndexExpression(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitIndexExpression" ):
                listener.exitIndexExpression(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitIndexExpression" ):
                return visitor.visitIndexExpression(self)
            else:
                return visitor.visitChildren(self)


    class UnaryExpressionContext(ExpressionContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a qasm3Parser.ExpressionContext
            super().__init__(parser)
            self.op = None # Token
            self.copyFrom(ctx)

        def expression(self):
            return self.getTypedRuleContext(qasm3Parser.ExpressionContext,0)

        def TILDE(self):
            return self.getToken(qasm3Parser.TILDE, 0)
        def EXCLAMATION_POINT(self):
            return self.getToken(qasm3Parser.EXCLAMATION_POINT, 0)
        def MINUS(self):
            return self.getToken(qasm3Parser.MINUS, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterUnaryExpression" ):
                listener.enterUnaryExpression(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitUnaryExpression" ):
                listener.exitUnaryExpression(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitUnaryExpression" ):
                return visitor.visitUnaryExpression(self)
            else:
                return visitor.visitChildren(self)


    class LiteralExpressionContext(ExpressionContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a qasm3Parser.ExpressionContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def Identifier(self):
            return self.getToken(qasm3Parser.Identifier, 0)
        def BinaryIntegerLiteral(self):
            return self.getToken(qasm3Parser.BinaryIntegerLiteral, 0)
        def OctalIntegerLiteral(self):
            return self.getToken(qasm3Parser.OctalIntegerLiteral, 0)
        def DecimalIntegerLiteral(self):
            return self.getToken(qasm3Parser.DecimalIntegerLiteral, 0)
        def HexIntegerLiteral(self):
            return self.getToken(qasm3Parser.HexIntegerLiteral, 0)
        def FloatLiteral(self):
            return self.getToken(qasm3Parser.FloatLiteral, 0)
        def ImaginaryLiteral(self):
            return self.getToken(qasm3Parser.ImaginaryLiteral, 0)
        def BooleanLiteral(self):
            return self.getToken(qasm3Parser.BooleanLiteral, 0)
        def BitstringLiteral(self):
            return self.getToken(qasm3Parser.BitstringLiteral, 0)
        def TimingLiteral(self):
            return self.getToken(qasm3Parser.TimingLiteral, 0)
        def HardwareQubit(self):
            return self.getToken(qasm3Parser.HardwareQubit, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterLiteralExpression" ):
                listener.enterLiteralExpression(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitLiteralExpression" ):
                listener.exitLiteralExpression(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitLiteralExpression" ):
                return visitor.visitLiteralExpression(self)
            else:
                return visitor.visitChildren(self)



    def expression(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = qasm3Parser.ExpressionContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 70
        self.enterRecursionRule(localctx, 70, self.RULE_expression, _p)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 471
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,43,self._ctx)
            if la_ == 1:
                localctx = qasm3Parser.ParenthesisExpressionContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx

                self.state = 445
                self.match(qasm3Parser.LPAREN)
                self.state = 446
                self.expression(0)
                self.state = 447
                self.match(qasm3Parser.RPAREN)
                pass

            elif la_ == 2:
                localctx = qasm3Parser.UnaryExpressionContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 449
                localctx.op = self._input.LT(1)
                _la = self._input.LA(1)
                if not(((((_la - 67)) & ~0x3f) == 0 and ((1 << (_la - 67)) & ((1 << (qasm3Parser.MINUS - 67)) | (1 << (qasm3Parser.TILDE - 67)) | (1 << (qasm3Parser.EXCLAMATION_POINT - 67)))) != 0)):
                    localctx.op = self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 450
                self.expression(15)
                pass

            elif la_ == 3:
                localctx = qasm3Parser.CastExpressionContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 453
                self._errHandler.sync(self)
                token = self._input.LA(1)
                if token in [qasm3Parser.BOOL, qasm3Parser.BIT, qasm3Parser.INT, qasm3Parser.UINT, qasm3Parser.FLOAT, qasm3Parser.ANGLE, qasm3Parser.COMPLEX, qasm3Parser.DURATION, qasm3Parser.STRETCH]:
                    self.state = 451
                    self.scalarType()
                    pass
                elif token in [qasm3Parser.ARRAY]:
                    self.state = 452
                    self.arrayType()
                    pass
                else:
                    raise NoViableAltException(self)

                self.state = 455
                self.match(qasm3Parser.LPAREN)
                self.state = 456
                self.expression(0)
                self.state = 457
                self.match(qasm3Parser.RPAREN)
                pass

            elif la_ == 4:
                localctx = qasm3Parser.DurationofExpressionContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 459
                self.match(qasm3Parser.DURATIONOF)
                self.state = 460
                self.match(qasm3Parser.LPAREN)
                self.state = 461
                self.scope()
                self.state = 462
                self.match(qasm3Parser.RPAREN)
                pass

            elif la_ == 5:
                localctx = qasm3Parser.CallExpressionContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 464
                self.match(qasm3Parser.Identifier)
                self.state = 465
                self.match(qasm3Parser.LPAREN)
                self.state = 467
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << qasm3Parser.BOOL) | (1 << qasm3Parser.BIT) | (1 << qasm3Parser.INT) | (1 << qasm3Parser.UINT) | (1 << qasm3Parser.FLOAT) | (1 << qasm3Parser.ANGLE) | (1 << qasm3Parser.COMPLEX) | (1 << qasm3Parser.ARRAY) | (1 << qasm3Parser.DURATION) | (1 << qasm3Parser.STRETCH) | (1 << qasm3Parser.DURATIONOF) | (1 << qasm3Parser.BooleanLiteral) | (1 << qasm3Parser.LPAREN))) != 0) or ((((_la - 67)) & ~0x3f) == 0 and ((1 << (_la - 67)) & ((1 << (qasm3Parser.MINUS - 67)) | (1 << (qasm3Parser.TILDE - 67)) | (1 << (qasm3Parser.EXCLAMATION_POINT - 67)) | (1 << (qasm3Parser.ImaginaryLiteral - 67)) | (1 << (qasm3Parser.BinaryIntegerLiteral - 67)) | (1 << (qasm3Parser.OctalIntegerLiteral - 67)) | (1 << (qasm3Parser.DecimalIntegerLiteral - 67)) | (1 << (qasm3Parser.HexIntegerLiteral - 67)) | (1 << (qasm3Parser.Identifier - 67)) | (1 << (qasm3Parser.HardwareQubit - 67)) | (1 << (qasm3Parser.FloatLiteral - 67)) | (1 << (qasm3Parser.TimingLiteral - 67)) | (1 << (qasm3Parser.BitstringLiteral - 67)))) != 0):
                    self.state = 466
                    self.expressionList()


                self.state = 469
                self.match(qasm3Parser.RPAREN)
                pass

            elif la_ == 6:
                localctx = qasm3Parser.LiteralExpressionContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 470
                _la = self._input.LA(1)
                if not(((((_la - 52)) & ~0x3f) == 0 and ((1 << (_la - 52)) & ((1 << (qasm3Parser.BooleanLiteral - 52)) | (1 << (qasm3Parser.ImaginaryLiteral - 52)) | (1 << (qasm3Parser.BinaryIntegerLiteral - 52)) | (1 << (qasm3Parser.OctalIntegerLiteral - 52)) | (1 << (qasm3Parser.DecimalIntegerLiteral - 52)) | (1 << (qasm3Parser.HexIntegerLiteral - 52)) | (1 << (qasm3Parser.Identifier - 52)) | (1 << (qasm3Parser.HardwareQubit - 52)) | (1 << (qasm3Parser.FloatLiteral - 52)) | (1 << (qasm3Parser.TimingLiteral - 52)) | (1 << (qasm3Parser.BitstringLiteral - 52)))) != 0)):
                    self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                pass


            self._ctx.stop = self._input.LT(-1)
            self.state = 510
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,45,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    self.state = 508
                    self._errHandler.sync(self)
                    la_ = self._interp.adaptivePredict(self._input,44,self._ctx)
                    if la_ == 1:
                        localctx = qasm3Parser.PowerExpressionContext(self, qasm3Parser.ExpressionContext(self, _parentctx, _parentState))
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expression)
                        self.state = 473
                        if not self.precpred(self._ctx, 16):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 16)")
                        self.state = 474
                        localctx.op = self.match(qasm3Parser.DOUBLE_ASTERISK)
                        self.state = 475
                        self.expression(16)
                        pass

                    elif la_ == 2:
                        localctx = qasm3Parser.MultiplicativeExpressionContext(self, qasm3Parser.ExpressionContext(self, _parentctx, _parentState))
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expression)
                        self.state = 476
                        if not self.precpred(self._ctx, 14):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 14)")
                        self.state = 477
                        localctx.op = self._input.LT(1)
                        _la = self._input.LA(1)
                        if not(((((_la - 68)) & ~0x3f) == 0 and ((1 << (_la - 68)) & ((1 << (qasm3Parser.ASTERISK - 68)) | (1 << (qasm3Parser.SLASH - 68)) | (1 << (qasm3Parser.PERCENT - 68)))) != 0)):
                            localctx.op = self._errHandler.recoverInline(self)
                        else:
                            self._errHandler.reportMatch(self)
                            self.consume()
                        self.state = 478
                        self.expression(15)
                        pass

                    elif la_ == 3:
                        localctx = qasm3Parser.AdditiveExpressionContext(self, qasm3Parser.ExpressionContext(self, _parentctx, _parentState))
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expression)
                        self.state = 479
                        if not self.precpred(self._ctx, 13):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 13)")
                        self.state = 480
                        localctx.op = self._input.LT(1)
                        _la = self._input.LA(1)
                        if not(_la==qasm3Parser.PLUS or _la==qasm3Parser.MINUS):
                            localctx.op = self._errHandler.recoverInline(self)
                        else:
                            self._errHandler.reportMatch(self)
                            self.consume()
                        self.state = 481
                        self.expression(14)
                        pass

                    elif la_ == 4:
                        localctx = qasm3Parser.BitshiftExpressionContext(self, qasm3Parser.ExpressionContext(self, _parentctx, _parentState))
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expression)
                        self.state = 482
                        if not self.precpred(self._ctx, 12):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 12)")
                        self.state = 483
                        localctx.op = self.match(qasm3Parser.BitshiftOperator)
                        self.state = 484
                        self.expression(13)
                        pass

                    elif la_ == 5:
                        localctx = qasm3Parser.ComparisonExpressionContext(self, qasm3Parser.ExpressionContext(self, _parentctx, _parentState))
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expression)
                        self.state = 485
                        if not self.precpred(self._ctx, 11):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 11)")
                        self.state = 486
                        localctx.op = self.match(qasm3Parser.ComparisonOperator)
                        self.state = 487
                        self.expression(12)
                        pass

                    elif la_ == 6:
                        localctx = qasm3Parser.EqualityExpressionContext(self, qasm3Parser.ExpressionContext(self, _parentctx, _parentState))
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expression)
                        self.state = 488
                        if not self.precpred(self._ctx, 10):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 10)")
                        self.state = 489
                        localctx.op = self.match(qasm3Parser.EqualityOperator)
                        self.state = 490
                        self.expression(11)
                        pass

                    elif la_ == 7:
                        localctx = qasm3Parser.BitwiseAndExpressionContext(self, qasm3Parser.ExpressionContext(self, _parentctx, _parentState))
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expression)
                        self.state = 491
                        if not self.precpred(self._ctx, 9):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 9)")
                        self.state = 492
                        localctx.op = self.match(qasm3Parser.AMPERSAND)
                        self.state = 493
                        self.expression(10)
                        pass

                    elif la_ == 8:
                        localctx = qasm3Parser.BitwiseXorExpressionContext(self, qasm3Parser.ExpressionContext(self, _parentctx, _parentState))
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expression)
                        self.state = 494
                        if not self.precpred(self._ctx, 8):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 8)")
                        self.state = 495
                        localctx.op = self.match(qasm3Parser.CARET)
                        self.state = 496
                        self.expression(9)
                        pass

                    elif la_ == 9:
                        localctx = qasm3Parser.BitwiseOrExpressionContext(self, qasm3Parser.ExpressionContext(self, _parentctx, _parentState))
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expression)
                        self.state = 497
                        if not self.precpred(self._ctx, 7):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 7)")
                        self.state = 498
                        localctx.op = self.match(qasm3Parser.PIPE)
                        self.state = 499
                        self.expression(8)
                        pass

                    elif la_ == 10:
                        localctx = qasm3Parser.LogicalAndExpressionContext(self, qasm3Parser.ExpressionContext(self, _parentctx, _parentState))
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expression)
                        self.state = 500
                        if not self.precpred(self._ctx, 6):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 6)")
                        self.state = 501
                        localctx.op = self.match(qasm3Parser.DOUBLE_AMPERSAND)
                        self.state = 502
                        self.expression(7)
                        pass

                    elif la_ == 11:
                        localctx = qasm3Parser.LogicalOrExpressionContext(self, qasm3Parser.ExpressionContext(self, _parentctx, _parentState))
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expression)
                        self.state = 503
                        if not self.precpred(self._ctx, 5):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 5)")
                        self.state = 504
                        localctx.op = self.match(qasm3Parser.DOUBLE_PIPE)
                        self.state = 505
                        self.expression(6)
                        pass

                    elif la_ == 12:
                        localctx = qasm3Parser.IndexExpressionContext(self, qasm3Parser.ExpressionContext(self, _parentctx, _parentState))
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expression)
                        self.state = 506
                        if not self.precpred(self._ctx, 17):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 17)")
                        self.state = 507
                        self.indexOperator()
                        pass

             
                self.state = 512
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,45,self._ctx)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.unrollRecursionContexts(_parentctx)
        return localctx


    class AliasExpressionContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(qasm3Parser.ExpressionContext)
            else:
                return self.getTypedRuleContext(qasm3Parser.ExpressionContext,i)


        def DOUBLE_PLUS(self, i:int=None):
            if i is None:
                return self.getTokens(qasm3Parser.DOUBLE_PLUS)
            else:
                return self.getToken(qasm3Parser.DOUBLE_PLUS, i)

        def getRuleIndex(self):
            return qasm3Parser.RULE_aliasExpression

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterAliasExpression" ):
                listener.enterAliasExpression(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitAliasExpression" ):
                listener.exitAliasExpression(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitAliasExpression" ):
                return visitor.visitAliasExpression(self)
            else:
                return visitor.visitChildren(self)




    def aliasExpression(self):

        localctx = qasm3Parser.AliasExpressionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 72, self.RULE_aliasExpression)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 513
            self.expression(0)
            self.state = 518
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==qasm3Parser.DOUBLE_PLUS:
                self.state = 514
                self.match(qasm3Parser.DOUBLE_PLUS)
                self.state = 515
                self.expression(0)
                self.state = 520
                self._errHandler.sync(self)
                _la = self._input.LA(1)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class DeclarationExpressionContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def arrayLiteral(self):
            return self.getTypedRuleContext(qasm3Parser.ArrayLiteralContext,0)


        def expression(self):
            return self.getTypedRuleContext(qasm3Parser.ExpressionContext,0)


        def measureExpression(self):
            return self.getTypedRuleContext(qasm3Parser.MeasureExpressionContext,0)


        def getRuleIndex(self):
            return qasm3Parser.RULE_declarationExpression

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterDeclarationExpression" ):
                listener.enterDeclarationExpression(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitDeclarationExpression" ):
                listener.exitDeclarationExpression(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitDeclarationExpression" ):
                return visitor.visitDeclarationExpression(self)
            else:
                return visitor.visitChildren(self)




    def declarationExpression(self):

        localctx = qasm3Parser.DeclarationExpressionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 74, self.RULE_declarationExpression)
        try:
            self.state = 524
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [qasm3Parser.LBRACE]:
                self.enterOuterAlt(localctx, 1)
                self.state = 521
                self.arrayLiteral()
                pass
            elif token in [qasm3Parser.BOOL, qasm3Parser.BIT, qasm3Parser.INT, qasm3Parser.UINT, qasm3Parser.FLOAT, qasm3Parser.ANGLE, qasm3Parser.COMPLEX, qasm3Parser.ARRAY, qasm3Parser.DURATION, qasm3Parser.STRETCH, qasm3Parser.DURATIONOF, qasm3Parser.BooleanLiteral, qasm3Parser.LPAREN, qasm3Parser.MINUS, qasm3Parser.TILDE, qasm3Parser.EXCLAMATION_POINT, qasm3Parser.ImaginaryLiteral, qasm3Parser.BinaryIntegerLiteral, qasm3Parser.OctalIntegerLiteral, qasm3Parser.DecimalIntegerLiteral, qasm3Parser.HexIntegerLiteral, qasm3Parser.Identifier, qasm3Parser.HardwareQubit, qasm3Parser.FloatLiteral, qasm3Parser.TimingLiteral, qasm3Parser.BitstringLiteral]:
                self.enterOuterAlt(localctx, 2)
                self.state = 522
                self.expression(0)
                pass
            elif token in [qasm3Parser.MEASURE]:
                self.enterOuterAlt(localctx, 3)
                self.state = 523
                self.measureExpression()
                pass
            else:
                raise NoViableAltException(self)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class MeasureExpressionContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def MEASURE(self):
            return self.getToken(qasm3Parser.MEASURE, 0)

        def gateOperand(self):
            return self.getTypedRuleContext(qasm3Parser.GateOperandContext,0)


        def getRuleIndex(self):
            return qasm3Parser.RULE_measureExpression

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterMeasureExpression" ):
                listener.enterMeasureExpression(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitMeasureExpression" ):
                listener.exitMeasureExpression(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitMeasureExpression" ):
                return visitor.visitMeasureExpression(self)
            else:
                return visitor.visitChildren(self)




    def measureExpression(self):

        localctx = qasm3Parser.MeasureExpressionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 76, self.RULE_measureExpression)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 526
            self.match(qasm3Parser.MEASURE)
            self.state = 527
            self.gateOperand()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class RangeExpressionContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def COLON(self, i:int=None):
            if i is None:
                return self.getTokens(qasm3Parser.COLON)
            else:
                return self.getToken(qasm3Parser.COLON, i)

        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(qasm3Parser.ExpressionContext)
            else:
                return self.getTypedRuleContext(qasm3Parser.ExpressionContext,i)


        def getRuleIndex(self):
            return qasm3Parser.RULE_rangeExpression

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterRangeExpression" ):
                listener.enterRangeExpression(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitRangeExpression" ):
                listener.exitRangeExpression(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitRangeExpression" ):
                return visitor.visitRangeExpression(self)
            else:
                return visitor.visitChildren(self)




    def rangeExpression(self):

        localctx = qasm3Parser.RangeExpressionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 78, self.RULE_rangeExpression)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 530
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << qasm3Parser.BOOL) | (1 << qasm3Parser.BIT) | (1 << qasm3Parser.INT) | (1 << qasm3Parser.UINT) | (1 << qasm3Parser.FLOAT) | (1 << qasm3Parser.ANGLE) | (1 << qasm3Parser.COMPLEX) | (1 << qasm3Parser.ARRAY) | (1 << qasm3Parser.DURATION) | (1 << qasm3Parser.STRETCH) | (1 << qasm3Parser.DURATIONOF) | (1 << qasm3Parser.BooleanLiteral) | (1 << qasm3Parser.LPAREN))) != 0) or ((((_la - 67)) & ~0x3f) == 0 and ((1 << (_la - 67)) & ((1 << (qasm3Parser.MINUS - 67)) | (1 << (qasm3Parser.TILDE - 67)) | (1 << (qasm3Parser.EXCLAMATION_POINT - 67)) | (1 << (qasm3Parser.ImaginaryLiteral - 67)) | (1 << (qasm3Parser.BinaryIntegerLiteral - 67)) | (1 << (qasm3Parser.OctalIntegerLiteral - 67)) | (1 << (qasm3Parser.DecimalIntegerLiteral - 67)) | (1 << (qasm3Parser.HexIntegerLiteral - 67)) | (1 << (qasm3Parser.Identifier - 67)) | (1 << (qasm3Parser.HardwareQubit - 67)) | (1 << (qasm3Parser.FloatLiteral - 67)) | (1 << (qasm3Parser.TimingLiteral - 67)) | (1 << (qasm3Parser.BitstringLiteral - 67)))) != 0):
                self.state = 529
                self.expression(0)


            self.state = 532
            self.match(qasm3Parser.COLON)
            self.state = 534
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << qasm3Parser.BOOL) | (1 << qasm3Parser.BIT) | (1 << qasm3Parser.INT) | (1 << qasm3Parser.UINT) | (1 << qasm3Parser.FLOAT) | (1 << qasm3Parser.ANGLE) | (1 << qasm3Parser.COMPLEX) | (1 << qasm3Parser.ARRAY) | (1 << qasm3Parser.DURATION) | (1 << qasm3Parser.STRETCH) | (1 << qasm3Parser.DURATIONOF) | (1 << qasm3Parser.BooleanLiteral) | (1 << qasm3Parser.LPAREN))) != 0) or ((((_la - 67)) & ~0x3f) == 0 and ((1 << (_la - 67)) & ((1 << (qasm3Parser.MINUS - 67)) | (1 << (qasm3Parser.TILDE - 67)) | (1 << (qasm3Parser.EXCLAMATION_POINT - 67)) | (1 << (qasm3Parser.ImaginaryLiteral - 67)) | (1 << (qasm3Parser.BinaryIntegerLiteral - 67)) | (1 << (qasm3Parser.OctalIntegerLiteral - 67)) | (1 << (qasm3Parser.DecimalIntegerLiteral - 67)) | (1 << (qasm3Parser.HexIntegerLiteral - 67)) | (1 << (qasm3Parser.Identifier - 67)) | (1 << (qasm3Parser.HardwareQubit - 67)) | (1 << (qasm3Parser.FloatLiteral - 67)) | (1 << (qasm3Parser.TimingLiteral - 67)) | (1 << (qasm3Parser.BitstringLiteral - 67)))) != 0):
                self.state = 533
                self.expression(0)


            self.state = 538
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.COLON:
                self.state = 536
                self.match(qasm3Parser.COLON)
                self.state = 537
                self.expression(0)


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class SetExpressionContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def LBRACE(self):
            return self.getToken(qasm3Parser.LBRACE, 0)

        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(qasm3Parser.ExpressionContext)
            else:
                return self.getTypedRuleContext(qasm3Parser.ExpressionContext,i)


        def RBRACE(self):
            return self.getToken(qasm3Parser.RBRACE, 0)

        def COMMA(self, i:int=None):
            if i is None:
                return self.getTokens(qasm3Parser.COMMA)
            else:
                return self.getToken(qasm3Parser.COMMA, i)

        def getRuleIndex(self):
            return qasm3Parser.RULE_setExpression

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterSetExpression" ):
                listener.enterSetExpression(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitSetExpression" ):
                listener.exitSetExpression(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitSetExpression" ):
                return visitor.visitSetExpression(self)
            else:
                return visitor.visitChildren(self)




    def setExpression(self):

        localctx = qasm3Parser.SetExpressionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 80, self.RULE_setExpression)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 540
            self.match(qasm3Parser.LBRACE)
            self.state = 541
            self.expression(0)
            self.state = 546
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,51,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 542
                    self.match(qasm3Parser.COMMA)
                    self.state = 543
                    self.expression(0) 
                self.state = 548
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,51,self._ctx)

            self.state = 550
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.COMMA:
                self.state = 549
                self.match(qasm3Parser.COMMA)


            self.state = 552
            self.match(qasm3Parser.RBRACE)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ArrayLiteralContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def LBRACE(self):
            return self.getToken(qasm3Parser.LBRACE, 0)

        def RBRACE(self):
            return self.getToken(qasm3Parser.RBRACE, 0)

        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(qasm3Parser.ExpressionContext)
            else:
                return self.getTypedRuleContext(qasm3Parser.ExpressionContext,i)


        def arrayLiteral(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(qasm3Parser.ArrayLiteralContext)
            else:
                return self.getTypedRuleContext(qasm3Parser.ArrayLiteralContext,i)


        def COMMA(self, i:int=None):
            if i is None:
                return self.getTokens(qasm3Parser.COMMA)
            else:
                return self.getToken(qasm3Parser.COMMA, i)

        def getRuleIndex(self):
            return qasm3Parser.RULE_arrayLiteral

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterArrayLiteral" ):
                listener.enterArrayLiteral(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitArrayLiteral" ):
                listener.exitArrayLiteral(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitArrayLiteral" ):
                return visitor.visitArrayLiteral(self)
            else:
                return visitor.visitChildren(self)




    def arrayLiteral(self):

        localctx = qasm3Parser.ArrayLiteralContext(self, self._ctx, self.state)
        self.enterRule(localctx, 82, self.RULE_arrayLiteral)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 554
            self.match(qasm3Parser.LBRACE)
            self.state = 557
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [qasm3Parser.BOOL, qasm3Parser.BIT, qasm3Parser.INT, qasm3Parser.UINT, qasm3Parser.FLOAT, qasm3Parser.ANGLE, qasm3Parser.COMPLEX, qasm3Parser.ARRAY, qasm3Parser.DURATION, qasm3Parser.STRETCH, qasm3Parser.DURATIONOF, qasm3Parser.BooleanLiteral, qasm3Parser.LPAREN, qasm3Parser.MINUS, qasm3Parser.TILDE, qasm3Parser.EXCLAMATION_POINT, qasm3Parser.ImaginaryLiteral, qasm3Parser.BinaryIntegerLiteral, qasm3Parser.OctalIntegerLiteral, qasm3Parser.DecimalIntegerLiteral, qasm3Parser.HexIntegerLiteral, qasm3Parser.Identifier, qasm3Parser.HardwareQubit, qasm3Parser.FloatLiteral, qasm3Parser.TimingLiteral, qasm3Parser.BitstringLiteral]:
                self.state = 555
                self.expression(0)
                pass
            elif token in [qasm3Parser.LBRACE]:
                self.state = 556
                self.arrayLiteral()
                pass
            else:
                raise NoViableAltException(self)

            self.state = 566
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,55,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 559
                    self.match(qasm3Parser.COMMA)
                    self.state = 562
                    self._errHandler.sync(self)
                    token = self._input.LA(1)
                    if token in [qasm3Parser.BOOL, qasm3Parser.BIT, qasm3Parser.INT, qasm3Parser.UINT, qasm3Parser.FLOAT, qasm3Parser.ANGLE, qasm3Parser.COMPLEX, qasm3Parser.ARRAY, qasm3Parser.DURATION, qasm3Parser.STRETCH, qasm3Parser.DURATIONOF, qasm3Parser.BooleanLiteral, qasm3Parser.LPAREN, qasm3Parser.MINUS, qasm3Parser.TILDE, qasm3Parser.EXCLAMATION_POINT, qasm3Parser.ImaginaryLiteral, qasm3Parser.BinaryIntegerLiteral, qasm3Parser.OctalIntegerLiteral, qasm3Parser.DecimalIntegerLiteral, qasm3Parser.HexIntegerLiteral, qasm3Parser.Identifier, qasm3Parser.HardwareQubit, qasm3Parser.FloatLiteral, qasm3Parser.TimingLiteral, qasm3Parser.BitstringLiteral]:
                        self.state = 560
                        self.expression(0)
                        pass
                    elif token in [qasm3Parser.LBRACE]:
                        self.state = 561
                        self.arrayLiteral()
                        pass
                    else:
                        raise NoViableAltException(self)
             
                self.state = 568
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,55,self._ctx)

            self.state = 570
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.COMMA:
                self.state = 569
                self.match(qasm3Parser.COMMA)


            self.state = 572
            self.match(qasm3Parser.RBRACE)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class IndexOperatorContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def LBRACKET(self):
            return self.getToken(qasm3Parser.LBRACKET, 0)

        def RBRACKET(self):
            return self.getToken(qasm3Parser.RBRACKET, 0)

        def setExpression(self):
            return self.getTypedRuleContext(qasm3Parser.SetExpressionContext,0)


        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(qasm3Parser.ExpressionContext)
            else:
                return self.getTypedRuleContext(qasm3Parser.ExpressionContext,i)


        def rangeExpression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(qasm3Parser.RangeExpressionContext)
            else:
                return self.getTypedRuleContext(qasm3Parser.RangeExpressionContext,i)


        def COMMA(self, i:int=None):
            if i is None:
                return self.getTokens(qasm3Parser.COMMA)
            else:
                return self.getToken(qasm3Parser.COMMA, i)

        def getRuleIndex(self):
            return qasm3Parser.RULE_indexOperator

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterIndexOperator" ):
                listener.enterIndexOperator(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitIndexOperator" ):
                listener.exitIndexOperator(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitIndexOperator" ):
                return visitor.visitIndexOperator(self)
            else:
                return visitor.visitChildren(self)




    def indexOperator(self):

        localctx = qasm3Parser.IndexOperatorContext(self, self._ctx, self.state)
        self.enterRule(localctx, 84, self.RULE_indexOperator)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 574
            self.match(qasm3Parser.LBRACKET)
            self.state = 593
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [qasm3Parser.LBRACE]:
                self.state = 575
                self.setExpression()
                pass
            elif token in [qasm3Parser.BOOL, qasm3Parser.BIT, qasm3Parser.INT, qasm3Parser.UINT, qasm3Parser.FLOAT, qasm3Parser.ANGLE, qasm3Parser.COMPLEX, qasm3Parser.ARRAY, qasm3Parser.DURATION, qasm3Parser.STRETCH, qasm3Parser.DURATIONOF, qasm3Parser.BooleanLiteral, qasm3Parser.LPAREN, qasm3Parser.COLON, qasm3Parser.MINUS, qasm3Parser.TILDE, qasm3Parser.EXCLAMATION_POINT, qasm3Parser.ImaginaryLiteral, qasm3Parser.BinaryIntegerLiteral, qasm3Parser.OctalIntegerLiteral, qasm3Parser.DecimalIntegerLiteral, qasm3Parser.HexIntegerLiteral, qasm3Parser.Identifier, qasm3Parser.HardwareQubit, qasm3Parser.FloatLiteral, qasm3Parser.TimingLiteral, qasm3Parser.BitstringLiteral]:
                self.state = 578
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,57,self._ctx)
                if la_ == 1:
                    self.state = 576
                    self.expression(0)
                    pass

                elif la_ == 2:
                    self.state = 577
                    self.rangeExpression()
                    pass


                self.state = 587
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,59,self._ctx)
                while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                    if _alt==1:
                        self.state = 580
                        self.match(qasm3Parser.COMMA)
                        self.state = 583
                        self._errHandler.sync(self)
                        la_ = self._interp.adaptivePredict(self._input,58,self._ctx)
                        if la_ == 1:
                            self.state = 581
                            self.expression(0)
                            pass

                        elif la_ == 2:
                            self.state = 582
                            self.rangeExpression()
                            pass

                 
                    self.state = 589
                    self._errHandler.sync(self)
                    _alt = self._interp.adaptivePredict(self._input,59,self._ctx)

                self.state = 591
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==qasm3Parser.COMMA:
                    self.state = 590
                    self.match(qasm3Parser.COMMA)


                pass
            else:
                raise NoViableAltException(self)

            self.state = 595
            self.match(qasm3Parser.RBRACKET)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class IndexedIdentifierContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def Identifier(self):
            return self.getToken(qasm3Parser.Identifier, 0)

        def indexOperator(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(qasm3Parser.IndexOperatorContext)
            else:
                return self.getTypedRuleContext(qasm3Parser.IndexOperatorContext,i)


        def getRuleIndex(self):
            return qasm3Parser.RULE_indexedIdentifier

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterIndexedIdentifier" ):
                listener.enterIndexedIdentifier(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitIndexedIdentifier" ):
                listener.exitIndexedIdentifier(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitIndexedIdentifier" ):
                return visitor.visitIndexedIdentifier(self)
            else:
                return visitor.visitChildren(self)




    def indexedIdentifier(self):

        localctx = qasm3Parser.IndexedIdentifierContext(self, self._ctx, self.state)
        self.enterRule(localctx, 86, self.RULE_indexedIdentifier)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 597
            self.match(qasm3Parser.Identifier)
            self.state = 601
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==qasm3Parser.LBRACKET:
                self.state = 598
                self.indexOperator()
                self.state = 603
                self._errHandler.sync(self)
                _la = self._input.LA(1)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ReturnSignatureContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def ARROW(self):
            return self.getToken(qasm3Parser.ARROW, 0)

        def scalarType(self):
            return self.getTypedRuleContext(qasm3Parser.ScalarTypeContext,0)


        def getRuleIndex(self):
            return qasm3Parser.RULE_returnSignature

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterReturnSignature" ):
                listener.enterReturnSignature(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitReturnSignature" ):
                listener.exitReturnSignature(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitReturnSignature" ):
                return visitor.visitReturnSignature(self)
            else:
                return visitor.visitChildren(self)




    def returnSignature(self):

        localctx = qasm3Parser.ReturnSignatureContext(self, self._ctx, self.state)
        self.enterRule(localctx, 88, self.RULE_returnSignature)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 604
            self.match(qasm3Parser.ARROW)
            self.state = 605
            self.scalarType()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class GateModifierContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def AT(self):
            return self.getToken(qasm3Parser.AT, 0)

        def INV(self):
            return self.getToken(qasm3Parser.INV, 0)

        def POW(self):
            return self.getToken(qasm3Parser.POW, 0)

        def LPAREN(self):
            return self.getToken(qasm3Parser.LPAREN, 0)

        def expression(self):
            return self.getTypedRuleContext(qasm3Parser.ExpressionContext,0)


        def RPAREN(self):
            return self.getToken(qasm3Parser.RPAREN, 0)

        def CTRL(self):
            return self.getToken(qasm3Parser.CTRL, 0)

        def NEGCTRL(self):
            return self.getToken(qasm3Parser.NEGCTRL, 0)

        def getRuleIndex(self):
            return qasm3Parser.RULE_gateModifier

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterGateModifier" ):
                listener.enterGateModifier(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitGateModifier" ):
                listener.exitGateModifier(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitGateModifier" ):
                return visitor.visitGateModifier(self)
            else:
                return visitor.visitChildren(self)




    def gateModifier(self):

        localctx = qasm3Parser.GateModifierContext(self, self._ctx, self.state)
        self.enterRule(localctx, 90, self.RULE_gateModifier)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 620
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [qasm3Parser.INV]:
                self.state = 607
                self.match(qasm3Parser.INV)
                pass
            elif token in [qasm3Parser.POW]:
                self.state = 608
                self.match(qasm3Parser.POW)
                self.state = 609
                self.match(qasm3Parser.LPAREN)
                self.state = 610
                self.expression(0)
                self.state = 611
                self.match(qasm3Parser.RPAREN)
                pass
            elif token in [qasm3Parser.CTRL, qasm3Parser.NEGCTRL]:
                self.state = 613
                _la = self._input.LA(1)
                if not(_la==qasm3Parser.CTRL or _la==qasm3Parser.NEGCTRL):
                    self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 618
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==qasm3Parser.LPAREN:
                    self.state = 614
                    self.match(qasm3Parser.LPAREN)
                    self.state = 615
                    self.expression(0)
                    self.state = 616
                    self.match(qasm3Parser.RPAREN)


                pass
            else:
                raise NoViableAltException(self)

            self.state = 622
            self.match(qasm3Parser.AT)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ScalarTypeContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def BIT(self):
            return self.getToken(qasm3Parser.BIT, 0)

        def designator(self):
            return self.getTypedRuleContext(qasm3Parser.DesignatorContext,0)


        def INT(self):
            return self.getToken(qasm3Parser.INT, 0)

        def UINT(self):
            return self.getToken(qasm3Parser.UINT, 0)

        def FLOAT(self):
            return self.getToken(qasm3Parser.FLOAT, 0)

        def ANGLE(self):
            return self.getToken(qasm3Parser.ANGLE, 0)

        def BOOL(self):
            return self.getToken(qasm3Parser.BOOL, 0)

        def DURATION(self):
            return self.getToken(qasm3Parser.DURATION, 0)

        def STRETCH(self):
            return self.getToken(qasm3Parser.STRETCH, 0)

        def COMPLEX(self):
            return self.getToken(qasm3Parser.COMPLEX, 0)

        def LBRACKET(self):
            return self.getToken(qasm3Parser.LBRACKET, 0)

        def scalarType(self):
            return self.getTypedRuleContext(qasm3Parser.ScalarTypeContext,0)


        def RBRACKET(self):
            return self.getToken(qasm3Parser.RBRACKET, 0)

        def getRuleIndex(self):
            return qasm3Parser.RULE_scalarType

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterScalarType" ):
                listener.enterScalarType(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitScalarType" ):
                listener.exitScalarType(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitScalarType" ):
                return visitor.visitScalarType(self)
            else:
                return visitor.visitChildren(self)




    def scalarType(self):

        localctx = qasm3Parser.ScalarTypeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 92, self.RULE_scalarType)
        self._la = 0 # Token type
        try:
            self.state = 654
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [qasm3Parser.BIT]:
                self.enterOuterAlt(localctx, 1)
                self.state = 624
                self.match(qasm3Parser.BIT)
                self.state = 626
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==qasm3Parser.LBRACKET:
                    self.state = 625
                    self.designator()


                pass
            elif token in [qasm3Parser.INT]:
                self.enterOuterAlt(localctx, 2)
                self.state = 628
                self.match(qasm3Parser.INT)
                self.state = 630
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==qasm3Parser.LBRACKET:
                    self.state = 629
                    self.designator()


                pass
            elif token in [qasm3Parser.UINT]:
                self.enterOuterAlt(localctx, 3)
                self.state = 632
                self.match(qasm3Parser.UINT)
                self.state = 634
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==qasm3Parser.LBRACKET:
                    self.state = 633
                    self.designator()


                pass
            elif token in [qasm3Parser.FLOAT]:
                self.enterOuterAlt(localctx, 4)
                self.state = 636
                self.match(qasm3Parser.FLOAT)
                self.state = 638
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==qasm3Parser.LBRACKET:
                    self.state = 637
                    self.designator()


                pass
            elif token in [qasm3Parser.ANGLE]:
                self.enterOuterAlt(localctx, 5)
                self.state = 640
                self.match(qasm3Parser.ANGLE)
                self.state = 642
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==qasm3Parser.LBRACKET:
                    self.state = 641
                    self.designator()


                pass
            elif token in [qasm3Parser.BOOL]:
                self.enterOuterAlt(localctx, 6)
                self.state = 644
                self.match(qasm3Parser.BOOL)
                pass
            elif token in [qasm3Parser.DURATION]:
                self.enterOuterAlt(localctx, 7)
                self.state = 645
                self.match(qasm3Parser.DURATION)
                pass
            elif token in [qasm3Parser.STRETCH]:
                self.enterOuterAlt(localctx, 8)
                self.state = 646
                self.match(qasm3Parser.STRETCH)
                pass
            elif token in [qasm3Parser.COMPLEX]:
                self.enterOuterAlt(localctx, 9)
                self.state = 647
                self.match(qasm3Parser.COMPLEX)
                self.state = 652
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==qasm3Parser.LBRACKET:
                    self.state = 648
                    self.match(qasm3Parser.LBRACKET)
                    self.state = 649
                    self.scalarType()
                    self.state = 650
                    self.match(qasm3Parser.RBRACKET)


                pass
            else:
                raise NoViableAltException(self)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class QubitTypeContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def QUBIT(self):
            return self.getToken(qasm3Parser.QUBIT, 0)

        def designator(self):
            return self.getTypedRuleContext(qasm3Parser.DesignatorContext,0)


        def getRuleIndex(self):
            return qasm3Parser.RULE_qubitType

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterQubitType" ):
                listener.enterQubitType(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitQubitType" ):
                listener.exitQubitType(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitQubitType" ):
                return visitor.visitQubitType(self)
            else:
                return visitor.visitChildren(self)




    def qubitType(self):

        localctx = qasm3Parser.QubitTypeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 94, self.RULE_qubitType)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 656
            self.match(qasm3Parser.QUBIT)
            self.state = 658
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.LBRACKET:
                self.state = 657
                self.designator()


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ArrayTypeContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def ARRAY(self):
            return self.getToken(qasm3Parser.ARRAY, 0)

        def LBRACKET(self):
            return self.getToken(qasm3Parser.LBRACKET, 0)

        def scalarType(self):
            return self.getTypedRuleContext(qasm3Parser.ScalarTypeContext,0)


        def COMMA(self):
            return self.getToken(qasm3Parser.COMMA, 0)

        def expressionList(self):
            return self.getTypedRuleContext(qasm3Parser.ExpressionListContext,0)


        def RBRACKET(self):
            return self.getToken(qasm3Parser.RBRACKET, 0)

        def getRuleIndex(self):
            return qasm3Parser.RULE_arrayType

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterArrayType" ):
                listener.enterArrayType(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitArrayType" ):
                listener.exitArrayType(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitArrayType" ):
                return visitor.visitArrayType(self)
            else:
                return visitor.visitChildren(self)




    def arrayType(self):

        localctx = qasm3Parser.ArrayTypeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 96, self.RULE_arrayType)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 660
            self.match(qasm3Parser.ARRAY)
            self.state = 661
            self.match(qasm3Parser.LBRACKET)
            self.state = 662
            self.scalarType()
            self.state = 663
            self.match(qasm3Parser.COMMA)
            self.state = 664
            self.expressionList()
            self.state = 665
            self.match(qasm3Parser.RBRACKET)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ArrayReferenceTypeContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def ARRAY(self):
            return self.getToken(qasm3Parser.ARRAY, 0)

        def LBRACKET(self):
            return self.getToken(qasm3Parser.LBRACKET, 0)

        def scalarType(self):
            return self.getTypedRuleContext(qasm3Parser.ScalarTypeContext,0)


        def COMMA(self):
            return self.getToken(qasm3Parser.COMMA, 0)

        def RBRACKET(self):
            return self.getToken(qasm3Parser.RBRACKET, 0)

        def READONLY(self):
            return self.getToken(qasm3Parser.READONLY, 0)

        def MUTABLE(self):
            return self.getToken(qasm3Parser.MUTABLE, 0)

        def expressionList(self):
            return self.getTypedRuleContext(qasm3Parser.ExpressionListContext,0)


        def DIM(self):
            return self.getToken(qasm3Parser.DIM, 0)

        def EQUALS(self):
            return self.getToken(qasm3Parser.EQUALS, 0)

        def expression(self):
            return self.getTypedRuleContext(qasm3Parser.ExpressionContext,0)


        def getRuleIndex(self):
            return qasm3Parser.RULE_arrayReferenceType

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterArrayReferenceType" ):
                listener.enterArrayReferenceType(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitArrayReferenceType" ):
                listener.exitArrayReferenceType(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitArrayReferenceType" ):
                return visitor.visitArrayReferenceType(self)
            else:
                return visitor.visitChildren(self)




    def arrayReferenceType(self):

        localctx = qasm3Parser.ArrayReferenceTypeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 98, self.RULE_arrayReferenceType)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 667
            _la = self._input.LA(1)
            if not(_la==qasm3Parser.READONLY or _la==qasm3Parser.MUTABLE):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
            self.state = 668
            self.match(qasm3Parser.ARRAY)
            self.state = 669
            self.match(qasm3Parser.LBRACKET)
            self.state = 670
            self.scalarType()
            self.state = 671
            self.match(qasm3Parser.COMMA)
            self.state = 676
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [qasm3Parser.BOOL, qasm3Parser.BIT, qasm3Parser.INT, qasm3Parser.UINT, qasm3Parser.FLOAT, qasm3Parser.ANGLE, qasm3Parser.COMPLEX, qasm3Parser.ARRAY, qasm3Parser.DURATION, qasm3Parser.STRETCH, qasm3Parser.DURATIONOF, qasm3Parser.BooleanLiteral, qasm3Parser.LPAREN, qasm3Parser.MINUS, qasm3Parser.TILDE, qasm3Parser.EXCLAMATION_POINT, qasm3Parser.ImaginaryLiteral, qasm3Parser.BinaryIntegerLiteral, qasm3Parser.OctalIntegerLiteral, qasm3Parser.DecimalIntegerLiteral, qasm3Parser.HexIntegerLiteral, qasm3Parser.Identifier, qasm3Parser.HardwareQubit, qasm3Parser.FloatLiteral, qasm3Parser.TimingLiteral, qasm3Parser.BitstringLiteral]:
                self.state = 672
                self.expressionList()
                pass
            elif token in [qasm3Parser.DIM]:
                self.state = 673
                self.match(qasm3Parser.DIM)
                self.state = 674
                self.match(qasm3Parser.EQUALS)
                self.state = 675
                self.expression(0)
                pass
            else:
                raise NoViableAltException(self)

            self.state = 678
            self.match(qasm3Parser.RBRACKET)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class DesignatorContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def LBRACKET(self):
            return self.getToken(qasm3Parser.LBRACKET, 0)

        def expression(self):
            return self.getTypedRuleContext(qasm3Parser.ExpressionContext,0)


        def RBRACKET(self):
            return self.getToken(qasm3Parser.RBRACKET, 0)

        def getRuleIndex(self):
            return qasm3Parser.RULE_designator

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterDesignator" ):
                listener.enterDesignator(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitDesignator" ):
                listener.exitDesignator(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitDesignator" ):
                return visitor.visitDesignator(self)
            else:
                return visitor.visitChildren(self)




    def designator(self):

        localctx = qasm3Parser.DesignatorContext(self, self._ctx, self.state)
        self.enterRule(localctx, 100, self.RULE_designator)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 680
            self.match(qasm3Parser.LBRACKET)
            self.state = 681
            self.expression(0)
            self.state = 682
            self.match(qasm3Parser.RBRACKET)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class DefcalTargetContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def MEASURE(self):
            return self.getToken(qasm3Parser.MEASURE, 0)

        def RESET(self):
            return self.getToken(qasm3Parser.RESET, 0)

        def DELAY(self):
            return self.getToken(qasm3Parser.DELAY, 0)

        def Identifier(self):
            return self.getToken(qasm3Parser.Identifier, 0)

        def getRuleIndex(self):
            return qasm3Parser.RULE_defcalTarget

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterDefcalTarget" ):
                listener.enterDefcalTarget(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitDefcalTarget" ):
                listener.exitDefcalTarget(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitDefcalTarget" ):
                return visitor.visitDefcalTarget(self)
            else:
                return visitor.visitChildren(self)




    def defcalTarget(self):

        localctx = qasm3Parser.DefcalTargetContext(self, self._ctx, self.state)
        self.enterRule(localctx, 102, self.RULE_defcalTarget)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 684
            _la = self._input.LA(1)
            if not(((((_la - 48)) & ~0x3f) == 0 and ((1 << (_la - 48)) & ((1 << (qasm3Parser.DELAY - 48)) | (1 << (qasm3Parser.RESET - 48)) | (1 << (qasm3Parser.MEASURE - 48)) | (1 << (qasm3Parser.Identifier - 48)))) != 0)):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class DefcalArgumentDefinitionContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def expression(self):
            return self.getTypedRuleContext(qasm3Parser.ExpressionContext,0)


        def argumentDefinition(self):
            return self.getTypedRuleContext(qasm3Parser.ArgumentDefinitionContext,0)


        def getRuleIndex(self):
            return qasm3Parser.RULE_defcalArgumentDefinition

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterDefcalArgumentDefinition" ):
                listener.enterDefcalArgumentDefinition(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitDefcalArgumentDefinition" ):
                listener.exitDefcalArgumentDefinition(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitDefcalArgumentDefinition" ):
                return visitor.visitDefcalArgumentDefinition(self)
            else:
                return visitor.visitChildren(self)




    def defcalArgumentDefinition(self):

        localctx = qasm3Parser.DefcalArgumentDefinitionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 104, self.RULE_defcalArgumentDefinition)
        try:
            self.state = 688
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,74,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 686
                self.expression(0)
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 687
                self.argumentDefinition()
                pass


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class DefcalOperandContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def HardwareQubit(self):
            return self.getToken(qasm3Parser.HardwareQubit, 0)

        def Identifier(self):
            return self.getToken(qasm3Parser.Identifier, 0)

        def getRuleIndex(self):
            return qasm3Parser.RULE_defcalOperand

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterDefcalOperand" ):
                listener.enterDefcalOperand(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitDefcalOperand" ):
                listener.exitDefcalOperand(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitDefcalOperand" ):
                return visitor.visitDefcalOperand(self)
            else:
                return visitor.visitChildren(self)




    def defcalOperand(self):

        localctx = qasm3Parser.DefcalOperandContext(self, self._ctx, self.state)
        self.enterRule(localctx, 106, self.RULE_defcalOperand)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 690
            _la = self._input.LA(1)
            if not(_la==qasm3Parser.Identifier or _la==qasm3Parser.HardwareQubit):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class GateOperandContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def indexedIdentifier(self):
            return self.getTypedRuleContext(qasm3Parser.IndexedIdentifierContext,0)


        def HardwareQubit(self):
            return self.getToken(qasm3Parser.HardwareQubit, 0)

        def getRuleIndex(self):
            return qasm3Parser.RULE_gateOperand

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterGateOperand" ):
                listener.enterGateOperand(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitGateOperand" ):
                listener.exitGateOperand(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitGateOperand" ):
                return visitor.visitGateOperand(self)
            else:
                return visitor.visitChildren(self)




    def gateOperand(self):

        localctx = qasm3Parser.GateOperandContext(self, self._ctx, self.state)
        self.enterRule(localctx, 108, self.RULE_gateOperand)
        try:
            self.state = 694
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [qasm3Parser.Identifier]:
                self.enterOuterAlt(localctx, 1)
                self.state = 692
                self.indexedIdentifier()
                pass
            elif token in [qasm3Parser.HardwareQubit]:
                self.enterOuterAlt(localctx, 2)
                self.state = 693
                self.match(qasm3Parser.HardwareQubit)
                pass
            else:
                raise NoViableAltException(self)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ExternArgumentContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def scalarType(self):
            return self.getTypedRuleContext(qasm3Parser.ScalarTypeContext,0)


        def arrayReferenceType(self):
            return self.getTypedRuleContext(qasm3Parser.ArrayReferenceTypeContext,0)


        def CREG(self):
            return self.getToken(qasm3Parser.CREG, 0)

        def designator(self):
            return self.getTypedRuleContext(qasm3Parser.DesignatorContext,0)


        def getRuleIndex(self):
            return qasm3Parser.RULE_externArgument

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterExternArgument" ):
                listener.enterExternArgument(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitExternArgument" ):
                listener.exitExternArgument(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitExternArgument" ):
                return visitor.visitExternArgument(self)
            else:
                return visitor.visitChildren(self)




    def externArgument(self):

        localctx = qasm3Parser.ExternArgumentContext(self, self._ctx, self.state)
        self.enterRule(localctx, 110, self.RULE_externArgument)
        self._la = 0 # Token type
        try:
            self.state = 702
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [qasm3Parser.BOOL, qasm3Parser.BIT, qasm3Parser.INT, qasm3Parser.UINT, qasm3Parser.FLOAT, qasm3Parser.ANGLE, qasm3Parser.COMPLEX, qasm3Parser.DURATION, qasm3Parser.STRETCH]:
                self.enterOuterAlt(localctx, 1)
                self.state = 696
                self.scalarType()
                pass
            elif token in [qasm3Parser.READONLY, qasm3Parser.MUTABLE]:
                self.enterOuterAlt(localctx, 2)
                self.state = 697
                self.arrayReferenceType()
                pass
            elif token in [qasm3Parser.CREG]:
                self.enterOuterAlt(localctx, 3)
                self.state = 698
                self.match(qasm3Parser.CREG)
                self.state = 700
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==qasm3Parser.LBRACKET:
                    self.state = 699
                    self.designator()


                pass
            else:
                raise NoViableAltException(self)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ArgumentDefinitionContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def scalarType(self):
            return self.getTypedRuleContext(qasm3Parser.ScalarTypeContext,0)


        def Identifier(self):
            return self.getToken(qasm3Parser.Identifier, 0)

        def qubitType(self):
            return self.getTypedRuleContext(qasm3Parser.QubitTypeContext,0)


        def CREG(self):
            return self.getToken(qasm3Parser.CREG, 0)

        def QREG(self):
            return self.getToken(qasm3Parser.QREG, 0)

        def designator(self):
            return self.getTypedRuleContext(qasm3Parser.DesignatorContext,0)


        def arrayReferenceType(self):
            return self.getTypedRuleContext(qasm3Parser.ArrayReferenceTypeContext,0)


        def getRuleIndex(self):
            return qasm3Parser.RULE_argumentDefinition

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterArgumentDefinition" ):
                listener.enterArgumentDefinition(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitArgumentDefinition" ):
                listener.exitArgumentDefinition(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitArgumentDefinition" ):
                return visitor.visitArgumentDefinition(self)
            else:
                return visitor.visitChildren(self)




    def argumentDefinition(self):

        localctx = qasm3Parser.ArgumentDefinitionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 112, self.RULE_argumentDefinition)
        self._la = 0 # Token type
        try:
            self.state = 718
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [qasm3Parser.BOOL, qasm3Parser.BIT, qasm3Parser.INT, qasm3Parser.UINT, qasm3Parser.FLOAT, qasm3Parser.ANGLE, qasm3Parser.COMPLEX, qasm3Parser.DURATION, qasm3Parser.STRETCH]:
                self.enterOuterAlt(localctx, 1)
                self.state = 704
                self.scalarType()
                self.state = 705
                self.match(qasm3Parser.Identifier)
                pass
            elif token in [qasm3Parser.QUBIT]:
                self.enterOuterAlt(localctx, 2)
                self.state = 707
                self.qubitType()
                self.state = 708
                self.match(qasm3Parser.Identifier)
                pass
            elif token in [qasm3Parser.QREG, qasm3Parser.CREG]:
                self.enterOuterAlt(localctx, 3)
                self.state = 710
                _la = self._input.LA(1)
                if not(_la==qasm3Parser.QREG or _la==qasm3Parser.CREG):
                    self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 711
                self.match(qasm3Parser.Identifier)
                self.state = 713
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==qasm3Parser.LBRACKET:
                    self.state = 712
                    self.designator()


                pass
            elif token in [qasm3Parser.READONLY, qasm3Parser.MUTABLE]:
                self.enterOuterAlt(localctx, 4)
                self.state = 715
                self.arrayReferenceType()
                self.state = 716
                self.match(qasm3Parser.Identifier)
                pass
            else:
                raise NoViableAltException(self)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ArgumentDefinitionListContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def argumentDefinition(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(qasm3Parser.ArgumentDefinitionContext)
            else:
                return self.getTypedRuleContext(qasm3Parser.ArgumentDefinitionContext,i)


        def COMMA(self, i:int=None):
            if i is None:
                return self.getTokens(qasm3Parser.COMMA)
            else:
                return self.getToken(qasm3Parser.COMMA, i)

        def getRuleIndex(self):
            return qasm3Parser.RULE_argumentDefinitionList

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterArgumentDefinitionList" ):
                listener.enterArgumentDefinitionList(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitArgumentDefinitionList" ):
                listener.exitArgumentDefinitionList(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitArgumentDefinitionList" ):
                return visitor.visitArgumentDefinitionList(self)
            else:
                return visitor.visitChildren(self)




    def argumentDefinitionList(self):

        localctx = qasm3Parser.ArgumentDefinitionListContext(self, self._ctx, self.state)
        self.enterRule(localctx, 114, self.RULE_argumentDefinitionList)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 720
            self.argumentDefinition()
            self.state = 725
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,80,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 721
                    self.match(qasm3Parser.COMMA)
                    self.state = 722
                    self.argumentDefinition() 
                self.state = 727
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,80,self._ctx)

            self.state = 729
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.COMMA:
                self.state = 728
                self.match(qasm3Parser.COMMA)


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class DefcalArgumentDefinitionListContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def defcalArgumentDefinition(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(qasm3Parser.DefcalArgumentDefinitionContext)
            else:
                return self.getTypedRuleContext(qasm3Parser.DefcalArgumentDefinitionContext,i)


        def COMMA(self, i:int=None):
            if i is None:
                return self.getTokens(qasm3Parser.COMMA)
            else:
                return self.getToken(qasm3Parser.COMMA, i)

        def getRuleIndex(self):
            return qasm3Parser.RULE_defcalArgumentDefinitionList

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterDefcalArgumentDefinitionList" ):
                listener.enterDefcalArgumentDefinitionList(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitDefcalArgumentDefinitionList" ):
                listener.exitDefcalArgumentDefinitionList(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitDefcalArgumentDefinitionList" ):
                return visitor.visitDefcalArgumentDefinitionList(self)
            else:
                return visitor.visitChildren(self)




    def defcalArgumentDefinitionList(self):

        localctx = qasm3Parser.DefcalArgumentDefinitionListContext(self, self._ctx, self.state)
        self.enterRule(localctx, 116, self.RULE_defcalArgumentDefinitionList)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 731
            self.defcalArgumentDefinition()
            self.state = 736
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,82,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 732
                    self.match(qasm3Parser.COMMA)
                    self.state = 733
                    self.defcalArgumentDefinition() 
                self.state = 738
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,82,self._ctx)

            self.state = 740
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.COMMA:
                self.state = 739
                self.match(qasm3Parser.COMMA)


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class DefcalOperandListContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def defcalOperand(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(qasm3Parser.DefcalOperandContext)
            else:
                return self.getTypedRuleContext(qasm3Parser.DefcalOperandContext,i)


        def COMMA(self, i:int=None):
            if i is None:
                return self.getTokens(qasm3Parser.COMMA)
            else:
                return self.getToken(qasm3Parser.COMMA, i)

        def getRuleIndex(self):
            return qasm3Parser.RULE_defcalOperandList

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterDefcalOperandList" ):
                listener.enterDefcalOperandList(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitDefcalOperandList" ):
                listener.exitDefcalOperandList(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitDefcalOperandList" ):
                return visitor.visitDefcalOperandList(self)
            else:
                return visitor.visitChildren(self)




    def defcalOperandList(self):

        localctx = qasm3Parser.DefcalOperandListContext(self, self._ctx, self.state)
        self.enterRule(localctx, 118, self.RULE_defcalOperandList)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 742
            self.defcalOperand()
            self.state = 747
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,84,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 743
                    self.match(qasm3Parser.COMMA)
                    self.state = 744
                    self.defcalOperand() 
                self.state = 749
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,84,self._ctx)

            self.state = 751
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.COMMA:
                self.state = 750
                self.match(qasm3Parser.COMMA)


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ExpressionListContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def expression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(qasm3Parser.ExpressionContext)
            else:
                return self.getTypedRuleContext(qasm3Parser.ExpressionContext,i)


        def COMMA(self, i:int=None):
            if i is None:
                return self.getTokens(qasm3Parser.COMMA)
            else:
                return self.getToken(qasm3Parser.COMMA, i)

        def getRuleIndex(self):
            return qasm3Parser.RULE_expressionList

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterExpressionList" ):
                listener.enterExpressionList(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitExpressionList" ):
                listener.exitExpressionList(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitExpressionList" ):
                return visitor.visitExpressionList(self)
            else:
                return visitor.visitChildren(self)




    def expressionList(self):

        localctx = qasm3Parser.ExpressionListContext(self, self._ctx, self.state)
        self.enterRule(localctx, 120, self.RULE_expressionList)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 753
            self.expression(0)
            self.state = 758
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,86,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 754
                    self.match(qasm3Parser.COMMA)
                    self.state = 755
                    self.expression(0) 
                self.state = 760
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,86,self._ctx)

            self.state = 762
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.COMMA:
                self.state = 761
                self.match(qasm3Parser.COMMA)


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class IdentifierListContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def Identifier(self, i:int=None):
            if i is None:
                return self.getTokens(qasm3Parser.Identifier)
            else:
                return self.getToken(qasm3Parser.Identifier, i)

        def COMMA(self, i:int=None):
            if i is None:
                return self.getTokens(qasm3Parser.COMMA)
            else:
                return self.getToken(qasm3Parser.COMMA, i)

        def getRuleIndex(self):
            return qasm3Parser.RULE_identifierList

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterIdentifierList" ):
                listener.enterIdentifierList(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitIdentifierList" ):
                listener.exitIdentifierList(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitIdentifierList" ):
                return visitor.visitIdentifierList(self)
            else:
                return visitor.visitChildren(self)




    def identifierList(self):

        localctx = qasm3Parser.IdentifierListContext(self, self._ctx, self.state)
        self.enterRule(localctx, 122, self.RULE_identifierList)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 764
            self.match(qasm3Parser.Identifier)
            self.state = 769
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,88,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 765
                    self.match(qasm3Parser.COMMA)
                    self.state = 766
                    self.match(qasm3Parser.Identifier) 
                self.state = 771
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,88,self._ctx)

            self.state = 773
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.COMMA:
                self.state = 772
                self.match(qasm3Parser.COMMA)


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class GateOperandListContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def gateOperand(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(qasm3Parser.GateOperandContext)
            else:
                return self.getTypedRuleContext(qasm3Parser.GateOperandContext,i)


        def COMMA(self, i:int=None):
            if i is None:
                return self.getTokens(qasm3Parser.COMMA)
            else:
                return self.getToken(qasm3Parser.COMMA, i)

        def getRuleIndex(self):
            return qasm3Parser.RULE_gateOperandList

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterGateOperandList" ):
                listener.enterGateOperandList(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitGateOperandList" ):
                listener.exitGateOperandList(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitGateOperandList" ):
                return visitor.visitGateOperandList(self)
            else:
                return visitor.visitChildren(self)




    def gateOperandList(self):

        localctx = qasm3Parser.GateOperandListContext(self, self._ctx, self.state)
        self.enterRule(localctx, 124, self.RULE_gateOperandList)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 775
            self.gateOperand()
            self.state = 780
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,90,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 776
                    self.match(qasm3Parser.COMMA)
                    self.state = 777
                    self.gateOperand() 
                self.state = 782
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,90,self._ctx)

            self.state = 784
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.COMMA:
                self.state = 783
                self.match(qasm3Parser.COMMA)


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ExternArgumentListContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def externArgument(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(qasm3Parser.ExternArgumentContext)
            else:
                return self.getTypedRuleContext(qasm3Parser.ExternArgumentContext,i)


        def COMMA(self, i:int=None):
            if i is None:
                return self.getTokens(qasm3Parser.COMMA)
            else:
                return self.getToken(qasm3Parser.COMMA, i)

        def getRuleIndex(self):
            return qasm3Parser.RULE_externArgumentList

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterExternArgumentList" ):
                listener.enterExternArgumentList(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitExternArgumentList" ):
                listener.exitExternArgumentList(self)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitExternArgumentList" ):
                return visitor.visitExternArgumentList(self)
            else:
                return visitor.visitChildren(self)




    def externArgumentList(self):

        localctx = qasm3Parser.ExternArgumentListContext(self, self._ctx, self.state)
        self.enterRule(localctx, 126, self.RULE_externArgumentList)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 786
            self.externArgument()
            self.state = 791
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,92,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 787
                    self.match(qasm3Parser.COMMA)
                    self.state = 788
                    self.externArgument() 
                self.state = 793
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,92,self._ctx)

            self.state = 795
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.COMMA:
                self.state = 794
                self.match(qasm3Parser.COMMA)


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx



    def sempred(self, localctx:RuleContext, ruleIndex:int, predIndex:int):
        if self._predicates == None:
            self._predicates = dict()
        self._predicates[35] = self.expression_sempred
        pred = self._predicates.get(ruleIndex, None)
        if pred is None:
            raise Exception("No predicate with index:" + str(ruleIndex))
        else:
            return pred(localctx, predIndex)

    def expression_sempred(self, localctx:ExpressionContext, predIndex:int):
            if predIndex == 0:
                return self.precpred(self._ctx, 16)
         

            if predIndex == 1:
                return self.precpred(self._ctx, 14)
         

            if predIndex == 2:
                return self.precpred(self._ctx, 13)
         

            if predIndex == 3:
                return self.precpred(self._ctx, 12)
         

            if predIndex == 4:
                return self.precpred(self._ctx, 11)
         

            if predIndex == 5:
                return self.precpred(self._ctx, 10)
         

            if predIndex == 6:
                return self.precpred(self._ctx, 9)
         

            if predIndex == 7:
                return self.precpred(self._ctx, 8)
         

            if predIndex == 8:
                return self.precpred(self._ctx, 7)
         

            if predIndex == 9:
                return self.precpred(self._ctx, 6)
         

            if predIndex == 10:
                return self.precpred(self._ctx, 5)
         

            if predIndex == 11:
                return self.precpred(self._ctx, 17)
         




