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


class qasm3Parser ( Parser ):

    grammarFileName = "qasm3Parser.g4"

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

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

    sharedContextCache = PredictionContextCache()

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

    symbolicNames = [ "<INVALID>", "OPENQASM", "INCLUDE", "DEFCALGRAMMAR", 
                      "DEF", "CAL", "DEFCAL", "GATE", "EXTERN", "BOX", "LET", 
                      "BREAK", "CONTINUE", "IF", "ELSE", "END", "RETURN", 
                      "FOR", "WHILE", "IN", "SWITCH", "CASE", "DEFAULT", 
                      "PRAGMA", "AnnotationKeyword", "INPUT", "OUTPUT", 
                      "CONST", "READONLY", "MUTABLE", "QREG", "QUBIT", "CREG", 
                      "BOOL", "BIT", "INT", "UINT", "FLOAT", "ANGLE", "COMPLEX", 
                      "ARRAY", "VOID", "DURATION", "STRETCH", "GPHASE", 
                      "INV", "POW", "CTRL", "NEGCTRL", "DIM", "DURATIONOF", 
                      "DELAY", "RESET", "MEASURE", "BARRIER", "BooleanLiteral", 
                      "LBRACKET", "RBRACKET", "LBRACE", "RBRACE", "LPAREN", 
                      "RPAREN", "COLON", "SEMICOLON", "DOT", "COMMA", "EQUALS", 
                      "ARROW", "PLUS", "DOUBLE_PLUS", "MINUS", "ASTERISK", 
                      "DOUBLE_ASTERISK", "SLASH", "PERCENT", "PIPE", "DOUBLE_PIPE", 
                      "AMPERSAND", "DOUBLE_AMPERSAND", "CARET", "AT", "TILDE", 
                      "EXCLAMATION_POINT", "EqualityOperator", "CompoundAssignmentOperator", 
                      "ComparisonOperator", "BitshiftOperator", "IMAG", 
                      "ImaginaryLiteral", "BinaryIntegerLiteral", "OctalIntegerLiteral", 
                      "DecimalIntegerLiteral", "HexIntegerLiteral", "Identifier", 
                      "HardwareQubit", "FloatLiteral", "TimingLiteral", 
                      "BitstringLiteral", "Whitespace", "Newline", "LineComment", 
                      "BlockComment", "VERSION_IDENTIFER_WHITESPACE", "VersionSpecifier", 
                      "ARBITRARY_STRING_WHITESPACE", "StringLiteral", "EAT_INITIAL_SPACE", 
                      "EAT_LINE_END", "RemainingLineContent", "CAL_PRELUDE_WHITESPACE", 
                      "CAL_PRELUDE_COMMENT", "DEFCAL_PRELUDE_WHITESPACE", 
                      "DEFCAL_PRELUDE_COMMENT", "CalibrationBlock" ]

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

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

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

    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 statementOrScope(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(qasm3Parser.StatementOrScopeContext)
            else:
                return self.getTypedRuleContext(qasm3Parser.StatementOrScopeContext,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 = 133
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.OPENQASM:
                self.state = 132
                self.version()


            self.state = 138
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << qasm3Parser.INCLUDE) | (1 << qasm3Parser.DEFCALGRAMMAR) | (1 << qasm3Parser.DEF) | (1 << qasm3Parser.CAL) | (1 << qasm3Parser.DEFCAL) | (1 << qasm3Parser.GATE) | (1 << qasm3Parser.EXTERN) | (1 << qasm3Parser.BOX) | (1 << qasm3Parser.LET) | (1 << qasm3Parser.BREAK) | (1 << qasm3Parser.CONTINUE) | (1 << qasm3Parser.IF) | (1 << qasm3Parser.END) | (1 << qasm3Parser.RETURN) | (1 << qasm3Parser.FOR) | (1 << qasm3Parser.WHILE) | (1 << qasm3Parser.SWITCH) | (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.LBRACE) | (1 << qasm3Parser.LPAREN))) != 0) or ((((_la - 70)) & ~0x3f) == 0 and ((1 << (_la - 70)) & ((1 << (qasm3Parser.MINUS - 70)) | (1 << (qasm3Parser.TILDE - 70)) | (1 << (qasm3Parser.EXCLAMATION_POINT - 70)) | (1 << (qasm3Parser.ImaginaryLiteral - 70)) | (1 << (qasm3Parser.BinaryIntegerLiteral - 70)) | (1 << (qasm3Parser.OctalIntegerLiteral - 70)) | (1 << (qasm3Parser.DecimalIntegerLiteral - 70)) | (1 << (qasm3Parser.HexIntegerLiteral - 70)) | (1 << (qasm3Parser.Identifier - 70)) | (1 << (qasm3Parser.HardwareQubit - 70)) | (1 << (qasm3Parser.FloatLiteral - 70)) | (1 << (qasm3Parser.TimingLiteral - 70)) | (1 << (qasm3Parser.BitstringLiteral - 70)))) != 0):
                self.state = 135
                self.statementOrScope()
                self.state = 140
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 141
            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 = 143
            self.match(qasm3Parser.OPENQASM)
            self.state = 144
            self.match(qasm3Parser.VersionSpecifier)
            self.state = 145
            self.match(qasm3Parser.SEMICOLON)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class StatementContext(ParserRuleContext):

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

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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


        def switchStatement(self):
            return self.getTypedRuleContext(qasm3Parser.SwitchStatementContext,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 = 185
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [qasm3Parser.PRAGMA]:
                self.enterOuterAlt(localctx, 1)
                self.state = 147
                self.pragma()
                pass
            elif token in [qasm3Parser.INCLUDE, qasm3Parser.DEFCALGRAMMAR, qasm3Parser.DEF, qasm3Parser.CAL, qasm3Parser.DEFCAL, qasm3Parser.GATE, qasm3Parser.EXTERN, qasm3Parser.BOX, qasm3Parser.LET, qasm3Parser.BREAK, qasm3Parser.CONTINUE, qasm3Parser.IF, qasm3Parser.END, qasm3Parser.RETURN, qasm3Parser.FOR, qasm3Parser.WHILE, qasm3Parser.SWITCH, 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 = 151
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==qasm3Parser.AnnotationKeyword:
                    self.state = 148
                    self.annotation()
                    self.state = 153
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                elif la_ == 28:
                    self.state = 181
                    self.switchStatement()
                    pass

                elif la_ == 29:
                    self.state = 182
                    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 = 187
            self.match(qasm3Parser.AnnotationKeyword)
            self.state = 189
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.RemainingLineContent:
                self.state = 188
                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 statementOrScope(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(qasm3Parser.StatementOrScopeContext)
            else:
                return self.getTypedRuleContext(qasm3Parser.StatementOrScopeContext,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 = 191
            self.match(qasm3Parser.LBRACE)
            self.state = 195
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << qasm3Parser.INCLUDE) | (1 << qasm3Parser.DEFCALGRAMMAR) | (1 << qasm3Parser.DEF) | (1 << qasm3Parser.CAL) | (1 << qasm3Parser.DEFCAL) | (1 << qasm3Parser.GATE) | (1 << qasm3Parser.EXTERN) | (1 << qasm3Parser.BOX) | (1 << qasm3Parser.LET) | (1 << qasm3Parser.BREAK) | (1 << qasm3Parser.CONTINUE) | (1 << qasm3Parser.IF) | (1 << qasm3Parser.END) | (1 << qasm3Parser.RETURN) | (1 << qasm3Parser.FOR) | (1 << qasm3Parser.WHILE) | (1 << qasm3Parser.SWITCH) | (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.LBRACE) | (1 << qasm3Parser.LPAREN))) != 0) or ((((_la - 70)) & ~0x3f) == 0 and ((1 << (_la - 70)) & ((1 << (qasm3Parser.MINUS - 70)) | (1 << (qasm3Parser.TILDE - 70)) | (1 << (qasm3Parser.EXCLAMATION_POINT - 70)) | (1 << (qasm3Parser.ImaginaryLiteral - 70)) | (1 << (qasm3Parser.BinaryIntegerLiteral - 70)) | (1 << (qasm3Parser.OctalIntegerLiteral - 70)) | (1 << (qasm3Parser.DecimalIntegerLiteral - 70)) | (1 << (qasm3Parser.HexIntegerLiteral - 70)) | (1 << (qasm3Parser.Identifier - 70)) | (1 << (qasm3Parser.HardwareQubit - 70)) | (1 << (qasm3Parser.FloatLiteral - 70)) | (1 << (qasm3Parser.TimingLiteral - 70)) | (1 << (qasm3Parser.BitstringLiteral - 70)))) != 0):
                self.state = 192
                self.statementOrScope()
                self.state = 197
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 198
            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 = 200
            self.match(qasm3Parser.PRAGMA)
            self.state = 201
            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 = 205
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [qasm3Parser.INCLUDE, qasm3Parser.DEFCALGRAMMAR, qasm3Parser.DEF, qasm3Parser.CAL, qasm3Parser.DEFCAL, qasm3Parser.GATE, qasm3Parser.EXTERN, qasm3Parser.BOX, qasm3Parser.LET, qasm3Parser.BREAK, qasm3Parser.CONTINUE, qasm3Parser.IF, qasm3Parser.END, qasm3Parser.RETURN, qasm3Parser.FOR, qasm3Parser.WHILE, qasm3Parser.SWITCH, 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 = 203
                self.statement()
                pass
            elif token in [qasm3Parser.LBRACE]:
                self.enterOuterAlt(localctx, 2)
                self.state = 204
                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 = 207
            self.match(qasm3Parser.DEFCALGRAMMAR)
            self.state = 208
            self.match(qasm3Parser.StringLiteral)
            self.state = 209
            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 = 211
            self.match(qasm3Parser.INCLUDE)
            self.state = 212
            self.match(qasm3Parser.StringLiteral)
            self.state = 213
            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 = 215
            self.match(qasm3Parser.BREAK)
            self.state = 216
            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 = 218
            self.match(qasm3Parser.CONTINUE)
            self.state = 219
            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 = 221
            self.match(qasm3Parser.END)
            self.state = 222
            self.match(qasm3Parser.SEMICOLON)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ForStatementContext(ParserRuleContext):

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

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

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


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

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

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


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


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

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


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

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


        def getRuleIndex(self):
            return qasm3Parser.RULE_forStatement

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

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

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




    def forStatement(self):

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

            self.state = 236
            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 = 238
            self.match(qasm3Parser.IF)
            self.state = 239
            self.match(qasm3Parser.LPAREN)
            self.state = 240
            self.expression(0)
            self.state = 241
            self.match(qasm3Parser.RPAREN)
            self.state = 242
            localctx.if_body = self.statementOrScope()
            self.state = 245
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,9,self._ctx)
            if la_ == 1:
                self.state = 243
                self.match(qasm3Parser.ELSE)
                self.state = 244
                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 = 247
            self.match(qasm3Parser.RETURN)
            self.state = 250
            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 = 248
                self.expression(0)
                pass
            elif token in [qasm3Parser.MEASURE]:
                self.state = 249
                self.measureExpression()
                pass
            elif token in [qasm3Parser.SEMICOLON]:
                pass
            else:
                pass
            self.state = 252
            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 = 254
            self.match(qasm3Parser.WHILE)
            self.state = 255
            self.match(qasm3Parser.LPAREN)
            self.state = 256
            self.expression(0)
            self.state = 257
            self.match(qasm3Parser.RPAREN)
            self.state = 258
            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 SwitchStatementContext(ParserRuleContext):

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

        def SWITCH(self):
            return self.getToken(qasm3Parser.SWITCH, 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 LBRACE(self):
            return self.getToken(qasm3Parser.LBRACE, 0)

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

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


        def getRuleIndex(self):
            return qasm3Parser.RULE_switchStatement

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

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

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




    def switchStatement(self):

        localctx = qasm3Parser.SwitchStatementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 32, self.RULE_switchStatement)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 260
            self.match(qasm3Parser.SWITCH)
            self.state = 261
            self.match(qasm3Parser.LPAREN)
            self.state = 262
            self.expression(0)
            self.state = 263
            self.match(qasm3Parser.RPAREN)
            self.state = 264
            self.match(qasm3Parser.LBRACE)
            self.state = 268
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==qasm3Parser.CASE or _la==qasm3Parser.DEFAULT:
                self.state = 265
                self.switchCaseItem()
                self.state = 270
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 271
            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 SwitchCaseItemContext(ParserRuleContext):

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

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

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


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


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

        def getRuleIndex(self):
            return qasm3Parser.RULE_switchCaseItem

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

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

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




    def switchCaseItem(self):

        localctx = qasm3Parser.SwitchCaseItemContext(self, self._ctx, self.state)
        self.enterRule(localctx, 34, self.RULE_switchCaseItem)
        try:
            self.state = 279
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [qasm3Parser.CASE]:
                self.enterOuterAlt(localctx, 1)
                self.state = 273
                self.match(qasm3Parser.CASE)
                self.state = 274
                self.expressionList()
                self.state = 275
                self.scope()
                pass
            elif token in [qasm3Parser.DEFAULT]:
                self.enterOuterAlt(localctx, 2)
                self.state = 277
                self.match(qasm3Parser.DEFAULT)
                self.state = 278
                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 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, 36, self.RULE_barrierStatement)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 281
            self.match(qasm3Parser.BARRIER)
            self.state = 283
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.Identifier or _la==qasm3Parser.HardwareQubit:
                self.state = 282
                self.gateOperandList()


            self.state = 285
            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, 38, self.RULE_boxStatement)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 287
            self.match(qasm3Parser.BOX)
            self.state = 289
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.LBRACKET:
                self.state = 288
                self.designator()


            self.state = 291
            self.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, 40, self.RULE_delayStatement)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 293
            self.match(qasm3Parser.DELAY)
            self.state = 294
            self.designator()
            self.state = 296
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.Identifier or _la==qasm3Parser.HardwareQubit:
                self.state = 295
                self.gateOperandList()


            self.state = 298
            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, 42, self.RULE_gateCallStatement)
        self._la = 0 # Token type
        try:
            self.state = 341
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,25,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 303
                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 = 300
                    self.gateModifier()
                    self.state = 305
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

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


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


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


                self.state = 317
                self.gateOperandList()
                self.state = 318
                self.match(qasm3Parser.SEMICOLON)
                pass

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

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


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


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


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


                self.state = 340
                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, 44, self.RULE_measureArrowAssignmentStatement)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 343
            self.measureExpression()
            self.state = 346
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.ARROW:
                self.state = 344
                self.match(qasm3Parser.ARROW)
                self.state = 345
                self.indexedIdentifier()


            self.state = 348
            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, 46, self.RULE_resetStatement)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 350
            self.match(qasm3Parser.RESET)
            self.state = 351
            self.gateOperand()
            self.state = 352
            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, 48, self.RULE_aliasDeclarationStatement)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 354
            self.match(qasm3Parser.LET)
            self.state = 355
            self.match(qasm3Parser.Identifier)
            self.state = 356
            self.match(qasm3Parser.EQUALS)
            self.state = 357
            self.aliasExpression()
            self.state = 358
            self.match(qasm3Parser.SEMICOLON)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class 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, 50, self.RULE_classicalDeclarationStatement)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 362
            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 = 360
                self.scalarType()
                pass
            elif token in [qasm3Parser.ARRAY]:
                self.state = 361
                self.arrayType()
                pass
            else:
                raise NoViableAltException(self)

            self.state = 364
            self.match(qasm3Parser.Identifier)
            self.state = 367
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.EQUALS:
                self.state = 365
                self.match(qasm3Parser.EQUALS)
                self.state = 366
                self.declarationExpression()


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


    class 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, 52, self.RULE_constDeclarationStatement)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 371
            self.match(qasm3Parser.CONST)
            self.state = 372
            self.scalarType()
            self.state = 373
            self.match(qasm3Parser.Identifier)
            self.state = 374
            self.match(qasm3Parser.EQUALS)
            self.state = 375
            self.declarationExpression()
            self.state = 376
            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, 54, self.RULE_ioDeclarationStatement)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 378
            _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 = 381
            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 = 379
                self.scalarType()
                pass
            elif token in [qasm3Parser.ARRAY]:
                self.state = 380
                self.arrayType()
                pass
            else:
                raise NoViableAltException(self)

            self.state = 383
            self.match(qasm3Parser.Identifier)
            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 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, 56, self.RULE_oldStyleDeclarationStatement)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 386
            _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 = 387
            self.match(qasm3Parser.Identifier)
            self.state = 389
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.LBRACKET:
                self.state = 388
                self.designator()


            self.state = 391
            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, 58, self.RULE_quantumDeclarationStatement)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 393
            self.qubitType()
            self.state = 394
            self.match(qasm3Parser.Identifier)
            self.state = 395
            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, 60, self.RULE_defStatement)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 397
            self.match(qasm3Parser.DEF)
            self.state = 398
            self.match(qasm3Parser.Identifier)
            self.state = 399
            self.match(qasm3Parser.LPAREN)
            self.state = 401
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << qasm3Parser.READONLY) | (1 << qasm3Parser.MUTABLE) | (1 << qasm3Parser.QREG) | (1 << qasm3Parser.QUBIT) | (1 << qasm3Parser.CREG) | (1 << qasm3Parser.BOOL) | (1 << qasm3Parser.BIT) | (1 << qasm3Parser.INT) | (1 << qasm3Parser.UINT) | (1 << qasm3Parser.FLOAT) | (1 << qasm3Parser.ANGLE) | (1 << qasm3Parser.COMPLEX) | (1 << qasm3Parser.DURATION) | (1 << qasm3Parser.STRETCH))) != 0):
                self.state = 400
                self.argumentDefinitionList()


            self.state = 403
            self.match(qasm3Parser.RPAREN)
            self.state = 405
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.ARROW:
                self.state = 404
                self.returnSignature()


            self.state = 407
            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, 62, self.RULE_externStatement)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 409
            self.match(qasm3Parser.EXTERN)
            self.state = 410
            self.match(qasm3Parser.Identifier)
            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.READONLY) | (1 << qasm3Parser.MUTABLE) | (1 << qasm3Parser.CREG) | (1 << qasm3Parser.BOOL) | (1 << qasm3Parser.BIT) | (1 << qasm3Parser.INT) | (1 << qasm3Parser.UINT) | (1 << qasm3Parser.FLOAT) | (1 << qasm3Parser.ANGLE) | (1 << qasm3Parser.COMPLEX) | (1 << qasm3Parser.DURATION) | (1 << qasm3Parser.STRETCH))) != 0):
                self.state = 412
                self.externArgumentList()


            self.state = 415
            self.match(qasm3Parser.RPAREN)
            self.state = 417
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.ARROW:
                self.state = 416
                self.returnSignature()


            self.state = 419
            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, 64, self.RULE_gateStatement)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 421
            self.match(qasm3Parser.GATE)
            self.state = 422
            self.match(qasm3Parser.Identifier)
            self.state = 428
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.LPAREN:
                self.state = 423
                self.match(qasm3Parser.LPAREN)
                self.state = 425
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==qasm3Parser.Identifier:
                    self.state = 424
                    localctx.params = self.identifierList()


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


            self.state = 430
            localctx.qubits = self.identifierList()
            self.state = 431
            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, 66, self.RULE_assignmentStatement)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 433
            self.indexedIdentifier()
            self.state = 434
            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 = 437
            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 = 435
                self.expression(0)
                pass
            elif token in [qasm3Parser.MEASURE]:
                self.state = 436
                self.measureExpression()
                pass
            else:
                raise NoViableAltException(self)

            self.state = 439
            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, 68, self.RULE_expressionStatement)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 441
            self.expression(0)
            self.state = 442
            self.match(qasm3Parser.SEMICOLON)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class CalStatementContext(ParserRuleContext):

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

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

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

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

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

        def getRuleIndex(self):
            return qasm3Parser.RULE_calStatement

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

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

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




    def calStatement(self):

        localctx = qasm3Parser.CalStatementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 70, self.RULE_calStatement)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 444
            self.match(qasm3Parser.CAL)
            self.state = 445
            self.match(qasm3Parser.LBRACE)
            self.state = 447
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.CalibrationBlock:
                self.state = 446
                self.match(qasm3Parser.CalibrationBlock)


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


    class DefcalStatementContext(ParserRuleContext):

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

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

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


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


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

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

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

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

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


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

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


        def getRuleIndex(self):
            return qasm3Parser.RULE_defcalStatement

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

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

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




    def defcalStatement(self):

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


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


            self.state = 460
            self.defcalOperandList()
            self.state = 462
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.ARROW:
                self.state = 461
                self.returnSignature()


            self.state = 464
            self.match(qasm3Parser.LBRACE)
            self.state = 466
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.CalibrationBlock:
                self.state = 465
                self.match(qasm3Parser.CalibrationBlock)


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

                self.state = 471
                self.match(qasm3Parser.LPAREN)
                self.state = 472
                self.expression(0)
                self.state = 473
                self.match(qasm3Parser.RPAREN)
                pass

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

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

                self.state = 481
                self.match(qasm3Parser.LPAREN)
                self.state = 482
                self.expression(0)
                self.state = 483
                self.match(qasm3Parser.RPAREN)
                pass

            elif la_ == 4:
                localctx = qasm3Parser.DurationofExpressionContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 485
                self.match(qasm3Parser.DURATIONOF)
                self.state = 486
                self.match(qasm3Parser.LPAREN)
                self.state = 487
                self.scope()
                self.state = 488
                self.match(qasm3Parser.RPAREN)
                pass

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


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

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


            self._ctx.stop = self._input.LT(-1)
            self.state = 536
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,47,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 = 534
                    self._errHandler.sync(self)
                    la_ = self._interp.adaptivePredict(self._input,46,self._ctx)
                    if la_ == 1:
                        localctx = qasm3Parser.PowerExpressionContext(self, qasm3Parser.ExpressionContext(self, _parentctx, _parentState))
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expression)
                        self.state = 499
                        if not self.precpred(self._ctx, 16):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 16)")
                        self.state = 500
                        localctx.op = self.match(qasm3Parser.DOUBLE_ASTERISK)
                        self.state = 501
                        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 = 502
                        if not self.precpred(self._ctx, 14):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 14)")
                        self.state = 503
                        localctx.op = self._input.LT(1)
                        _la = self._input.LA(1)
                        if not(((((_la - 71)) & ~0x3f) == 0 and ((1 << (_la - 71)) & ((1 << (qasm3Parser.ASTERISK - 71)) | (1 << (qasm3Parser.SLASH - 71)) | (1 << (qasm3Parser.PERCENT - 71)))) != 0)):
                            localctx.op = self._errHandler.recoverInline(self)
                        else:
                            self._errHandler.reportMatch(self)
                            self.consume()
                        self.state = 504
                        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 = 505
                        if not self.precpred(self._ctx, 13):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 13)")
                        self.state = 506
                        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 = 507
                        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 = 508
                        if not self.precpred(self._ctx, 12):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 12)")
                        self.state = 509
                        localctx.op = self.match(qasm3Parser.BitshiftOperator)
                        self.state = 510
                        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 = 511
                        if not self.precpred(self._ctx, 11):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 11)")
                        self.state = 512
                        localctx.op = self.match(qasm3Parser.ComparisonOperator)
                        self.state = 513
                        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 = 514
                        if not self.precpred(self._ctx, 10):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 10)")
                        self.state = 515
                        localctx.op = self.match(qasm3Parser.EqualityOperator)
                        self.state = 516
                        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 = 517
                        if not self.precpred(self._ctx, 9):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 9)")
                        self.state = 518
                        localctx.op = self.match(qasm3Parser.AMPERSAND)
                        self.state = 519
                        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 = 520
                        if not self.precpred(self._ctx, 8):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 8)")
                        self.state = 521
                        localctx.op = self.match(qasm3Parser.CARET)
                        self.state = 522
                        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 = 523
                        if not self.precpred(self._ctx, 7):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 7)")
                        self.state = 524
                        localctx.op = self.match(qasm3Parser.PIPE)
                        self.state = 525
                        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 = 526
                        if not self.precpred(self._ctx, 6):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 6)")
                        self.state = 527
                        localctx.op = self.match(qasm3Parser.DOUBLE_AMPERSAND)
                        self.state = 528
                        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 = 529
                        if not self.precpred(self._ctx, 5):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 5)")
                        self.state = 530
                        localctx.op = self.match(qasm3Parser.DOUBLE_PIPE)
                        self.state = 531
                        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 = 532
                        if not self.precpred(self._ctx, 17):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 17)")
                        self.state = 533
                        self.indexOperator()
                        pass

             
                self.state = 538
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,47,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, 76, self.RULE_aliasExpression)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 539
            self.expression(0)
            self.state = 544
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==qasm3Parser.DOUBLE_PLUS:
                self.state = 540
                self.match(qasm3Parser.DOUBLE_PLUS)
                self.state = 541
                self.expression(0)
                self.state = 546
                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, 78, self.RULE_declarationExpression)
        try:
            self.state = 550
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [qasm3Parser.LBRACE]:
                self.enterOuterAlt(localctx, 1)
                self.state = 547
                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 = 548
                self.expression(0)
                pass
            elif token in [qasm3Parser.MEASURE]:
                self.enterOuterAlt(localctx, 3)
                self.state = 549
                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, 80, self.RULE_measureExpression)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 552
            self.match(qasm3Parser.MEASURE)
            self.state = 553
            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, 82, self.RULE_rangeExpression)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 556
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << qasm3Parser.BOOL) | (1 << qasm3Parser.BIT) | (1 << qasm3Parser.INT) | (1 << qasm3Parser.UINT) | (1 << qasm3Parser.FLOAT) | (1 << qasm3Parser.ANGLE) | (1 << qasm3Parser.COMPLEX) | (1 << qasm3Parser.ARRAY) | (1 << qasm3Parser.DURATION) | (1 << qasm3Parser.STRETCH) | (1 << qasm3Parser.DURATIONOF) | (1 << qasm3Parser.BooleanLiteral) | (1 << qasm3Parser.LPAREN))) != 0) or ((((_la - 70)) & ~0x3f) == 0 and ((1 << (_la - 70)) & ((1 << (qasm3Parser.MINUS - 70)) | (1 << (qasm3Parser.TILDE - 70)) | (1 << (qasm3Parser.EXCLAMATION_POINT - 70)) | (1 << (qasm3Parser.ImaginaryLiteral - 70)) | (1 << (qasm3Parser.BinaryIntegerLiteral - 70)) | (1 << (qasm3Parser.OctalIntegerLiteral - 70)) | (1 << (qasm3Parser.DecimalIntegerLiteral - 70)) | (1 << (qasm3Parser.HexIntegerLiteral - 70)) | (1 << (qasm3Parser.Identifier - 70)) | (1 << (qasm3Parser.HardwareQubit - 70)) | (1 << (qasm3Parser.FloatLiteral - 70)) | (1 << (qasm3Parser.TimingLiteral - 70)) | (1 << (qasm3Parser.BitstringLiteral - 70)))) != 0):
                self.state = 555
                self.expression(0)


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


            self.state = 564
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.COLON:
                self.state = 562
                self.match(qasm3Parser.COLON)
                self.state = 563
                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, 84, self.RULE_setExpression)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 566
            self.match(qasm3Parser.LBRACE)
            self.state = 567
            self.expression(0)
            self.state = 572
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,53,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 568
                    self.match(qasm3Parser.COMMA)
                    self.state = 569
                    self.expression(0) 
                self.state = 574
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,53,self._ctx)

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


            self.state = 578
            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, 86, self.RULE_arrayLiteral)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 580
            self.match(qasm3Parser.LBRACE)
            self.state = 598
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << qasm3Parser.BOOL) | (1 << qasm3Parser.BIT) | (1 << qasm3Parser.INT) | (1 << qasm3Parser.UINT) | (1 << qasm3Parser.FLOAT) | (1 << qasm3Parser.ANGLE) | (1 << qasm3Parser.COMPLEX) | (1 << qasm3Parser.ARRAY) | (1 << qasm3Parser.DURATION) | (1 << qasm3Parser.STRETCH) | (1 << qasm3Parser.DURATIONOF) | (1 << qasm3Parser.BooleanLiteral) | (1 << qasm3Parser.LBRACE) | (1 << qasm3Parser.LPAREN))) != 0) or ((((_la - 70)) & ~0x3f) == 0 and ((1 << (_la - 70)) & ((1 << (qasm3Parser.MINUS - 70)) | (1 << (qasm3Parser.TILDE - 70)) | (1 << (qasm3Parser.EXCLAMATION_POINT - 70)) | (1 << (qasm3Parser.ImaginaryLiteral - 70)) | (1 << (qasm3Parser.BinaryIntegerLiteral - 70)) | (1 << (qasm3Parser.OctalIntegerLiteral - 70)) | (1 << (qasm3Parser.DecimalIntegerLiteral - 70)) | (1 << (qasm3Parser.HexIntegerLiteral - 70)) | (1 << (qasm3Parser.Identifier - 70)) | (1 << (qasm3Parser.HardwareQubit - 70)) | (1 << (qasm3Parser.FloatLiteral - 70)) | (1 << (qasm3Parser.TimingLiteral - 70)) | (1 << (qasm3Parser.BitstringLiteral - 70)))) != 0):
                self.state = 583
                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 = 581
                    self.expression(0)
                    pass
                elif token in [qasm3Parser.LBRACE]:
                    self.state = 582
                    self.arrayLiteral()
                    pass
                else:
                    raise NoViableAltException(self)

                self.state = 592
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,57,self._ctx)
                while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                    if _alt==1:
                        self.state = 585
                        self.match(qasm3Parser.COMMA)
                        self.state = 588
                        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 = 586
                            self.expression(0)
                            pass
                        elif token in [qasm3Parser.LBRACE]:
                            self.state = 587
                            self.arrayLiteral()
                            pass
                        else:
                            raise NoViableAltException(self)
                 
                    self.state = 594
                    self._errHandler.sync(self)
                    _alt = self._interp.adaptivePredict(self._input,57,self._ctx)

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




            self.state = 600
            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, 88, self.RULE_indexOperator)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 602
            self.match(qasm3Parser.LBRACKET)
            self.state = 621
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [qasm3Parser.LBRACE]:
                self.state = 603
                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 = 606
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,60,self._ctx)
                if la_ == 1:
                    self.state = 604
                    self.expression(0)
                    pass

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


                self.state = 615
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,62,self._ctx)
                while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                    if _alt==1:
                        self.state = 608
                        self.match(qasm3Parser.COMMA)
                        self.state = 611
                        self._errHandler.sync(self)
                        la_ = self._interp.adaptivePredict(self._input,61,self._ctx)
                        if la_ == 1:
                            self.state = 609
                            self.expression(0)
                            pass

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

                 
                    self.state = 617
                    self._errHandler.sync(self)
                    _alt = self._interp.adaptivePredict(self._input,62,self._ctx)

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


                pass
            else:
                raise NoViableAltException(self)

            self.state = 623
            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, 90, self.RULE_indexedIdentifier)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 625
            self.match(qasm3Parser.Identifier)
            self.state = 629
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==qasm3Parser.LBRACKET:
                self.state = 626
                self.indexOperator()
                self.state = 631
                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, 92, self.RULE_returnSignature)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 632
            self.match(qasm3Parser.ARROW)
            self.state = 633
            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, 94, self.RULE_gateModifier)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 648
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [qasm3Parser.INV]:
                self.state = 635
                self.match(qasm3Parser.INV)
                pass
            elif token in [qasm3Parser.POW]:
                self.state = 636
                self.match(qasm3Parser.POW)
                self.state = 637
                self.match(qasm3Parser.LPAREN)
                self.state = 638
                self.expression(0)
                self.state = 639
                self.match(qasm3Parser.RPAREN)
                pass
            elif token in [qasm3Parser.CTRL, qasm3Parser.NEGCTRL]:
                self.state = 641
                _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 = 646
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==qasm3Parser.LPAREN:
                    self.state = 642
                    self.match(qasm3Parser.LPAREN)
                    self.state = 643
                    self.expression(0)
                    self.state = 644
                    self.match(qasm3Parser.RPAREN)


                pass
            else:
                raise NoViableAltException(self)

            self.state = 650
            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, 96, self.RULE_scalarType)
        self._la = 0 # Token type
        try:
            self.state = 682
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [qasm3Parser.BIT]:
                self.enterOuterAlt(localctx, 1)
                self.state = 652
                self.match(qasm3Parser.BIT)
                self.state = 654
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==qasm3Parser.LBRACKET:
                    self.state = 653
                    self.designator()


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


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


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


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


                pass
            elif token in [qasm3Parser.BOOL]:
                self.enterOuterAlt(localctx, 6)
                self.state = 672
                self.match(qasm3Parser.BOOL)
                pass
            elif token in [qasm3Parser.DURATION]:
                self.enterOuterAlt(localctx, 7)
                self.state = 673
                self.match(qasm3Parser.DURATION)
                pass
            elif token in [qasm3Parser.STRETCH]:
                self.enterOuterAlt(localctx, 8)
                self.state = 674
                self.match(qasm3Parser.STRETCH)
                pass
            elif token in [qasm3Parser.COMPLEX]:
                self.enterOuterAlt(localctx, 9)
                self.state = 675
                self.match(qasm3Parser.COMPLEX)
                self.state = 680
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==qasm3Parser.LBRACKET:
                    self.state = 676
                    self.match(qasm3Parser.LBRACKET)
                    self.state = 677
                    self.scalarType()
                    self.state = 678
                    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, 98, self.RULE_qubitType)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 684
            self.match(qasm3Parser.QUBIT)
            self.state = 686
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.LBRACKET:
                self.state = 685
                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, 100, self.RULE_arrayType)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 688
            self.match(qasm3Parser.ARRAY)
            self.state = 689
            self.match(qasm3Parser.LBRACKET)
            self.state = 690
            self.scalarType()
            self.state = 691
            self.match(qasm3Parser.COMMA)
            self.state = 692
            self.expressionList()
            self.state = 693
            self.match(qasm3Parser.RBRACKET)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ArrayReferenceTypeContext(ParserRuleContext):

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

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

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

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


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

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

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

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

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


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

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

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


        def getRuleIndex(self):
            return qasm3Parser.RULE_arrayReferenceType

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

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

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




    def arrayReferenceType(self):

        localctx = qasm3Parser.ArrayReferenceTypeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 102, self.RULE_arrayReferenceType)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 695
            _la = self._input.LA(1)
            if not(_la==qasm3Parser.READONLY or _la==qasm3Parser.MUTABLE):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
            self.state = 696
            self.match(qasm3Parser.ARRAY)
            self.state = 697
            self.match(qasm3Parser.LBRACKET)
            self.state = 698
            self.scalarType()
            self.state = 699
            self.match(qasm3Parser.COMMA)
            self.state = 704
            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 = 700
                self.expressionList()
                pass
            elif token in [qasm3Parser.DIM]:
                self.state = 701
                self.match(qasm3Parser.DIM)
                self.state = 702
                self.match(qasm3Parser.EQUALS)
                self.state = 703
                self.expression(0)
                pass
            else:
                raise NoViableAltException(self)

            self.state = 706
            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, 104, self.RULE_designator)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 708
            self.match(qasm3Parser.LBRACKET)
            self.state = 709
            self.expression(0)
            self.state = 710
            self.match(qasm3Parser.RBRACKET)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class DefcalTargetContext(ParserRuleContext):

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

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

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

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

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

        def getRuleIndex(self):
            return qasm3Parser.RULE_defcalTarget

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

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

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




    def defcalTarget(self):

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


    class DefcalArgumentDefinitionContext(ParserRuleContext):

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

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


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


        def getRuleIndex(self):
            return qasm3Parser.RULE_defcalArgumentDefinition

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

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

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




    def defcalArgumentDefinition(self):

        localctx = qasm3Parser.DefcalArgumentDefinitionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 108, self.RULE_defcalArgumentDefinition)
        try:
            self.state = 716
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,77,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 714
                self.expression(0)
                pass

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


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


    class DefcalOperandContext(ParserRuleContext):

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

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

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

        def getRuleIndex(self):
            return qasm3Parser.RULE_defcalOperand

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

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

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




    def defcalOperand(self):

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


    class GateOperandContext(ParserRuleContext):

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

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


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

        def getRuleIndex(self):
            return qasm3Parser.RULE_gateOperand

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

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

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




    def gateOperand(self):

        localctx = qasm3Parser.GateOperandContext(self, self._ctx, self.state)
        self.enterRule(localctx, 112, self.RULE_gateOperand)
        try:
            self.state = 722
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [qasm3Parser.Identifier]:
                self.enterOuterAlt(localctx, 1)
                self.state = 720
                self.indexedIdentifier()
                pass
            elif token in [qasm3Parser.HardwareQubit]:
                self.enterOuterAlt(localctx, 2)
                self.state = 721
                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, 114, self.RULE_externArgument)
        self._la = 0 # Token type
        try:
            self.state = 730
            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 = 724
                self.scalarType()
                pass
            elif token in [qasm3Parser.READONLY, qasm3Parser.MUTABLE]:
                self.enterOuterAlt(localctx, 2)
                self.state = 725
                self.arrayReferenceType()
                pass
            elif token in [qasm3Parser.CREG]:
                self.enterOuterAlt(localctx, 3)
                self.state = 726
                self.match(qasm3Parser.CREG)
                self.state = 728
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==qasm3Parser.LBRACKET:
                    self.state = 727
                    self.designator()


                pass
            else:
                raise NoViableAltException(self)

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


    class ArgumentDefinitionContext(ParserRuleContext):

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

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


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

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


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

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

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


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


        def getRuleIndex(self):
            return qasm3Parser.RULE_argumentDefinition

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

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

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




    def argumentDefinition(self):

        localctx = qasm3Parser.ArgumentDefinitionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 116, self.RULE_argumentDefinition)
        self._la = 0 # Token type
        try:
            self.state = 746
            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 = 732
                self.scalarType()
                self.state = 733
                self.match(qasm3Parser.Identifier)
                pass
            elif token in [qasm3Parser.QUBIT]:
                self.enterOuterAlt(localctx, 2)
                self.state = 735
                self.qubitType()
                self.state = 736
                self.match(qasm3Parser.Identifier)
                pass
            elif token in [qasm3Parser.QREG, qasm3Parser.CREG]:
                self.enterOuterAlt(localctx, 3)
                self.state = 738
                _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 = 739
                self.match(qasm3Parser.Identifier)
                self.state = 741
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==qasm3Parser.LBRACKET:
                    self.state = 740
                    self.designator()


                pass
            elif token in [qasm3Parser.READONLY, qasm3Parser.MUTABLE]:
                self.enterOuterAlt(localctx, 4)
                self.state = 743
                self.arrayReferenceType()
                self.state = 744
                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, 118, self.RULE_argumentDefinitionList)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 748
            self.argumentDefinition()
            self.state = 753
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,83,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 749
                    self.match(qasm3Parser.COMMA)
                    self.state = 750
                    self.argumentDefinition() 
                self.state = 755
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,83,self._ctx)

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


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


    class DefcalArgumentDefinitionListContext(ParserRuleContext):

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

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


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

        def getRuleIndex(self):
            return qasm3Parser.RULE_defcalArgumentDefinitionList

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

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

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




    def defcalArgumentDefinitionList(self):

        localctx = qasm3Parser.DefcalArgumentDefinitionListContext(self, self._ctx, self.state)
        self.enterRule(localctx, 120, self.RULE_defcalArgumentDefinitionList)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 759
            self.defcalArgumentDefinition()
            self.state = 764
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,85,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 760
                    self.match(qasm3Parser.COMMA)
                    self.state = 761
                    self.defcalArgumentDefinition() 
                self.state = 766
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,85,self._ctx)

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


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


    class DefcalOperandListContext(ParserRuleContext):

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

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


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

        def getRuleIndex(self):
            return qasm3Parser.RULE_defcalOperandList

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

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

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




    def defcalOperandList(self):

        localctx = qasm3Parser.DefcalOperandListContext(self, self._ctx, self.state)
        self.enterRule(localctx, 122, self.RULE_defcalOperandList)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 770
            self.defcalOperand()
            self.state = 775
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,87,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 771
                    self.match(qasm3Parser.COMMA)
                    self.state = 772
                    self.defcalOperand() 
                self.state = 777
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,87,self._ctx)

            self.state = 779
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.COMMA:
                self.state = 778
                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, 124, self.RULE_expressionList)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 781
            self.expression(0)
            self.state = 786
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,89,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 782
                    self.match(qasm3Parser.COMMA)
                    self.state = 783
                    self.expression(0) 
                self.state = 788
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,89,self._ctx)

            self.state = 790
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.COMMA:
                self.state = 789
                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, 126, self.RULE_identifierList)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 792
            self.match(qasm3Parser.Identifier)
            self.state = 797
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,91,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 793
                    self.match(qasm3Parser.COMMA)
                    self.state = 794
                    self.match(qasm3Parser.Identifier) 
                self.state = 799
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,91,self._ctx)

            self.state = 801
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.COMMA:
                self.state = 800
                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, 128, self.RULE_gateOperandList)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 803
            self.gateOperand()
            self.state = 808
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,93,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 804
                    self.match(qasm3Parser.COMMA)
                    self.state = 805
                    self.gateOperand() 
                self.state = 810
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,93,self._ctx)

            self.state = 812
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==qasm3Parser.COMMA:
                self.state = 811
                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, 130, self.RULE_externArgumentList)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 814
            self.externArgument()
            self.state = 819
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,95,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 815
                    self.match(qasm3Parser.COMMA)
                    self.state = 816
                    self.externArgument() 
                self.state = 821
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,95,self._ctx)

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




