# Generated from qasm3Parser.g4 by ANTLR 4.8
# encoding: utf-8
from antlr4 import *
from io import StringIO
import sys
if sys.version_info[1] > 5:
	from typing import TextIO
else:
	from typing.io import TextIO


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

    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_defcalStatement = 33
    RULE_expression = 34
    RULE_aliasExpression = 35
    RULE_declarationExpression = 36
    RULE_measureExpression = 37
    RULE_rangeExpression = 38
    RULE_setExpression = 39
    RULE_arrayLiteral = 40
    RULE_indexOperator = 41
    RULE_indexedIdentifier = 42
    RULE_returnSignature = 43
    RULE_gateModifier = 44
    RULE_scalarType = 45
    RULE_qubitType = 46
    RULE_arrayType = 47
    RULE_arrayReferenceType = 48
    RULE_designator = 49
    RULE_gateOperand = 50
    RULE_externArgument = 51
    RULE_defcalArgument = 52
    RULE_argumentDefinition = 53
    RULE_argumentDefinitionList = 54
    RULE_expressionList = 55
    RULE_defcalArgumentList = 56
    RULE_identifierList = 57
    RULE_gateOperandList = 58
    RULE_externArgumentList = 59

    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", "defcalStatement", "expression", 
                   "aliasExpression", "declarationExpression", "measureExpression", 
                   "rangeExpression", "setExpression", "arrayLiteral", "indexOperator", 
                   "indexedIdentifier", "returnSignature", "gateModifier", 
                   "scalarType", "qubitType", "arrayType", "arrayReferenceType", 
                   "designator", "gateOperand", "externArgument", "defcalArgument", 
                   "argumentDefinition", "argumentDefinitionList", "expressionList", 
                   "defcalArgumentList", "identifierList", "gateOperandList", 
                   "externArgumentList" ]

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

    def __init__(self, input:TokenStream, output:TextIO = sys.stdout):
        super().__init__(input, output)
        self.checkVersion("4.8")
        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 = 121
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.OPENQASM:
                self.state = 120
                self.version()


            self.state = 126
            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.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 - 64)) & ~0x3f) == 0 and ((1 << (_la - 64)) & ((1 << (qasm3Parser.MINUS - 64)) | (1 << (qasm3Parser.TILDE - 64)) | (1 << (qasm3Parser.EXCLAMATION_POINT - 64)) | (1 << (qasm3Parser.ImaginaryLiteral - 64)) | (1 << (qasm3Parser.BinaryIntegerLiteral - 64)) | (1 << (qasm3Parser.OctalIntegerLiteral - 64)) | (1 << (qasm3Parser.DecimalIntegerLiteral - 64)) | (1 << (qasm3Parser.HexIntegerLiteral - 64)) | (1 << (qasm3Parser.Identifier - 64)) | (1 << (qasm3Parser.HardwareQubit - 64)) | (1 << (qasm3Parser.FloatLiteral - 64)) | (1 << (qasm3Parser.TimingLiteral - 64)) | (1 << (qasm3Parser.BitstringLiteral - 64)))) != 0):
                self.state = 123
                self.statement()
                self.state = 128
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 129
            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 = 131
            self.match(qasm3Parser.OPENQASM)
            self.state = 132
            self.match(qasm3Parser.VersionSpecifier)
            self.state = 133
            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 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 = 171
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [qasm3Parser.PRAGMA]:
                self.enterOuterAlt(localctx, 1)
                self.state = 135
                self.pragma()
                pass
            elif token in [qasm3Parser.INCLUDE, qasm3Parser.DEFCALGRAMMAR, qasm3Parser.DEF, 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 = 139
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==qasm3Parser.AnnotationKeyword:
                    self.state = 136
                    self.annotation()
                    self.state = 141
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

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

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

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

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

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

                elif la_ == 6:
                    self.state = 147
                    self.calibrationGrammarStatement()
                    pass

                elif la_ == 7:
                    self.state = 148
                    self.classicalDeclarationStatement()
                    pass

                elif la_ == 8:
                    self.state = 149
                    self.constDeclarationStatement()
                    pass

                elif la_ == 9:
                    self.state = 150
                    self.continueStatement()
                    pass

                elif la_ == 10:
                    self.state = 151
                    self.defStatement()
                    pass

                elif la_ == 11:
                    self.state = 152
                    self.defcalStatement()
                    pass

                elif la_ == 12:
                    self.state = 153
                    self.delayStatement()
                    pass

                elif la_ == 13:
                    self.state = 154
                    self.endStatement()
                    pass

                elif la_ == 14:
                    self.state = 155
                    self.expressionStatement()
                    pass

                elif la_ == 15:
                    self.state = 156
                    self.externStatement()
                    pass

                elif la_ == 16:
                    self.state = 157
                    self.forStatement()
                    pass

                elif la_ == 17:
                    self.state = 158
                    self.gateCallStatement()
                    pass

                elif la_ == 18:
                    self.state = 159
                    self.gateStatement()
                    pass

                elif la_ == 19:
                    self.state = 160
                    self.ifStatement()
                    pass

                elif la_ == 20:
                    self.state = 161
                    self.includeStatement()
                    pass

                elif la_ == 21:
                    self.state = 162
                    self.ioDeclarationStatement()
                    pass

                elif la_ == 22:
                    self.state = 163
                    self.measureArrowAssignmentStatement()
                    pass

                elif la_ == 23:
                    self.state = 164
                    self.oldStyleDeclarationStatement()
                    pass

                elif la_ == 24:
                    self.state = 165
                    self.quantumDeclarationStatement()
                    pass

                elif la_ == 25:
                    self.state = 166
                    self.resetStatement()
                    pass

                elif la_ == 26:
                    self.state = 167
                    self.returnStatement()
                    pass

                elif la_ == 27:
                    self.state = 168
                    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 = 173
            self.match(qasm3Parser.AnnotationKeyword)
            self.state = 175
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.RemainingLineContent:
                self.state = 174
                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 = 177
            self.match(qasm3Parser.LBRACE)
            self.state = 181
            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.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 - 64)) & ~0x3f) == 0 and ((1 << (_la - 64)) & ((1 << (qasm3Parser.MINUS - 64)) | (1 << (qasm3Parser.TILDE - 64)) | (1 << (qasm3Parser.EXCLAMATION_POINT - 64)) | (1 << (qasm3Parser.ImaginaryLiteral - 64)) | (1 << (qasm3Parser.BinaryIntegerLiteral - 64)) | (1 << (qasm3Parser.OctalIntegerLiteral - 64)) | (1 << (qasm3Parser.DecimalIntegerLiteral - 64)) | (1 << (qasm3Parser.HexIntegerLiteral - 64)) | (1 << (qasm3Parser.Identifier - 64)) | (1 << (qasm3Parser.HardwareQubit - 64)) | (1 << (qasm3Parser.FloatLiteral - 64)) | (1 << (qasm3Parser.TimingLiteral - 64)) | (1 << (qasm3Parser.BitstringLiteral - 64)))) != 0):
                self.state = 178
                self.statement()
                self.state = 183
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 184
            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 = 186
            self.match(qasm3Parser.PRAGMA)
            self.state = 187
            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 = 191
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [qasm3Parser.INCLUDE, qasm3Parser.DEFCALGRAMMAR, qasm3Parser.DEF, 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 = 189
                self.statement()
                pass
            elif token in [qasm3Parser.LBRACE]:
                self.enterOuterAlt(localctx, 2)
                self.state = 190
                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 = 193
            self.match(qasm3Parser.DEFCALGRAMMAR)
            self.state = 194
            self.match(qasm3Parser.StringLiteral)
            self.state = 195
            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 = 197
            self.match(qasm3Parser.INCLUDE)
            self.state = 198
            self.match(qasm3Parser.StringLiteral)
            self.state = 199
            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 = 201
            self.match(qasm3Parser.BREAK)
            self.state = 202
            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 = 204
            self.match(qasm3Parser.CONTINUE)
            self.state = 205
            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 = 207
            self.match(qasm3Parser.END)
            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 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, i:int=None):
            if i is None:
                return self.getTokens(qasm3Parser.Identifier)
            else:
                return self.getToken(qasm3Parser.Identifier, i)

        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 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 = 210
            self.match(qasm3Parser.FOR)
            self.state = 211
            self.scalarType()
            self.state = 212
            self.match(qasm3Parser.Identifier)
            self.state = 213
            self.match(qasm3Parser.IN)
            self.state = 220
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [qasm3Parser.LBRACE]:
                self.state = 214
                self.setExpression()
                pass
            elif token in [qasm3Parser.LBRACKET]:
                self.state = 215
                self.match(qasm3Parser.LBRACKET)
                self.state = 216
                self.rangeExpression()
                self.state = 217
                self.match(qasm3Parser.RBRACKET)
                pass
            elif token in [qasm3Parser.Identifier]:
                self.state = 219
                self.match(qasm3Parser.Identifier)
                pass
            else:
                raise NoViableAltException(self)

            self.state = 222
            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 = 224
            self.match(qasm3Parser.IF)
            self.state = 225
            self.match(qasm3Parser.LPAREN)
            self.state = 226
            self.expression(0)
            self.state = 227
            self.match(qasm3Parser.RPAREN)
            self.state = 228
            localctx.if_body = self.statementOrScope()
            self.state = 231
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,9,self._ctx)
            if la_ == 1:
                self.state = 229
                self.match(qasm3Parser.ELSE)
                self.state = 230
                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 = 233
            self.match(qasm3Parser.RETURN)
            self.state = 236
            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 = 234
                self.expression(0)
                pass
            elif token in [qasm3Parser.MEASURE]:
                self.state = 235
                self.measureExpression()
                pass
            elif token in [qasm3Parser.SEMICOLON]:
                pass
            else:
                pass
            self.state = 238
            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 = 240
            self.match(qasm3Parser.WHILE)
            self.state = 241
            self.match(qasm3Parser.LPAREN)
            self.state = 242
            self.expression(0)
            self.state = 243
            self.match(qasm3Parser.RPAREN)
            self.state = 244
            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 = 246
            self.match(qasm3Parser.BARRIER)
            self.state = 248
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.Identifier or _la==qasm3Parser.HardwareQubit:
                self.state = 247
                self.gateOperandList()


            self.state = 250
            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 = 252
            self.match(qasm3Parser.BOX)
            self.state = 254
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.LBRACKET:
                self.state = 253
                self.designator()


            self.state = 256
            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 = 258
            self.match(qasm3Parser.DELAY)
            self.state = 259
            self.designator()
            self.state = 261
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.Identifier or _la==qasm3Parser.HardwareQubit:
                self.state = 260
                self.gateOperandList()


            self.state = 263
            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 = 306
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,23,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 268
                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 = 265
                    self.gateModifier()
                    self.state = 270
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

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


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


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


                self.state = 282
                self.gateOperandList()
                self.state = 283
                self.match(qasm3Parser.SEMICOLON)
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 288
                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 = 285
                    self.gateModifier()
                    self.state = 290
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

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


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


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


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


                self.state = 305
                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 = 308
            self.measureExpression()
            self.state = 311
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.ARROW:
                self.state = 309
                self.match(qasm3Parser.ARROW)
                self.state = 310
                self.indexedIdentifier()


            self.state = 313
            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 = 315
            self.match(qasm3Parser.RESET)
            self.state = 316
            self.gateOperand()
            self.state = 317
            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 = 319
            self.match(qasm3Parser.LET)
            self.state = 320
            self.match(qasm3Parser.Identifier)
            self.state = 321
            self.match(qasm3Parser.EQUALS)
            self.state = 322
            self.aliasExpression()
            self.state = 323
            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 = 327
            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 = 325
                self.scalarType()
                pass
            elif token in [qasm3Parser.ARRAY]:
                self.state = 326
                self.arrayType()
                pass
            else:
                raise NoViableAltException(self)

            self.state = 329
            self.match(qasm3Parser.Identifier)
            self.state = 332
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.EQUALS:
                self.state = 330
                self.match(qasm3Parser.EQUALS)
                self.state = 331
                self.declarationExpression()


            self.state = 334
            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 = 336
            self.match(qasm3Parser.CONST)
            self.state = 337
            self.scalarType()
            self.state = 338
            self.match(qasm3Parser.Identifier)
            self.state = 339
            self.match(qasm3Parser.EQUALS)
            self.state = 340
            self.declarationExpression()
            self.state = 341
            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 = 343
            _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 = 346
            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 = 344
                self.scalarType()
                pass
            elif token in [qasm3Parser.ARRAY]:
                self.state = 345
                self.arrayType()
                pass
            else:
                raise NoViableAltException(self)

            self.state = 348
            self.match(qasm3Parser.Identifier)
            self.state = 349
            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 = 351
            _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 = 352
            self.match(qasm3Parser.Identifier)
            self.state = 354
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.LBRACKET:
                self.state = 353
                self.designator()


            self.state = 356
            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 = 358
            self.qubitType()
            self.state = 359
            self.match(qasm3Parser.Identifier)
            self.state = 360
            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 = 362
            self.match(qasm3Parser.DEF)
            self.state = 363
            self.match(qasm3Parser.Identifier)
            self.state = 364
            self.match(qasm3Parser.LPAREN)
            self.state = 366
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << qasm3Parser.CONST) | (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 = 365
                self.argumentDefinitionList()


            self.state = 368
            self.match(qasm3Parser.RPAREN)
            self.state = 370
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.ARROW:
                self.state = 369
                self.returnSignature()


            self.state = 372
            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 = 374
            self.match(qasm3Parser.EXTERN)
            self.state = 375
            self.match(qasm3Parser.Identifier)
            self.state = 376
            self.match(qasm3Parser.LPAREN)
            self.state = 378
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << qasm3Parser.CONST) | (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 = 377
                self.externArgumentList()


            self.state = 380
            self.match(qasm3Parser.RPAREN)
            self.state = 382
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.ARROW:
                self.state = 381
                self.returnSignature()


            self.state = 384
            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 = 386
            self.match(qasm3Parser.GATE)
            self.state = 387
            self.match(qasm3Parser.Identifier)
            self.state = 393
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.LPAREN:
                self.state = 388
                self.match(qasm3Parser.LPAREN)
                self.state = 390
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==qasm3Parser.Identifier:
                    self.state = 389
                    localctx.params = self.identifierList()


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


            self.state = 395
            localctx.qubits = self.identifierList()
            self.state = 396
            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 = 398
            self.indexedIdentifier()
            self.state = 399
            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 = 402
            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 = 400
                self.expression(0)
                pass
            elif token in [qasm3Parser.MEASURE]:
                self.state = 401
                self.measureExpression()
                pass
            else:
                raise NoViableAltException(self)

            self.state = 404
            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 = 406
            self.expression(0)
            self.state = 407
            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 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 Identifier(self):
            return self.getToken(qasm3Parser.Identifier, 0)

        def defcalArgumentList(self):
            return self.getTypedRuleContext(qasm3Parser.DefcalArgumentListContext,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 argumentDefinitionList(self):
            return self.getTypedRuleContext(qasm3Parser.ArgumentDefinitionListContext,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, 66, self.RULE_defcalStatement)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 409
            self.match(qasm3Parser.DEFCAL)
            self.state = 410
            self.match(qasm3Parser.Identifier)
            self.state = 416
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.LPAREN:
                self.state = 411
                self.match(qasm3Parser.LPAREN)
                self.state = 413
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << qasm3Parser.CONST) | (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 = 412
                    self.argumentDefinitionList()


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


            self.state = 418
            self.defcalArgumentList()
            self.state = 420
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.ARROW:
                self.state = 419
                self.returnSignature()


            self.state = 422
            self.match(qasm3Parser.LBRACE)
            self.state = 426
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,39,self._ctx)
            while _alt!=1 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1+1:
                    self.state = 423
                    self.matchWildcard() 
                self.state = 428
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,39,self._ctx)

            self.state = 429
            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 = 68
        self.enterRecursionRule(localctx, 68, self.RULE_expression, _p)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 458
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,42,self._ctx)
            if la_ == 1:
                localctx = qasm3Parser.ParenthesisExpressionContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx

                self.state = 432
                self.match(qasm3Parser.LPAREN)
                self.state = 433
                self.expression(0)
                self.state = 434
                self.match(qasm3Parser.RPAREN)
                pass

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

            elif la_ == 3:
                localctx = qasm3Parser.CastExpressionContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 440
                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 = 438
                    self.scalarType()
                    pass
                elif token in [qasm3Parser.ARRAY]:
                    self.state = 439
                    self.arrayType()
                    pass
                else:
                    raise NoViableAltException(self)

                self.state = 442
                self.match(qasm3Parser.LPAREN)
                self.state = 443
                self.expression(0)
                self.state = 444
                self.match(qasm3Parser.RPAREN)
                pass

            elif la_ == 4:
                localctx = qasm3Parser.DurationofExpressionContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 446
                self.match(qasm3Parser.DURATIONOF)
                self.state = 447
                self.match(qasm3Parser.LPAREN)
                self.state = 448
                self.scope()
                self.state = 449
                self.match(qasm3Parser.RPAREN)
                pass

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


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

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


            self._ctx.stop = self._input.LT(-1)
            self.state = 497
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,44,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 = 495
                    self._errHandler.sync(self)
                    la_ = self._interp.adaptivePredict(self._input,43,self._ctx)
                    if la_ == 1:
                        localctx = qasm3Parser.PowerExpressionContext(self, qasm3Parser.ExpressionContext(self, _parentctx, _parentState))
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expression)
                        self.state = 460
                        if not self.precpred(self._ctx, 16):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 16)")
                        self.state = 461
                        localctx.op = self.match(qasm3Parser.DOUBLE_ASTERISK)
                        self.state = 462
                        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 = 463
                        if not self.precpred(self._ctx, 14):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 14)")
                        self.state = 464
                        localctx.op = self._input.LT(1)
                        _la = self._input.LA(1)
                        if not(((((_la - 65)) & ~0x3f) == 0 and ((1 << (_la - 65)) & ((1 << (qasm3Parser.ASTERISK - 65)) | (1 << (qasm3Parser.SLASH - 65)) | (1 << (qasm3Parser.PERCENT - 65)))) != 0)):
                            localctx.op = self._errHandler.recoverInline(self)
                        else:
                            self._errHandler.reportMatch(self)
                            self.consume()
                        self.state = 465
                        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 = 466
                        if not self.precpred(self._ctx, 13):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 13)")
                        self.state = 467
                        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 = 468
                        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 = 469
                        if not self.precpred(self._ctx, 12):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 12)")
                        self.state = 470
                        localctx.op = self.match(qasm3Parser.BitshiftOperator)
                        self.state = 471
                        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 = 472
                        if not self.precpred(self._ctx, 11):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 11)")
                        self.state = 473
                        localctx.op = self.match(qasm3Parser.ComparisonOperator)
                        self.state = 474
                        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 = 475
                        if not self.precpred(self._ctx, 10):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 10)")
                        self.state = 476
                        localctx.op = self.match(qasm3Parser.EqualityOperator)
                        self.state = 477
                        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 = 478
                        if not self.precpred(self._ctx, 9):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 9)")
                        self.state = 479
                        localctx.op = self.match(qasm3Parser.AMPERSAND)
                        self.state = 480
                        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 = 481
                        if not self.precpred(self._ctx, 8):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 8)")
                        self.state = 482
                        localctx.op = self.match(qasm3Parser.CARET)
                        self.state = 483
                        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 = 484
                        if not self.precpred(self._ctx, 7):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 7)")
                        self.state = 485
                        localctx.op = self.match(qasm3Parser.PIPE)
                        self.state = 486
                        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 = 487
                        if not self.precpred(self._ctx, 6):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 6)")
                        self.state = 488
                        localctx.op = self.match(qasm3Parser.DOUBLE_AMPERSAND)
                        self.state = 489
                        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 = 490
                        if not self.precpred(self._ctx, 5):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 5)")
                        self.state = 491
                        localctx.op = self.match(qasm3Parser.DOUBLE_PIPE)
                        self.state = 492
                        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 = 493
                        if not self.precpred(self._ctx, 17):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 17)")
                        self.state = 494
                        self.indexOperator()
                        pass

             
                self.state = 499
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,44,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, 70, self.RULE_aliasExpression)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 500
            self.expression(0)
            self.state = 505
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==qasm3Parser.DOUBLE_PLUS:
                self.state = 501
                self.match(qasm3Parser.DOUBLE_PLUS)
                self.state = 502
                self.expression(0)
                self.state = 507
                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, 72, self.RULE_declarationExpression)
        try:
            self.state = 511
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [qasm3Parser.LBRACE]:
                self.enterOuterAlt(localctx, 1)
                self.state = 508
                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 = 509
                self.expression(0)
                pass
            elif token in [qasm3Parser.MEASURE]:
                self.enterOuterAlt(localctx, 3)
                self.state = 510
                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, 74, self.RULE_measureExpression)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 513
            self.match(qasm3Parser.MEASURE)
            self.state = 514
            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, 76, self.RULE_rangeExpression)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 517
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if ((((_la - 28)) & ~0x3f) == 0 and ((1 << (_la - 28)) & ((1 << (qasm3Parser.BOOL - 28)) | (1 << (qasm3Parser.BIT - 28)) | (1 << (qasm3Parser.INT - 28)) | (1 << (qasm3Parser.UINT - 28)) | (1 << (qasm3Parser.FLOAT - 28)) | (1 << (qasm3Parser.ANGLE - 28)) | (1 << (qasm3Parser.COMPLEX - 28)) | (1 << (qasm3Parser.ARRAY - 28)) | (1 << (qasm3Parser.DURATION - 28)) | (1 << (qasm3Parser.STRETCH - 28)) | (1 << (qasm3Parser.DURATIONOF - 28)) | (1 << (qasm3Parser.BooleanLiteral - 28)) | (1 << (qasm3Parser.LPAREN - 28)) | (1 << (qasm3Parser.MINUS - 28)) | (1 << (qasm3Parser.TILDE - 28)) | (1 << (qasm3Parser.EXCLAMATION_POINT - 28)) | (1 << (qasm3Parser.ImaginaryLiteral - 28)) | (1 << (qasm3Parser.BinaryIntegerLiteral - 28)) | (1 << (qasm3Parser.OctalIntegerLiteral - 28)) | (1 << (qasm3Parser.DecimalIntegerLiteral - 28)) | (1 << (qasm3Parser.HexIntegerLiteral - 28)) | (1 << (qasm3Parser.Identifier - 28)) | (1 << (qasm3Parser.HardwareQubit - 28)) | (1 << (qasm3Parser.FloatLiteral - 28)) | (1 << (qasm3Parser.TimingLiteral - 28)) | (1 << (qasm3Parser.BitstringLiteral - 28)))) != 0):
                self.state = 516
                self.expression(0)


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


            self.state = 525
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.COLON:
                self.state = 523
                self.match(qasm3Parser.COLON)
                self.state = 524
                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, 78, self.RULE_setExpression)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 527
            self.match(qasm3Parser.LBRACE)
            self.state = 528
            self.expression(0)
            self.state = 533
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,50,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 529
                    self.match(qasm3Parser.COMMA)
                    self.state = 530
                    self.expression(0) 
                self.state = 535
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,50,self._ctx)

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


            self.state = 539
            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, 80, self.RULE_arrayLiteral)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 541
            self.match(qasm3Parser.LBRACE)
            self.state = 544
            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 = 542
                self.expression(0)
                pass
            elif token in [qasm3Parser.LBRACE]:
                self.state = 543
                self.arrayLiteral()
                pass
            else:
                raise NoViableAltException(self)

            self.state = 553
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,54,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 546
                    self.match(qasm3Parser.COMMA)
                    self.state = 549
                    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 = 547
                        self.expression(0)
                        pass
                    elif token in [qasm3Parser.LBRACE]:
                        self.state = 548
                        self.arrayLiteral()
                        pass
                    else:
                        raise NoViableAltException(self)
             
                self.state = 555
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,54,self._ctx)

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


            self.state = 559
            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, 82, self.RULE_indexOperator)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 561
            self.match(qasm3Parser.LBRACKET)
            self.state = 580
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [qasm3Parser.LBRACE]:
                self.state = 562
                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 = 565
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,56,self._ctx)
                if la_ == 1:
                    self.state = 563
                    self.expression(0)
                    pass

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


                self.state = 574
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,58,self._ctx)
                while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                    if _alt==1:
                        self.state = 567
                        self.match(qasm3Parser.COMMA)
                        self.state = 570
                        self._errHandler.sync(self)
                        la_ = self._interp.adaptivePredict(self._input,57,self._ctx)
                        if la_ == 1:
                            self.state = 568
                            self.expression(0)
                            pass

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

                 
                    self.state = 576
                    self._errHandler.sync(self)
                    _alt = self._interp.adaptivePredict(self._input,58,self._ctx)

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


                pass
            else:
                raise NoViableAltException(self)

            self.state = 582
            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, 84, self.RULE_indexedIdentifier)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 584
            self.match(qasm3Parser.Identifier)
            self.state = 588
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==qasm3Parser.LBRACKET:
                self.state = 585
                self.indexOperator()
                self.state = 590
                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, 86, self.RULE_returnSignature)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 591
            self.match(qasm3Parser.ARROW)
            self.state = 592
            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, 88, self.RULE_gateModifier)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 607
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [qasm3Parser.INV]:
                self.state = 594
                self.match(qasm3Parser.INV)
                pass
            elif token in [qasm3Parser.POW]:
                self.state = 595
                self.match(qasm3Parser.POW)
                self.state = 596
                self.match(qasm3Parser.LPAREN)
                self.state = 597
                self.expression(0)
                self.state = 598
                self.match(qasm3Parser.RPAREN)
                pass
            elif token in [qasm3Parser.CTRL, qasm3Parser.NEGCTRL]:
                self.state = 600
                _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 = 605
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==qasm3Parser.LPAREN:
                    self.state = 601
                    self.match(qasm3Parser.LPAREN)
                    self.state = 602
                    self.expression(0)
                    self.state = 603
                    self.match(qasm3Parser.RPAREN)


                pass
            else:
                raise NoViableAltException(self)

            self.state = 609
            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, 90, self.RULE_scalarType)
        self._la = 0 # Token type
        try:
            self.state = 641
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [qasm3Parser.BIT]:
                self.enterOuterAlt(localctx, 1)
                self.state = 611
                self.match(qasm3Parser.BIT)
                self.state = 613
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==qasm3Parser.LBRACKET:
                    self.state = 612
                    self.designator()


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


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


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


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


                pass
            elif token in [qasm3Parser.BOOL]:
                self.enterOuterAlt(localctx, 6)
                self.state = 631
                self.match(qasm3Parser.BOOL)
                pass
            elif token in [qasm3Parser.DURATION]:
                self.enterOuterAlt(localctx, 7)
                self.state = 632
                self.match(qasm3Parser.DURATION)
                pass
            elif token in [qasm3Parser.STRETCH]:
                self.enterOuterAlt(localctx, 8)
                self.state = 633
                self.match(qasm3Parser.STRETCH)
                pass
            elif token in [qasm3Parser.COMPLEX]:
                self.enterOuterAlt(localctx, 9)
                self.state = 634
                self.match(qasm3Parser.COMPLEX)
                self.state = 639
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==qasm3Parser.LBRACKET:
                    self.state = 635
                    self.match(qasm3Parser.LBRACKET)
                    self.state = 636
                    self.scalarType()
                    self.state = 637
                    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, 92, self.RULE_qubitType)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 643
            self.match(qasm3Parser.QUBIT)
            self.state = 645
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.LBRACKET:
                self.state = 644
                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, 94, self.RULE_arrayType)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 647
            self.match(qasm3Parser.ARRAY)
            self.state = 648
            self.match(qasm3Parser.LBRACKET)
            self.state = 649
            self.scalarType()
            self.state = 650
            self.match(qasm3Parser.COMMA)
            self.state = 651
            self.expressionList()
            self.state = 652
            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 CONST(self):
            return self.getToken(qasm3Parser.CONST, 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, 96, self.RULE_arrayReferenceType)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 654
            _la = self._input.LA(1)
            if not(_la==qasm3Parser.CONST or _la==qasm3Parser.MUTABLE):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
            self.state = 655
            self.match(qasm3Parser.ARRAY)
            self.state = 656
            self.match(qasm3Parser.LBRACKET)
            self.state = 657
            self.scalarType()
            self.state = 658
            self.match(qasm3Parser.COMMA)
            self.state = 663
            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 = 659
                self.expressionList()
                pass
            elif token in [qasm3Parser.DIM]:
                self.state = 660
                self.match(qasm3Parser.DIM)
                self.state = 661
                self.match(qasm3Parser.EQUALS)
                self.state = 662
                self.expression(0)
                pass
            else:
                raise NoViableAltException(self)

            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 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, 98, self.RULE_designator)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 667
            self.match(qasm3Parser.LBRACKET)
            self.state = 668
            self.expression(0)
            self.state = 669
            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 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, 100, self.RULE_gateOperand)
        try:
            self.state = 673
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [qasm3Parser.Identifier]:
                self.enterOuterAlt(localctx, 1)
                self.state = 671
                self.indexedIdentifier()
                pass
            elif token in [qasm3Parser.HardwareQubit]:
                self.enterOuterAlt(localctx, 2)
                self.state = 672
                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, 102, self.RULE_externArgument)
        self._la = 0 # Token type
        try:
            self.state = 681
            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 = 675
                self.scalarType()
                pass
            elif token in [qasm3Parser.CONST, qasm3Parser.MUTABLE]:
                self.enterOuterAlt(localctx, 2)
                self.state = 676
                self.arrayReferenceType()
                pass
            elif token in [qasm3Parser.CREG]:
                self.enterOuterAlt(localctx, 3)
                self.state = 677
                self.match(qasm3Parser.CREG)
                self.state = 679
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==qasm3Parser.LBRACKET:
                    self.state = 678
                    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 DefcalArgumentContext(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_defcalArgument

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

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

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




    def defcalArgument(self):

        localctx = qasm3Parser.DefcalArgumentContext(self, self._ctx, self.state)
        self.enterRule(localctx, 104, self.RULE_defcalArgument)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 683
            _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 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, 106, self.RULE_argumentDefinition)
        self._la = 0 # Token type
        try:
            self.state = 699
            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 = 685
                self.scalarType()
                self.state = 686
                self.match(qasm3Parser.Identifier)
                pass
            elif token in [qasm3Parser.QUBIT]:
                self.enterOuterAlt(localctx, 2)
                self.state = 688
                self.qubitType()
                self.state = 689
                self.match(qasm3Parser.Identifier)
                pass
            elif token in [qasm3Parser.QREG, qasm3Parser.CREG]:
                self.enterOuterAlt(localctx, 3)
                self.state = 691
                _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 = 692
                self.match(qasm3Parser.Identifier)
                self.state = 694
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==qasm3Parser.LBRACKET:
                    self.state = 693
                    self.designator()


                pass
            elif token in [qasm3Parser.CONST, qasm3Parser.MUTABLE]:
                self.enterOuterAlt(localctx, 4)
                self.state = 696
                self.arrayReferenceType()
                self.state = 697
                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, 108, self.RULE_argumentDefinitionList)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 701
            self.argumentDefinition()
            self.state = 706
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,78,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 702
                    self.match(qasm3Parser.COMMA)
                    self.state = 703
                    self.argumentDefinition() 
                self.state = 708
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,78,self._ctx)

            self.state = 710
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.COMMA:
                self.state = 709
                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, 110, self.RULE_expressionList)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 712
            self.expression(0)
            self.state = 717
            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 = 713
                    self.match(qasm3Parser.COMMA)
                    self.state = 714
                    self.expression(0) 
                self.state = 719
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,80,self._ctx)

            self.state = 721
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.COMMA:
                self.state = 720
                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 DefcalArgumentListContext(ParserRuleContext):

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

        def defcalArgument(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(qasm3Parser.DefcalArgumentContext)
            else:
                return self.getTypedRuleContext(qasm3Parser.DefcalArgumentContext,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_defcalArgumentList

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

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

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




    def defcalArgumentList(self):

        localctx = qasm3Parser.DefcalArgumentListContext(self, self._ctx, self.state)
        self.enterRule(localctx, 112, self.RULE_defcalArgumentList)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 723
            self.defcalArgument()
            self.state = 728
            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 = 724
                    self.match(qasm3Parser.COMMA)
                    self.state = 725
                    self.defcalArgument() 
                self.state = 730
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,82,self._ctx)

            self.state = 732
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.COMMA:
                self.state = 731
                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, 114, self.RULE_identifierList)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 734
            self.match(qasm3Parser.Identifier)
            self.state = 739
            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 = 735
                    self.match(qasm3Parser.COMMA)
                    self.state = 736
                    self.match(qasm3Parser.Identifier) 
                self.state = 741
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,84,self._ctx)

            self.state = 743
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.COMMA:
                self.state = 742
                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, 116, self.RULE_gateOperandList)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 745
            self.gateOperand()
            self.state = 750
            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 = 746
                    self.match(qasm3Parser.COMMA)
                    self.state = 747
                    self.gateOperand() 
                self.state = 752
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,86,self._ctx)

            self.state = 754
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.COMMA:
                self.state = 753
                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, 118, self.RULE_externArgumentList)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 756
            self.externArgument()
            self.state = 761
            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 = 757
                    self.match(qasm3Parser.COMMA)
                    self.state = 758
                    self.externArgument() 
                self.state = 763
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,88,self._ctx)

            self.state = 765
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.COMMA:
                self.state = 764
                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[34] = 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)
         




