# Copyright 2021 SpinQ Technology Co., Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Generated from Qasm2.g4 by ANTLR 4.9.2
# 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\3c")
        buf.write("\u02b1\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\4D\t")
        buf.write("D\4E\tE\4F\tF\4G\tG\4H\tH\4I\tI\4J\tJ\3\2\3\2\3\2\7\2")
        buf.write("\u0098\n\2\f\2\16\2\u009b\13\2\3\2\3\2\3\3\5\3\u00a0\n")
        buf.write("\3\3\3\7\3\u00a3\n\3\f\3\16\3\u00a6\13\3\3\4\3\4\3\4\3")
        buf.write("\4\3\5\3\5\3\5\3\5\3\6\3\6\3\6\5\6\u00b3\n\6\3\7\3\7\3")
        buf.write("\7\5\7\u00b8\n\7\3\b\3\b\3\b\3\t\3\t\5\t\u00bf\n\t\3\t")
        buf.write("\3\t\3\n\3\n\3\n\3\13\3\13\3\13\3\f\3\f\3\f\3\f\3\r\3")
        buf.write("\r\3\r\3\r\3\r\3\r\3\16\3\16\7\16\u00d5\n\16\f\16\16\16")
        buf.write("\u00d8\13\16\3\16\3\16\3\17\3\17\3\17\5\17\u00df\n\17")
        buf.write("\3\20\3\20\3\20\5\20\u00e4\n\20\3\20\3\20\5\20\u00e8\n")
        buf.write("\20\3\20\5\20\u00eb\n\20\3\21\3\21\3\21\7\21\u00f0\n\21")
        buf.write("\f\21\16\21\u00f3\13\21\3\21\3\21\3\22\3\22\3\23\3\23")
        buf.write("\3\24\3\24\3\25\3\25\3\26\3\26\3\26\3\26\3\26\3\26\3\26")
        buf.write("\3\26\3\26\5\26\u0108\n\26\5\26\u010a\n\26\3\27\3\27\3")
        buf.write("\27\5\27\u010f\n\27\3\30\3\30\3\30\3\30\5\30\u0115\n\30")
        buf.write("\3\31\3\31\3\31\3\31\5\31\u011b\n\31\3\32\3\32\3\32\5")
        buf.write("\32\u0120\n\32\3\33\3\33\3\33\5\33\u0125\n\33\3\33\3\33")
        buf.write("\5\33\u0129\n\33\3\33\5\33\u012c\n\33\3\33\5\33\u012f")
        buf.write("\n\33\3\34\3\34\3\34\3\34\5\34\u0135\n\34\3\35\3\35\3")
        buf.write("\35\7\35\u013a\n\35\f\35\16\35\u013d\13\35\3\35\3\35\3")
        buf.write("\36\3\36\3\36\3\36\3\36\3\36\3\36\5\36\u0148\n\36\3\36")
        buf.write("\3\36\3\36\3\36\3\36\5\36\u014f\n\36\3\36\3\36\5\36\u0153")
        buf.write("\n\36\3\36\5\36\u0156\n\36\3\37\3\37\3\37\7\37\u015b\n")
        buf.write("\37\f\37\16\37\u015e\13\37\3\37\3\37\3 \3 \3 \3 \3 \3")
        buf.write(" \3 \3 \5 \u016a\n \5 \u016c\n \3 \3 \3 \7 \u0171\n \f")
        buf.write(" \16 \u0174\13 \3!\3!\3!\7!\u0179\n!\f!\16!\u017c\13!")
        buf.write("\3!\3!\3\"\3\"\5\"\u0182\n\"\3\"\3\"\5\"\u0186\n\"\3\"")
        buf.write("\3\"\5\"\u018a\n\"\3\"\3\"\3#\3#\3#\3#\3$\3$\5$\u0194")
        buf.write("\n$\3$\3$\3%\3%\5%\u019a\n%\3%\3%\3&\3&\3\'\3\'\7\'\u01a2")
        buf.write("\n\'\f\'\16\'\u01a5\13\'\3\'\3\'\3(\3(\3(\7(\u01ac\n(")
        buf.write("\f(\16(\u01af\13(\3(\5(\u01b2\n(\3)\3)\3)\3*\3*\3*\5*")
        buf.write("\u01ba\n*\3+\3+\3+\3,\3,\3,\5,\u01c2\n,\3,\3,\3,\3,\5")
        buf.write(",\u01c8\n,\3-\3-\3-\3.\3.\3.\5.\u01d0\n.\3.\5.\u01d3\n")
        buf.write(".\3.\3.\3/\3/\3\60\3\60\3\61\3\61\3\62\3\62\3\63\3\63")
        buf.write("\3\63\3\64\3\64\3\64\3\64\5\64\u01e6\n\64\3\64\3\64\3")
        buf.write("\64\7\64\u01eb\n\64\f\64\16\64\u01ee\13\64\3\65\3\65\3")
        buf.write("\65\3\65\3\65\3\65\7\65\u01f6\n\65\f\65\16\65\u01f9\13")
        buf.write("\65\3\66\3\66\3\66\3\66\3\66\3\66\7\66\u0201\n\66\f\66")
        buf.write("\16\66\u0204\13\66\3\67\3\67\3\67\3\67\3\67\3\67\7\67")
        buf.write("\u020c\n\67\f\67\16\67\u020f\13\67\38\38\38\38\38\38\7")
        buf.write("8\u0217\n8\f8\168\u021a\138\39\39\39\39\39\39\39\79\u0223")
        buf.write("\n9\f9\169\u0226\139\3:\3:\3:\3:\3:\3:\3:\7:\u022f\n:")
        buf.write("\f:\16:\u0232\13:\3;\3;\3;\3;\3;\3;\7;\u023a\n;\f;\16")
        buf.write(";\u023d\13;\3<\3<\3<\3<\3<\3<\7<\u0245\n<\f<\16<\u0248")
        buf.write("\13<\3=\3=\3=\5=\u024d\n=\3=\3=\3=\3=\5=\u0253\n=\7=\u0255")
        buf.write("\n=\f=\16=\u0258\13=\3>\3>\3>\3?\3?\3?\3?\3?\3?\3?\3?")
        buf.write("\3?\3?\3?\5?\u0268\n?\3?\3?\3?\3?\3?\3?\3?\7?\u0271\n")
        buf.write("?\f?\16?\u0274\13?\3@\3@\3A\3A\3B\3B\5B\u027c\nB\3B\3")
        buf.write("B\3B\3B\3C\3C\3D\3D\3E\3E\3E\7E\u0289\nE\fE\16E\u028c")
        buf.write("\13E\3E\3E\3F\3F\3F\3G\3G\3H\3H\3H\3H\3H\3H\5H\u029b\n")
        buf.write("H\3I\3I\3I\7I\u02a0\nI\fI\16I\u02a3\13I\3I\5I\u02a6\n")
        buf.write("I\3J\3J\3J\3J\3J\3J\3J\5J\u02af\nJ\3J\2\16>fhjlnprtvx")
        buf.write("|K\2\4\6\b\n\f\16\20\22\24\26\30\32\34\36 \"$&(*,.\60")
        buf.write("\62\64\668:<>@BDFHJLNPRTVXZ\\^`bdfhjlnprtvxz|~\u0080\u0082")
        buf.write("\u0084\u0086\u0088\u008a\u008c\u008e\u0090\u0092\2\21")
        buf.write("\4\2\\\\__\3\2\7\b\3\2\t\f\4\2\22\35^^\4\2 !UU\3\2\"%")
        buf.write("\3\2&\'\4\2\20\20((\3\2,-\3\2TU\3\2VX\3\2./\3\2\60\61")
        buf.write("\3\2\62;\4\2<ERR\2\u02bc\2\u0094\3\2\2\2\4\u009f\3\2\2")
        buf.write("\2\6\u00a7\3\2\2\2\b\u00ab\3\2\2\2\n\u00b2\3\2\2\2\f\u00b7")
        buf.write("\3\2\2\2\16\u00b9\3\2\2\2\20\u00be\3\2\2\2\22\u00c2\3")
        buf.write("\2\2\2\24\u00c5\3\2\2\2\26\u00c8\3\2\2\2\30\u00cc\3\2")
        buf.write("\2\2\32\u00d6\3\2\2\2\34\u00db\3\2\2\2\36\u00ea\3\2\2")
        buf.write("\2 \u00f1\3\2\2\2\"\u00f6\3\2\2\2$\u00f8\3\2\2\2&\u00fa")
        buf.write("\3\2\2\2(\u00fc\3\2\2\2*\u0109\3\2\2\2,\u010b\3\2\2\2")
        buf.write(".\u0110\3\2\2\2\60\u0116\3\2\2\2\62\u011c\3\2\2\2\64\u012b")
        buf.write("\3\2\2\2\66\u0134\3\2\2\28\u013b\3\2\2\2:\u0155\3\2\2")
        buf.write("\2<\u015c\3\2\2\2>\u016b\3\2\2\2@\u017a\3\2\2\2B\u017f")
        buf.write("\3\2\2\2D\u018d\3\2\2\2F\u0191\3\2\2\2H\u0197\3\2\2\2")
        buf.write("J\u019d\3\2\2\2L\u019f\3\2\2\2N\u01b1\3\2\2\2P\u01b3\3")
        buf.write("\2\2\2R\u01b9\3\2\2\2T\u01bb\3\2\2\2V\u01c7\3\2\2\2X\u01c9")
        buf.write("\3\2\2\2Z\u01cc\3\2\2\2\\\u01d6\3\2\2\2^\u01d8\3\2\2\2")
        buf.write("`\u01da\3\2\2\2b\u01dc\3\2\2\2d\u01de\3\2\2\2f\u01e5\3")
        buf.write("\2\2\2h\u01ef\3\2\2\2j\u01fa\3\2\2\2l\u0205\3\2\2\2n\u0210")
        buf.write("\3\2\2\2p\u021b\3\2\2\2r\u0227\3\2\2\2t\u0233\3\2\2\2")
        buf.write("v\u023e\3\2\2\2x\u024c\3\2\2\2z\u0259\3\2\2\2|\u0267\3")
        buf.write("\2\2\2~\u0275\3\2\2\2\u0080\u0277\3\2\2\2\u0082\u027b")
        buf.write("\3\2\2\2\u0084\u0281\3\2\2\2\u0086\u0283\3\2\2\2\u0088")
        buf.write("\u028a\3\2\2\2\u008a\u028f\3\2\2\2\u008c\u0292\3\2\2\2")
        buf.write("\u008e\u029a\3\2\2\2\u0090\u02a5\3\2\2\2\u0092\u02a7\3")
        buf.write("\2\2\2\u0094\u0099\5\4\3\2\u0095\u0098\5\n\6\2\u0096\u0098")
        buf.write("\5\f\7\2\u0097\u0095\3\2\2\2\u0097\u0096\3\2\2\2\u0098")
        buf.write("\u009b\3\2\2\2\u0099\u0097\3\2\2\2\u0099\u009a\3\2\2\2")
        buf.write("\u009a\u009c\3\2\2\2\u009b\u0099\3\2\2\2\u009c\u009d\7")
        buf.write("\2\2\3\u009d\3\3\2\2\2\u009e\u00a0\5\6\4\2\u009f\u009e")
        buf.write("\3\2\2\2\u009f\u00a0\3\2\2\2\u00a0\u00a4\3\2\2\2\u00a1")
        buf.write("\u00a3\5\b\5\2\u00a2\u00a1\3\2\2\2\u00a3\u00a6\3\2\2\2")
        buf.write("\u00a4\u00a2\3\2\2\2\u00a4\u00a5\3\2\2\2\u00a5\5\3\2\2")
        buf.write("\2\u00a6\u00a4\3\2\2\2\u00a7\u00a8\7\3\2\2\u00a8\u00a9")
        buf.write("\t\2\2\2\u00a9\u00aa\7O\2\2\u00aa\7\3\2\2\2\u00ab\u00ac")
        buf.write("\7\4\2\2\u00ac\u00ad\7a\2\2\u00ad\u00ae\7O\2\2\u00ae\t")
        buf.write("\3\2\2\2\u00af\u00b3\5\16\b\2\u00b0\u00b3\5D#\2\u00b1")
        buf.write("\u00b3\5\20\t\2\u00b2\u00af\3\2\2\2\u00b2\u00b0\3\2\2")
        buf.write("\2\u00b2\u00b1\3\2\2\2\u00b3\13\3\2\2\2\u00b4\u00b8\5")
        buf.write("P)\2\u00b5\u00b8\5\22\n\2\u00b6\u00b8\5\u0092J\2\u00b7")
        buf.write("\u00b4\3\2\2\2\u00b7\u00b5\3\2\2\2\u00b7\u00b6\3\2\2\2")
        buf.write("\u00b8\r\3\2\2\2\u00b9\u00ba\5\34\17\2\u00ba\u00bb\7O")
        buf.write("\2\2\u00bb\17\3\2\2\2\u00bc\u00bf\5\66\34\2\u00bd\u00bf")
        buf.write("\5,\27\2\u00be\u00bc\3\2\2\2\u00be\u00bd\3\2\2\2\u00bf")
        buf.write("\u00c0\3\2\2\2\u00c0\u00c1\7O\2\2\u00c1\21\3\2\2\2\u00c2")
        buf.write("\u00c3\5V,\2\u00c3\u00c4\7O\2\2\u00c4\23\3\2\2\2\u00c5")
        buf.write("\u00c6\7S\2\2\u00c6\u00c7\5*\26\2\u00c7\25\3\2\2\2\u00c8")
        buf.write("\u00c9\7H\2\2\u00c9\u00ca\5f\64\2\u00ca\u00cb\7I\2\2\u00cb")
        buf.write("\27\3\2\2\2\u00cc\u00cd\7H\2\2\u00cd\u00ce\5f\64\2\u00ce")
        buf.write("\u00cf\7Q\2\2\u00cf\u00d0\5f\64\2\u00d0\u00d1\7I\2\2\u00d1")
        buf.write("\31\3\2\2\2\u00d2\u00d3\7^\2\2\u00d3\u00d5\7Q\2\2\u00d4")
        buf.write("\u00d2\3\2\2\2\u00d5\u00d8\3\2\2\2\u00d6\u00d4\3\2\2\2")
        buf.write("\u00d6\u00d7\3\2\2\2\u00d7\u00d9\3\2\2\2\u00d8\u00d6\3")
        buf.write("\2\2\2\u00d9\u00da\7^\2\2\u00da\33\3\2\2\2\u00db\u00dc")
        buf.write("\7\5\2\2\u00dc\u00de\7^\2\2\u00dd\u00df\5\26\f\2\u00de")
        buf.write("\u00dd\3\2\2\2\u00de\u00df\3\2\2\2\u00df\35\3\2\2\2\u00e0")
        buf.write("\u00e1\7\5\2\2\u00e1\u00e3\7^\2\2\u00e2\u00e4\5\26\f\2")
        buf.write("\u00e3\u00e2\3\2\2\2\u00e3\u00e4\3\2\2\2\u00e4\u00eb\3")
        buf.write("\2\2\2\u00e5\u00e7\7\6\2\2\u00e6\u00e8\5\26\f\2\u00e7")
        buf.write("\u00e6\3\2\2\2\u00e7\u00e8\3\2\2\2\u00e8\u00e9\3\2\2\2")
        buf.write("\u00e9\u00eb\7^\2\2\u00ea\u00e0\3\2\2\2\u00ea\u00e5\3")
        buf.write("\2\2\2\u00eb\37\3\2\2\2\u00ec\u00ed\5\36\20\2\u00ed\u00ee")
        buf.write("\7Q\2\2\u00ee\u00f0\3\2\2\2\u00ef\u00ec\3\2\2\2\u00f0")
        buf.write("\u00f3\3\2\2\2\u00f1\u00ef\3\2\2\2\u00f1\u00f2\3\2\2\2")
        buf.write("\u00f2\u00f4\3\2\2\2\u00f3\u00f1\3\2\2\2\u00f4\u00f5\5")
        buf.write("\36\20\2\u00f5!\3\2\2\2\u00f6\u00f7\t\3\2\2\u00f7#\3\2")
        buf.write("\2\2\u00f8\u00f9\t\4\2\2\u00f9%\3\2\2\2\u00fa\u00fb\7")
        buf.write("\r\2\2\u00fb\'\3\2\2\2\u00fc\u00fd\7\16\2\2\u00fd)\3\2")
        buf.write("\2\2\u00fe\u00ff\5$\23\2\u00ff\u0100\5\26\f\2\u0100\u010a")
        buf.write("\3\2\2\2\u0101\u0102\5&\24\2\u0102\u0103\5\30\r\2\u0103")
        buf.write("\u010a\3\2\2\2\u0104\u010a\5(\25\2\u0105\u0107\5\"\22")
        buf.write("\2\u0106\u0108\5\26\f\2\u0107\u0106\3\2\2\2\u0107\u0108")
        buf.write("\3\2\2\2\u0108\u010a\3\2\2\2\u0109\u00fe\3\2\2\2\u0109")
        buf.write("\u0101\3\2\2\2\u0109\u0104\3\2\2\2\u0109\u0105\3\2\2\2")
        buf.write("\u010a+\3\2\2\2\u010b\u010c\7\17\2\2\u010c\u010e\7^\2")
        buf.write("\2\u010d\u010f\5\u008aF\2\u010e\u010d\3\2\2\2\u010e\u010f")
        buf.write("\3\2\2\2\u010f-\3\2\2\2\u0110\u0111\5$\23\2\u0111\u0112")
        buf.write("\5\26\f\2\u0112\u0114\7^\2\2\u0113\u0115\5\u008aF\2\u0114")
        buf.write("\u0113\3\2\2\2\u0114\u0115\3\2\2\2\u0115/\3\2\2\2\u0116")
        buf.write("\u0117\5&\24\2\u0117\u0118\5\30\r\2\u0118\u011a\7^\2\2")
        buf.write("\u0119\u011b\5\u008aF\2\u011a\u0119\3\2\2\2\u011a\u011b")
        buf.write("\3\2\2\2\u011b\61\3\2\2\2\u011c\u011d\5(\25\2\u011d\u011f")
        buf.write("\7^\2\2\u011e\u0120\5\u008aF\2\u011f\u011e\3\2\2\2\u011f")
        buf.write("\u0120\3\2\2\2\u0120\63\3\2\2\2\u0121\u0122\7\b\2\2\u0122")
        buf.write("\u0124\7^\2\2\u0123\u0125\5\26\f\2\u0124\u0123\3\2\2\2")
        buf.write("\u0124\u0125\3\2\2\2\u0125\u012c\3\2\2\2\u0126\u0128\7")
        buf.write("\7\2\2\u0127\u0129\5\26\f\2\u0128\u0127\3\2\2\2\u0128")
        buf.write("\u0129\3\2\2\2\u0129\u012a\3\2\2\2\u012a\u012c\7^\2\2")
        buf.write("\u012b\u0121\3\2\2\2\u012b\u0126\3\2\2\2\u012c\u012e\3")
        buf.write("\2\2\2\u012d\u012f\5\u008aF\2\u012e\u012d\3\2\2\2\u012e")
        buf.write("\u012f\3\2\2\2\u012f\65\3\2\2\2\u0130\u0135\5.\30\2\u0131")
        buf.write("\u0135\5\60\31\2\u0132\u0135\5\62\32\2\u0133\u0135\5\64")
        buf.write("\33\2\u0134\u0130\3\2\2\2\u0134\u0131\3\2\2\2\u0134\u0132")
        buf.write("\3\2\2\2\u0134\u0133\3\2\2\2\u0135\67\3\2\2\2\u0136\u0137")
        buf.write("\5*\26\2\u0137\u0138\7Q\2\2\u0138\u013a\3\2\2\2\u0139")
        buf.write("\u0136\3\2\2\2\u013a\u013d\3\2\2\2\u013b\u0139\3\2\2\2")
        buf.write("\u013b\u013c\3\2\2\2\u013c\u013e\3\2\2\2\u013d\u013b\3")
        buf.write("\2\2\2\u013e\u013f\5*\26\2\u013f9\3\2\2\2\u0140\u0141")
        buf.write("\5$\23\2\u0141\u0142\5\26\f\2\u0142\u0148\3\2\2\2\u0143")
        buf.write("\u0144\5&\24\2\u0144\u0145\5\30\r\2\u0145\u0148\3\2\2")
        buf.write("\2\u0146\u0148\5(\25\2\u0147\u0140\3\2\2\2\u0147\u0143")
        buf.write("\3\2\2\2\u0147\u0146\3\2\2\2\u0148\u0149\3\2\2\2\u0149")
        buf.write("\u014a\7^\2\2\u014a\u0156\3\2\2\2\u014b\u014c\7\b\2\2")
        buf.write("\u014c\u014e\7^\2\2\u014d\u014f\5\26\f\2\u014e\u014d\3")
        buf.write("\2\2\2\u014e\u014f\3\2\2\2\u014f\u0156\3\2\2\2\u0150\u0152")
        buf.write("\7\7\2\2\u0151\u0153\5\26\f\2\u0152\u0151\3\2\2\2\u0152")
        buf.write("\u0153\3\2\2\2\u0153\u0154\3\2\2\2\u0154\u0156\7^\2\2")
        buf.write("\u0155\u0147\3\2\2\2\u0155\u014b\3\2\2\2\u0155\u0150\3")
        buf.write("\2\2\2\u0156;\3\2\2\2\u0157\u0158\5:\36\2\u0158\u0159")
        buf.write("\7Q\2\2\u0159\u015b\3\2\2\2\u015a\u0157\3\2\2\2\u015b")
        buf.write("\u015e\3\2\2\2\u015c\u015a\3\2\2\2\u015c\u015d\3\2\2\2")
        buf.write("\u015d\u015f\3\2\2\2\u015e\u015c\3\2\2\2\u015f\u0160\5")
        buf.write(":\36\2\u0160=\3\2\2\2\u0161\u0162\b \1\2\u0162\u0163\7")
        buf.write("^\2\2\u0163\u016c\5B\"\2\u0164\u0169\7^\2\2\u0165\u0166")
        buf.write("\7H\2\2\u0166\u0167\5\u0088E\2\u0167\u0168\7I\2\2\u0168")
        buf.write("\u016a\3\2\2\2\u0169\u0165\3\2\2\2\u0169\u016a\3\2\2\2")
        buf.write("\u016a\u016c\3\2\2\2\u016b\u0161\3\2\2\2\u016b\u0164\3")
        buf.write("\2\2\2\u016c\u0172\3\2\2\2\u016d\u016e\f\3\2\2\u016e\u016f")
        buf.write("\7\20\2\2\u016f\u0171\5> \4\u0170\u016d\3\2\2\2\u0171")
        buf.write("\u0174\3\2\2\2\u0172\u0170\3\2\2\2\u0172\u0173\3\2\2\2")
        buf.write("\u0173?\3\2\2\2\u0174\u0172\3\2\2\2\u0175\u0176\5> \2")
        buf.write("\u0176\u0177\7Q\2\2\u0177\u0179\3\2\2\2\u0178\u0175\3")
        buf.write("\2\2\2\u0179\u017c\3\2\2\2\u017a\u0178\3\2\2\2\u017a\u017b")
        buf.write("\3\2\2\2\u017b\u017d\3\2\2\2\u017c\u017a\3\2\2\2\u017d")
        buf.write("\u017e\5> \2\u017eA\3\2\2\2\u017f\u0181\7H\2\2\u0180\u0182")
        buf.write("\5f\64\2\u0181\u0180\3\2\2\2\u0181\u0182\3\2\2\2\u0182")
        buf.write("\u0183\3\2\2\2\u0183\u0185\7N\2\2\u0184\u0186\5f\64\2")
        buf.write("\u0185\u0184\3\2\2\2\u0185\u0186\3\2\2\2\u0186\u0189\3")
        buf.write("\2\2\2\u0187\u0188\7N\2\2\u0188\u018a\5f\64\2\u0189\u0187")
        buf.write("\3\2\2\2\u0189\u018a\3\2\2\2\u018a\u018b\3\2\2\2\u018b")
        buf.write("\u018c\7I\2\2\u018cC\3\2\2\2\u018d\u018e\7\21\2\2\u018e")
        buf.write("\u018f\5F$\2\u018f\u0190\5L\'\2\u0190E\3\2\2\2\u0191\u0193")
        buf.write("\7^\2\2\u0192\u0194\5H%\2\u0193\u0192\3\2\2\2\u0193\u0194")
        buf.write("\3\2\2\2\u0194\u0195\3\2\2\2\u0195\u0196\5\32\16\2\u0196")
        buf.write("G\3\2\2\2\u0197\u0199\7L\2\2\u0198\u019a\5\32\16\2\u0199")
        buf.write("\u0198\3\2\2\2\u0199\u019a\3\2\2\2\u019a\u019b\3\2\2\2")
        buf.write("\u019b\u019c\7M\2\2\u019cI\3\2\2\2\u019d\u019e\t\5\2\2")
        buf.write("\u019eK\3\2\2\2\u019f\u01a3\7J\2\2\u01a0\u01a2\5P)\2\u01a1")
        buf.write("\u01a0\3\2\2\2\u01a2\u01a5\3\2\2\2\u01a3\u01a1\3\2\2\2")
        buf.write("\u01a3\u01a4\3\2\2\2\u01a4\u01a6\3\2\2\2\u01a5\u01a3\3")
        buf.write("\2\2\2\u01a6\u01a7\7K\2\2\u01a7M\3\2\2\2\u01a8\u01b2\5")
        buf.write("P)\2\u01a9\u01ad\7J\2\2\u01aa\u01ac\5P)\2\u01ab\u01aa")
        buf.write("\3\2\2\2\u01ac\u01af\3\2\2\2\u01ad\u01ab\3\2\2\2\u01ad")
        buf.write("\u01ae\3\2\2\2\u01ae\u01b0\3\2\2\2\u01af\u01ad\3\2\2\2")
        buf.write("\u01b0\u01b2\7K\2\2\u01b1\u01a8\3\2\2\2\u01b1\u01a9\3")
        buf.write("\2\2\2\u01b2O\3\2\2\2\u01b3\u01b4\5R*\2\u01b4\u01b5\7")
        buf.write("O\2\2\u01b5Q\3\2\2\2\u01b6\u01ba\5Z.\2\u01b7\u01ba\5T")
        buf.write("+\2\u01b8\u01ba\5X-\2\u01b9\u01b6\3\2\2\2\u01b9\u01b7")
        buf.write("\3\2\2\2\u01b9\u01b8\3\2\2\2\u01baS\3\2\2\2\u01bb\u01bc")
        buf.write("\7\36\2\2\u01bc\u01bd\5@!\2\u01bdU\3\2\2\2\u01be\u01c1")
        buf.write("\5T+\2\u01bf\u01c0\7S\2\2\u01c0\u01c2\5@!\2\u01c1\u01bf")
        buf.write("\3\2\2\2\u01c1\u01c2\3\2\2\2\u01c2\u01c8\3\2\2\2\u01c3")
        buf.write("\u01c4\5@!\2\u01c4\u01c5\7R\2\2\u01c5\u01c6\5T+\2\u01c6")
        buf.write("\u01c8\3\2\2\2\u01c7\u01be\3\2\2\2\u01c7\u01c3\3\2\2\2")
        buf.write("\u01c8W\3\2\2\2\u01c9\u01ca\7\37\2\2\u01ca\u01cb\5@!\2")
        buf.write("\u01cbY\3\2\2\2\u01cc\u01d2\5J&\2\u01cd\u01cf\7L\2\2\u01ce")
        buf.write("\u01d0\5\u0088E\2\u01cf\u01ce\3\2\2\2\u01cf\u01d0\3\2")
        buf.write("\2\2\u01d0\u01d1\3\2\2\2\u01d1\u01d3\7M\2\2\u01d2\u01cd")
        buf.write("\3\2\2\2\u01d2\u01d3\3\2\2\2\u01d3\u01d4\3\2\2\2\u01d4")
        buf.write("\u01d5\5@!\2\u01d5[\3\2\2\2\u01d6\u01d7\t\6\2\2\u01d7")
        buf.write("]\3\2\2\2\u01d8\u01d9\t\7\2\2\u01d9_\3\2\2\2\u01da\u01db")
        buf.write("\t\b\2\2\u01dba\3\2\2\2\u01dc\u01dd\t\t\2\2\u01ddc\3\2")
        buf.write("\2\2\u01de\u01df\5f\64\2\u01df\u01e0\7O\2\2\u01e0e\3\2")
        buf.write("\2\2\u01e1\u01e2\b\64\1\2\u01e2\u01e6\5|?\2\u01e3\u01e6")
        buf.write("\5z>\2\u01e4\u01e6\5h\65\2\u01e5\u01e1\3\2\2\2\u01e5\u01e3")
        buf.write("\3\2\2\2\u01e5\u01e4\3\2\2\2\u01e6\u01ec\3\2\2\2\u01e7")
        buf.write("\u01e8\f\3\2\2\u01e8\u01e9\7\20\2\2\u01e9\u01eb\5h\65")
        buf.write("\2\u01ea\u01e7\3\2\2\2\u01eb\u01ee\3\2\2\2\u01ec\u01ea")
        buf.write("\3\2\2\2\u01ec\u01ed\3\2\2\2\u01edg\3\2\2\2\u01ee\u01ec")
        buf.write("\3\2\2\2\u01ef\u01f0\b\65\1\2\u01f0\u01f1\5j\66\2\u01f1")
        buf.write("\u01f7\3\2\2\2\u01f2\u01f3\f\3\2\2\u01f3\u01f4\7(\2\2")
        buf.write("\u01f4\u01f6\5j\66\2\u01f5\u01f2\3\2\2\2\u01f6\u01f9\3")
        buf.write("\2\2\2\u01f7\u01f5\3\2\2\2\u01f7\u01f8\3\2\2\2\u01f8i")
        buf.write("\3\2\2\2\u01f9\u01f7\3\2\2\2\u01fa\u01fb\b\66\1\2\u01fb")
        buf.write("\u01fc\5l\67\2\u01fc\u0202\3\2\2\2\u01fd\u01fe\f\3\2\2")
        buf.write("\u01fe\u01ff\7)\2\2\u01ff\u0201\5l\67\2\u0200\u01fd\3")
        buf.write("\2\2\2\u0201\u0204\3\2\2\2\u0202\u0200\3\2\2\2\u0202\u0203")
        buf.write("\3\2\2\2\u0203k\3\2\2\2\u0204\u0202\3\2\2\2\u0205\u0206")
        buf.write("\b\67\1\2\u0206\u0207\5n8\2\u0207\u020d\3\2\2\2\u0208")
        buf.write("\u0209\f\3\2\2\u0209\u020a\7*\2\2\u020a\u020c\5n8\2\u020b")
        buf.write("\u0208\3\2\2\2\u020c\u020f\3\2\2\2\u020d\u020b\3\2\2\2")
        buf.write("\u020d\u020e\3\2\2\2\u020em\3\2\2\2\u020f\u020d\3\2\2")
        buf.write("\2\u0210\u0211\b8\1\2\u0211\u0212\5p9\2\u0212\u0218\3")
        buf.write("\2\2\2\u0213\u0214\f\3\2\2\u0214\u0215\7+\2\2\u0215\u0217")
        buf.write("\5p9\2\u0216\u0213\3\2\2\2\u0217\u021a\3\2\2\2\u0218\u0216")
        buf.write("\3\2\2\2\u0218\u0219\3\2\2\2\u0219o\3\2\2\2\u021a\u0218")
        buf.write("\3\2\2\2\u021b\u021c\b9\1\2\u021c\u021d\5r:\2\u021d\u0224")
        buf.write("\3\2\2\2\u021e\u021f\f\3\2\2\u021f\u0220\5`\61\2\u0220")
        buf.write("\u0221\5r:\2\u0221\u0223\3\2\2\2\u0222\u021e\3\2\2\2\u0223")
        buf.write("\u0226\3\2\2\2\u0224\u0222\3\2\2\2\u0224\u0225\3\2\2\2")
        buf.write("\u0225q\3\2\2\2\u0226\u0224\3\2\2\2\u0227\u0228\b:\1\2")
        buf.write("\u0228\u0229\5t;\2\u0229\u0230\3\2\2\2\u022a\u022b\f\3")
        buf.write("\2\2\u022b\u022c\5^\60\2\u022c\u022d\5t;\2\u022d\u022f")
        buf.write("\3\2\2\2\u022e\u022a\3\2\2\2\u022f\u0232\3\2\2\2\u0230")
        buf.write("\u022e\3\2\2\2\u0230\u0231\3\2\2\2\u0231s\3\2\2\2\u0232")
        buf.write("\u0230\3\2\2\2\u0233\u0234\b;\1\2\u0234\u0235\5v<\2\u0235")
        buf.write("\u023b\3\2\2\2\u0236\u0237\f\3\2\2\u0237\u0238\t\n\2\2")
        buf.write("\u0238\u023a\5v<\2\u0239\u0236\3\2\2\2\u023a\u023d\3\2")
        buf.write("\2\2\u023b\u0239\3\2\2\2\u023b\u023c\3\2\2\2\u023cu\3")
        buf.write("\2\2\2\u023d\u023b\3\2\2\2\u023e\u023f\b<\1\2\u023f\u0240")
        buf.write("\5x=\2\u0240\u0246\3\2\2\2\u0241\u0242\f\3\2\2\u0242\u0243")
        buf.write("\t\13\2\2\u0243\u0245\5x=\2\u0244\u0241\3\2\2\2\u0245")
        buf.write("\u0248\3\2\2\2\u0246\u0244\3\2\2\2\u0246\u0247\3\2\2\2")
        buf.write("\u0247w\3\2\2\2\u0248\u0246\3\2\2\2\u0249\u024a\b=\1\2")
        buf.write("\u024a\u024d\5|?\2\u024b\u024d\5z>\2\u024c\u0249\3\2\2")
        buf.write("\2\u024c\u024b\3\2\2\2\u024d\u0256\3\2\2\2\u024e\u024f")
        buf.write("\f\3\2\2\u024f\u0252\t\f\2\2\u0250\u0253\5|?\2\u0251\u0253")
        buf.write("\5z>\2\u0252\u0250\3\2\2\2\u0252\u0251\3\2\2\2\u0253\u0255")
        buf.write("\3\2\2\2\u0254\u024e\3\2\2\2\u0255\u0258\3\2\2\2\u0256")
        buf.write("\u0254\3\2\2\2\u0256\u0257\3\2\2\2\u0257y\3\2\2\2\u0258")
        buf.write("\u0256\3\2\2\2\u0259\u025a\5\\/\2\u025a\u025b\5|?\2\u025b")
        buf.write("{\3\2\2\2\u025c\u025d\b?\1\2\u025d\u0268\7Y\2\2\u025e")
        buf.write("\u0268\7\\\2\2\u025f\u0268\7_\2\2\u0260\u0268\5~@\2\u0261")
        buf.write("\u0268\7^\2\2\u0262\u0268\7a\2\2\u0263\u0264\7L\2\2\u0264")
        buf.write("\u0265\5f\64\2\u0265\u0266\7M\2\2\u0266\u0268\3\2\2\2")
        buf.write("\u0267\u025c\3\2\2\2\u0267\u025e\3\2\2\2\u0267\u025f\3")
        buf.write("\2\2\2\u0267\u0260\3\2\2\2\u0267\u0261\3\2\2\2\u0267\u0262")
        buf.write("\3\2\2\2\u0267\u0263\3\2\2\2\u0268\u0272\3\2\2\2\u0269")
        buf.write("\u026a\f\4\2\2\u026a\u026b\7H\2\2\u026b\u026c\5f\64\2")
        buf.write("\u026c\u026d\7I\2\2\u026d\u0271\3\2\2\2\u026e\u026f\f")
        buf.write("\3\2\2\u026f\u0271\5\u0080A\2\u0270\u0269\3\2\2\2\u0270")
        buf.write("\u026e\3\2\2\2\u0271\u0274\3\2\2\2\u0272\u0270\3\2\2\2")
        buf.write("\u0272\u0273\3\2\2\2\u0273}\3\2\2\2\u0274\u0272\3\2\2")
        buf.write("\2\u0275\u0276\t\r\2\2\u0276\177\3\2\2\2\u0277\u0278\t")
        buf.write("\16\2\2\u0278\u0081\3\2\2\2\u0279\u027c\5\u0084C\2\u027a")
        buf.write("\u027c\5\u0086D\2\u027b\u0279\3\2\2\2\u027b\u027a\3\2")
        buf.write("\2\2\u027c\u027d\3\2\2\2\u027d\u027e\7L\2\2\u027e\u027f")
        buf.write("\5\u0088E\2\u027f\u0280\7M\2\2\u0280\u0083\3\2\2\2\u0281")
        buf.write("\u0282\t\17\2\2\u0282\u0085\3\2\2\2\u0283\u0284\5*\26")
        buf.write("\2\u0284\u0087\3\2\2\2\u0285\u0286\5f\64\2\u0286\u0287")
        buf.write("\7Q\2\2\u0287\u0289\3\2\2\2\u0288\u0285\3\2\2\2\u0289")
        buf.write("\u028c\3\2\2\2\u028a\u0288\3\2\2\2\u028a\u028b\3\2\2\2")
        buf.write("\u028b\u028d\3\2\2\2\u028c\u028a\3\2\2\2\u028d\u028e\5")
        buf.write("f\64\2\u028e\u0089\3\2\2\2\u028f\u0290\7R\2\2\u0290\u0291")
        buf.write("\5f\64\2\u0291\u008b\3\2\2\2\u0292\u0293\t\20\2\2\u0293")
        buf.write("\u008d\3\2\2\2\u0294\u0295\7J\2\2\u0295\u0296\5\u0088")
        buf.write("E\2\u0296\u0297\7K\2\2\u0297\u029b\3\2\2\2\u0298\u029b")
        buf.write("\5B\"\2\u0299\u029b\7^\2\2\u029a\u0294\3\2\2\2\u029a\u0298")
        buf.write("\3\2\2\2\u029a\u0299\3\2\2\2\u029b\u008f\3\2\2\2\u029c")
        buf.write("\u02a6\5\f\7\2\u029d\u02a1\7J\2\2\u029e\u02a0\5\f\7\2")
        buf.write("\u029f\u029e\3\2\2\2\u02a0\u02a3\3\2\2\2\u02a1\u029f\3")
        buf.write("\2\2\2\u02a1\u02a2\3\2\2\2\u02a2\u02a4\3\2\2\2\u02a3\u02a1")
        buf.write("\3\2\2\2\u02a4\u02a6\7K\2\2\u02a5\u029c\3\2\2\2\u02a5")
        buf.write("\u029d\3\2\2\2\u02a6\u0091\3\2\2\2\u02a7\u02a8\7F\2\2")
        buf.write("\u02a8\u02a9\7L\2\2\u02a9\u02aa\5f\64\2\u02aa\u02ab\7")
        buf.write("M\2\2\u02ab\u02ae\5\u0090I\2\u02ac\u02ad\7G\2\2\u02ad")
        buf.write("\u02af\5\u0090I\2\u02ae\u02ac\3\2\2\2\u02ae\u02af\3\2")
        buf.write("\2\2\u02af\u0093\3\2\2\2G\u0097\u0099\u009f\u00a4\u00b2")
        buf.write("\u00b7\u00be\u00d6\u00de\u00e3\u00e7\u00ea\u00f1\u0107")
        buf.write("\u0109\u010e\u0114\u011a\u011f\u0124\u0128\u012b\u012e")
        buf.write("\u0134\u013b\u0147\u014e\u0152\u0155\u015c\u0169\u016b")
        buf.write("\u0172\u017a\u0181\u0185\u0189\u0193\u0199\u01a3\u01ad")
        buf.write("\u01b1\u01b9\u01c1\u01c7\u01cf\u01d2\u01e5\u01ec\u01f7")
        buf.write("\u0202\u020d\u0218\u0224\u0230\u023b\u0246\u024c\u0252")
        buf.write("\u0256\u0267\u0270\u0272\u027b\u028a\u029a\u02a1\u02a5")
        buf.write("\u02ae")
        return buf.getvalue()


class Qasm2Parser ( Parser ):

    grammarFileName = "Qasm2.g4"

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

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

    sharedContextCache = PredictionContextCache()

    literalNames = [ "<INVALID>", "'OPENQASM'", "'include'", "'qreg'", "'qubit'", 
                     "'bit'", "'creg'", "'int'", "'uint'", "'float'", "'angle'", 
                     "'fixed'", "'bool'", "'const'", "'||'", "'gate'", "'U'", 
                     "'CX'", "'cz'", "'cx'", "'cy'", "'x'", "'y'", "'z'", 
                     "'h'", "'rx'", "'ry'", "'rz'", "'measure'", "'barrier'", 
                     "'~'", "'!'", "'>'", "'<'", "'>='", "'<='", "'=='", 
                     "'!='", "'&&'", "'|'", "'^'", "'&'", "'<<'", "'>>'", 
                     "'true'", "'false'", "'++'", "'--'", "'sin'", "'cos'", 
                     "'tan'", "'exp'", "'ln'", "'sqrt'", "'rotl'", "'rotr'", 
                     "'popcount'", "'lengthof'", "'+='", "'-='", "'*='", 
                     "'/='", "'&='", "'|='", "'~='", "'^='", "'<<='", "'>>='", 
                     "'if'", "'else'", "'['", "']'", "'{'", "'}'", "'('", 
                     "')'", "':'", "';'", "'.'", "','", "'='", "'->'", "'+'", 
                     "'-'", "'*'", "'/'", "'%'" ]

    symbolicNames = [ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "LBRACKET", "RBRACKET", 
                      "LBRACE", "RBRACE", "LPAREN", "RPAREN", "COLON", "SEMICOLON", 
                      "DOT", "COMMA", "EQUALS", "ARROW", "PLUS", "MINUS", 
                      "MUL", "DIV", "MOD", "Constant", "Whitespace", "Newline", 
                      "Integer", "StretchN", "Identifier", "RealNumber", 
                      "TimingLiteral", "StringLiteral", "LineComment", "BlockComment" ]

    RULE_program = 0
    RULE_header = 1
    RULE_version = 2
    RULE_include = 3
    RULE_globalStatement = 4
    RULE_statement = 5
    RULE_quantumDeclarationStatement = 6
    RULE_classicalDeclarationStatement = 7
    RULE_assignmentStatement = 8
    RULE_returnSignature = 9
    RULE_designator = 10
    RULE_doubleDesignator = 11
    RULE_identifierList = 12
    RULE_quantumDeclaration = 13
    RULE_quantumArgument = 14
    RULE_quantumArgumentList = 15
    RULE_bitType = 16
    RULE_singleDesignatorType = 17
    RULE_doubleDesignatorType = 18
    RULE_noDesignatorType = 19
    RULE_classicalType = 20
    RULE_constantDeclaration = 21
    RULE_singleDesignatorDeclaration = 22
    RULE_doubleDesignatorDeclaration = 23
    RULE_noDesignatorDeclaration = 24
    RULE_bitDeclaration = 25
    RULE_classicalDeclaration = 26
    RULE_classicalTypeList = 27
    RULE_classicalArgument = 28
    RULE_classicalArgumentList = 29
    RULE_indexIdentifier = 30
    RULE_indexIdentifierList = 31
    RULE_rangeDefinition = 32
    RULE_quantumGateDefinition = 33
    RULE_quantumGateSignature = 34
    RULE_quantumGateParameter = 35
    RULE_quantumGateName = 36
    RULE_quantumBlock = 37
    RULE_quantumLoopBlock = 38
    RULE_quantumStatement = 39
    RULE_quantumInstruction = 40
    RULE_quantumMeasurement = 41
    RULE_quantumMeasurementAssignment = 42
    RULE_quantumBarrier = 43
    RULE_quantumGateCall = 44
    RULE_unaryOperator = 45
    RULE_comparisonOperator = 46
    RULE_equalityOperator = 47
    RULE_logicalOperator = 48
    RULE_expressionStatement = 49
    RULE_expression = 50
    RULE_logicalAndExpression = 51
    RULE_bitOrExpression = 52
    RULE_xOrExpression = 53
    RULE_bitAndExpression = 54
    RULE_equalityExpression = 55
    RULE_comparisonExpression = 56
    RULE_bitShiftExpression = 57
    RULE_additiveExpression = 58
    RULE_multiplicativeExpression = 59
    RULE_unaryExpression = 60
    RULE_expressionTerminator = 61
    RULE_booleanLiteral = 62
    RULE_incrementor = 63
    RULE_builtInCall = 64
    RULE_builtInMath = 65
    RULE_castOperator = 66
    RULE_expressionList = 67
    RULE_equalsExpression = 68
    RULE_assignmentOperator = 69
    RULE_setDeclaration = 70
    RULE_programBlock = 71
    RULE_branchingStatement = 72

    ruleNames =  [ "program", "header", "version", "include", "globalStatement", 
                   "statement", "quantumDeclarationStatement", "classicalDeclarationStatement", 
                   "assignmentStatement", "returnSignature", "designator", 
                   "doubleDesignator", "identifierList", "quantumDeclaration", 
                   "quantumArgument", "quantumArgumentList", "bitType", 
                   "singleDesignatorType", "doubleDesignatorType", "noDesignatorType", 
                   "classicalType", "constantDeclaration", "singleDesignatorDeclaration", 
                   "doubleDesignatorDeclaration", "noDesignatorDeclaration", 
                   "bitDeclaration", "classicalDeclaration", "classicalTypeList", 
                   "classicalArgument", "classicalArgumentList", "indexIdentifier", 
                   "indexIdentifierList", "rangeDefinition", "quantumGateDefinition", 
                   "quantumGateSignature", "quantumGateParameter", "quantumGateName", 
                   "quantumBlock", "quantumLoopBlock", "quantumStatement", 
                   "quantumInstruction", "quantumMeasurement", "quantumMeasurementAssignment", 
                   "quantumBarrier", "quantumGateCall", "unaryOperator", 
                   "comparisonOperator", "equalityOperator", "logicalOperator", 
                   "expressionStatement", "expression", "logicalAndExpression", 
                   "bitOrExpression", "xOrExpression", "bitAndExpression", 
                   "equalityExpression", "comparisonExpression", "bitShiftExpression", 
                   "additiveExpression", "multiplicativeExpression", "unaryExpression", 
                   "expressionTerminator", "booleanLiteral", "incrementor", 
                   "builtInCall", "builtInMath", "castOperator", "expressionList", 
                   "equalsExpression", "assignmentOperator", "setDeclaration", 
                   "programBlock", "branchingStatement" ]

    EOF = Token.EOF
    T__0=1
    T__1=2
    T__2=3
    T__3=4
    T__4=5
    T__5=6
    T__6=7
    T__7=8
    T__8=9
    T__9=10
    T__10=11
    T__11=12
    T__12=13
    T__13=14
    T__14=15
    T__15=16
    T__16=17
    T__17=18
    T__18=19
    T__19=20
    T__20=21
    T__21=22
    T__22=23
    T__23=24
    T__24=25
    T__25=26
    T__26=27
    T__27=28
    T__28=29
    T__29=30
    T__30=31
    T__31=32
    T__32=33
    T__33=34
    T__34=35
    T__35=36
    T__36=37
    T__37=38
    T__38=39
    T__39=40
    T__40=41
    T__41=42
    T__42=43
    T__43=44
    T__44=45
    T__45=46
    T__46=47
    T__47=48
    T__48=49
    T__49=50
    T__50=51
    T__51=52
    T__52=53
    T__53=54
    T__54=55
    T__55=56
    T__56=57
    T__57=58
    T__58=59
    T__59=60
    T__60=61
    T__61=62
    T__62=63
    T__63=64
    T__64=65
    T__65=66
    T__66=67
    T__67=68
    T__68=69
    LBRACKET=70
    RBRACKET=71
    LBRACE=72
    RBRACE=73
    LPAREN=74
    RPAREN=75
    COLON=76
    SEMICOLON=77
    DOT=78
    COMMA=79
    EQUALS=80
    ARROW=81
    PLUS=82
    MINUS=83
    MUL=84
    DIV=85
    MOD=86
    Constant=87
    Whitespace=88
    Newline=89
    Integer=90
    StretchN=91
    Identifier=92
    RealNumber=93
    TimingLiteral=94
    StringLiteral=95
    LineComment=96
    BlockComment=97

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




    class ProgramContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def header(self):
            return self.getTypedRuleContext(Qasm2Parser.HeaderContext,0)


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

        def globalStatement(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(Qasm2Parser.GlobalStatementContext)
            else:
                return self.getTypedRuleContext(Qasm2Parser.GlobalStatementContext,i)


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


        def getRuleIndex(self):
            return Qasm2Parser.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 program(self):

        localctx = Qasm2Parser.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 = 146
            self.header()
            self.state = 151
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << Qasm2Parser.T__2) | (1 << Qasm2Parser.T__4) | (1 << Qasm2Parser.T__5) | (1 << Qasm2Parser.T__6) | (1 << Qasm2Parser.T__7) | (1 << Qasm2Parser.T__8) | (1 << Qasm2Parser.T__9) | (1 << Qasm2Parser.T__10) | (1 << Qasm2Parser.T__11) | (1 << Qasm2Parser.T__12) | (1 << Qasm2Parser.T__14) | (1 << Qasm2Parser.T__15) | (1 << Qasm2Parser.T__16) | (1 << Qasm2Parser.T__17) | (1 << Qasm2Parser.T__18) | (1 << Qasm2Parser.T__19) | (1 << Qasm2Parser.T__20) | (1 << Qasm2Parser.T__21) | (1 << Qasm2Parser.T__22) | (1 << Qasm2Parser.T__23) | (1 << Qasm2Parser.T__24) | (1 << Qasm2Parser.T__25) | (1 << Qasm2Parser.T__26) | (1 << Qasm2Parser.T__27) | (1 << Qasm2Parser.T__28))) != 0) or _la==Qasm2Parser.T__67 or _la==Qasm2Parser.Identifier:
                self.state = 149
                self._errHandler.sync(self)
                token = self._input.LA(1)
                if token in [Qasm2Parser.T__2, Qasm2Parser.T__4, Qasm2Parser.T__5, Qasm2Parser.T__6, Qasm2Parser.T__7, Qasm2Parser.T__8, Qasm2Parser.T__9, Qasm2Parser.T__10, Qasm2Parser.T__11, Qasm2Parser.T__12, Qasm2Parser.T__14]:
                    self.state = 147
                    self.globalStatement()
                    pass
                elif token in [Qasm2Parser.T__15, Qasm2Parser.T__16, Qasm2Parser.T__17, Qasm2Parser.T__18, Qasm2Parser.T__19, Qasm2Parser.T__20, Qasm2Parser.T__21, Qasm2Parser.T__22, Qasm2Parser.T__23, Qasm2Parser.T__24, Qasm2Parser.T__25, Qasm2Parser.T__26, Qasm2Parser.T__27, Qasm2Parser.T__28, Qasm2Parser.T__67, Qasm2Parser.Identifier]:
                    self.state = 148
                    self.statement()
                    pass
                else:
                    raise NoViableAltException(self)

                self.state = 153
                self._errHandler.sync(self)
                _la = self._input.LA(1)

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


    class HeaderContext(ParserRuleContext):
        __slots__ = 'parser'

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

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


        def include(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(Qasm2Parser.IncludeContext)
            else:
                return self.getTypedRuleContext(Qasm2Parser.IncludeContext,i)


        def getRuleIndex(self):
            return Qasm2Parser.RULE_header

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

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




    def header(self):

        localctx = Qasm2Parser.HeaderContext(self, self._ctx, self.state)
        self.enterRule(localctx, 2, self.RULE_header)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 157
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==Qasm2Parser.T__0:
                self.state = 156
                self.version()


            self.state = 162
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==Qasm2Parser.T__1:
                self.state = 159
                self.include()
                self.state = 164
                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 VersionContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

        def Integer(self):
            return self.getToken(Qasm2Parser.Integer, 0)

        def RealNumber(self):
            return self.getToken(Qasm2Parser.RealNumber, 0)

        def getRuleIndex(self):
            return Qasm2Parser.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 version(self):

        localctx = Qasm2Parser.VersionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 4, self.RULE_version)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 165
            self.match(Qasm2Parser.T__0)
            self.state = 166
            _la = self._input.LA(1)
            if not(_la==Qasm2Parser.Integer or _la==Qasm2Parser.RealNumber):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
            self.state = 167
            self.match(Qasm2Parser.SEMICOLON)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class IncludeContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

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

        def getRuleIndex(self):
            return Qasm2Parser.RULE_include

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

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




    def include(self):

        localctx = Qasm2Parser.IncludeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 6, self.RULE_include)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 169
            self.match(Qasm2Parser.T__1)
            self.state = 170
            self.match(Qasm2Parser.StringLiteral)
            self.state = 171
            self.match(Qasm2Parser.SEMICOLON)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class GlobalStatementContext(ParserRuleContext):
        __slots__ = 'parser'

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

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


        def quantumGateDefinition(self):
            return self.getTypedRuleContext(Qasm2Parser.QuantumGateDefinitionContext,0)


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


        def getRuleIndex(self):
            return Qasm2Parser.RULE_globalStatement

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

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




    def globalStatement(self):

        localctx = Qasm2Parser.GlobalStatementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 8, self.RULE_globalStatement)
        try:
            self.state = 176
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [Qasm2Parser.T__2]:
                self.enterOuterAlt(localctx, 1)
                self.state = 173
                self.quantumDeclarationStatement()
                pass
            elif token in [Qasm2Parser.T__14]:
                self.enterOuterAlt(localctx, 2)
                self.state = 174
                self.quantumGateDefinition()
                pass
            elif token in [Qasm2Parser.T__4, Qasm2Parser.T__5, Qasm2Parser.T__6, Qasm2Parser.T__7, Qasm2Parser.T__8, Qasm2Parser.T__9, Qasm2Parser.T__10, Qasm2Parser.T__11, Qasm2Parser.T__12]:
                self.enterOuterAlt(localctx, 3)
                self.state = 175
                self.classicalDeclarationStatement()
                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 StatementContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def quantumStatement(self):
            return self.getTypedRuleContext(Qasm2Parser.QuantumStatementContext,0)


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


        def branchingStatement(self):
            return self.getTypedRuleContext(Qasm2Parser.BranchingStatementContext,0)


        def getRuleIndex(self):
            return Qasm2Parser.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 statement(self):

        localctx = Qasm2Parser.StatementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 10, self.RULE_statement)
        try:
            self.state = 181
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,5,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 178
                self.quantumStatement()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 179
                self.assignmentStatement()
                pass

            elif la_ == 3:
                self.enterOuterAlt(localctx, 3)
                self.state = 180
                self.branchingStatement()
                pass


        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):
        __slots__ = 'parser'

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

        def quantumDeclaration(self):
            return self.getTypedRuleContext(Qasm2Parser.QuantumDeclarationContext,0)


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

        def getRuleIndex(self):
            return Qasm2Parser.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 quantumDeclarationStatement(self):

        localctx = Qasm2Parser.QuantumDeclarationStatementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 12, self.RULE_quantumDeclarationStatement)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 183
            self.quantumDeclaration()
            self.state = 184
            self.match(Qasm2Parser.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):
        __slots__ = 'parser'

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

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

        def classicalDeclaration(self):
            return self.getTypedRuleContext(Qasm2Parser.ClassicalDeclarationContext,0)


        def constantDeclaration(self):
            return self.getTypedRuleContext(Qasm2Parser.ConstantDeclarationContext,0)


        def getRuleIndex(self):
            return Qasm2Parser.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 classicalDeclarationStatement(self):

        localctx = Qasm2Parser.ClassicalDeclarationStatementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 14, self.RULE_classicalDeclarationStatement)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 188
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [Qasm2Parser.T__4, Qasm2Parser.T__5, Qasm2Parser.T__6, Qasm2Parser.T__7, Qasm2Parser.T__8, Qasm2Parser.T__9, Qasm2Parser.T__10, Qasm2Parser.T__11]:
                self.state = 186
                self.classicalDeclaration()
                pass
            elif token in [Qasm2Parser.T__12]:
                self.state = 187
                self.constantDeclaration()
                pass
            else:
                raise NoViableAltException(self)

            self.state = 190
            self.match(Qasm2Parser.SEMICOLON)
        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):
        __slots__ = 'parser'

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

        def quantumMeasurementAssignment(self):
            return self.getTypedRuleContext(Qasm2Parser.QuantumMeasurementAssignmentContext,0)


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

        def getRuleIndex(self):
            return Qasm2Parser.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 assignmentStatement(self):

        localctx = Qasm2Parser.AssignmentStatementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 16, self.RULE_assignmentStatement)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 192
            self.quantumMeasurementAssignment()
            self.state = 193
            self.match(Qasm2Parser.SEMICOLON)
        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):
        __slots__ = 'parser'

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

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

        def classicalType(self):
            return self.getTypedRuleContext(Qasm2Parser.ClassicalTypeContext,0)


        def getRuleIndex(self):
            return Qasm2Parser.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 returnSignature(self):

        localctx = Qasm2Parser.ReturnSignatureContext(self, self._ctx, self.state)
        self.enterRule(localctx, 18, self.RULE_returnSignature)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 195
            self.match(Qasm2Parser.ARROW)
            self.state = 196
            self.classicalType()
        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):
        __slots__ = 'parser'

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

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

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


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

        def getRuleIndex(self):
            return Qasm2Parser.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 designator(self):

        localctx = Qasm2Parser.DesignatorContext(self, self._ctx, self.state)
        self.enterRule(localctx, 20, self.RULE_designator)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 198
            self.match(Qasm2Parser.LBRACKET)
            self.state = 199
            self.expression(0)
            self.state = 200
            self.match(Qasm2Parser.RBRACKET)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class DoubleDesignatorContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

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


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

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

        def getRuleIndex(self):
            return Qasm2Parser.RULE_doubleDesignator

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

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




    def doubleDesignator(self):

        localctx = Qasm2Parser.DoubleDesignatorContext(self, self._ctx, self.state)
        self.enterRule(localctx, 22, self.RULE_doubleDesignator)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 202
            self.match(Qasm2Parser.LBRACKET)
            self.state = 203
            self.expression(0)
            self.state = 204
            self.match(Qasm2Parser.COMMA)
            self.state = 205
            self.expression(0)
            self.state = 206
            self.match(Qasm2Parser.RBRACKET)
        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):
        __slots__ = 'parser'

        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(Qasm2Parser.Identifier)
            else:
                return self.getToken(Qasm2Parser.Identifier, i)

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

        def getRuleIndex(self):
            return Qasm2Parser.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 identifierList(self):

        localctx = Qasm2Parser.IdentifierListContext(self, self._ctx, self.state)
        self.enterRule(localctx, 24, self.RULE_identifierList)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 212
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,7,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 208
                    self.match(Qasm2Parser.Identifier)
                    self.state = 209
                    self.match(Qasm2Parser.COMMA) 
                self.state = 214
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,7,self._ctx)

            self.state = 215
            self.match(Qasm2Parser.Identifier)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class QuantumDeclarationContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

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


        def getRuleIndex(self):
            return Qasm2Parser.RULE_quantumDeclaration

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

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




    def quantumDeclaration(self):

        localctx = Qasm2Parser.QuantumDeclarationContext(self, self._ctx, self.state)
        self.enterRule(localctx, 26, self.RULE_quantumDeclaration)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 217
            self.match(Qasm2Parser.T__2)
            self.state = 218
            self.match(Qasm2Parser.Identifier)
            self.state = 220
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==Qasm2Parser.LBRACKET:
                self.state = 219
                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 QuantumArgumentContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

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


        def getRuleIndex(self):
            return Qasm2Parser.RULE_quantumArgument

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

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




    def quantumArgument(self):

        localctx = Qasm2Parser.QuantumArgumentContext(self, self._ctx, self.state)
        self.enterRule(localctx, 28, self.RULE_quantumArgument)
        self._la = 0 # Token type
        try:
            self.state = 232
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [Qasm2Parser.T__2]:
                self.enterOuterAlt(localctx, 1)
                self.state = 222
                self.match(Qasm2Parser.T__2)
                self.state = 223
                self.match(Qasm2Parser.Identifier)
                self.state = 225
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==Qasm2Parser.LBRACKET:
                    self.state = 224
                    self.designator()


                pass
            elif token in [Qasm2Parser.T__3]:
                self.enterOuterAlt(localctx, 2)
                self.state = 227
                self.match(Qasm2Parser.T__3)
                self.state = 229
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==Qasm2Parser.LBRACKET:
                    self.state = 228
                    self.designator()


                self.state = 231
                self.match(Qasm2Parser.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 QuantumArgumentListContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def quantumArgument(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(Qasm2Parser.QuantumArgumentContext)
            else:
                return self.getTypedRuleContext(Qasm2Parser.QuantumArgumentContext,i)


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

        def getRuleIndex(self):
            return Qasm2Parser.RULE_quantumArgumentList

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

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




    def quantumArgumentList(self):

        localctx = Qasm2Parser.QuantumArgumentListContext(self, self._ctx, self.state)
        self.enterRule(localctx, 30, self.RULE_quantumArgumentList)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 239
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,12,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 234
                    self.quantumArgument()
                    self.state = 235
                    self.match(Qasm2Parser.COMMA) 
                self.state = 241
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,12,self._ctx)

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


    class BitTypeContext(ParserRuleContext):
        __slots__ = 'parser'

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


        def getRuleIndex(self):
            return Qasm2Parser.RULE_bitType

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

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




    def bitType(self):

        localctx = Qasm2Parser.BitTypeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 32, self.RULE_bitType)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 244
            _la = self._input.LA(1)
            if not(_la==Qasm2Parser.T__4 or _la==Qasm2Parser.T__5):
                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 SingleDesignatorTypeContext(ParserRuleContext):
        __slots__ = 'parser'

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


        def getRuleIndex(self):
            return Qasm2Parser.RULE_singleDesignatorType

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

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




    def singleDesignatorType(self):

        localctx = Qasm2Parser.SingleDesignatorTypeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 34, self.RULE_singleDesignatorType)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 246
            _la = self._input.LA(1)
            if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << Qasm2Parser.T__6) | (1 << Qasm2Parser.T__7) | (1 << Qasm2Parser.T__8) | (1 << Qasm2Parser.T__9))) != 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 DoubleDesignatorTypeContext(ParserRuleContext):
        __slots__ = 'parser'

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


        def getRuleIndex(self):
            return Qasm2Parser.RULE_doubleDesignatorType

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

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




    def doubleDesignatorType(self):

        localctx = Qasm2Parser.DoubleDesignatorTypeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 36, self.RULE_doubleDesignatorType)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 248
            self.match(Qasm2Parser.T__10)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class NoDesignatorTypeContext(ParserRuleContext):
        __slots__ = 'parser'

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


        def getRuleIndex(self):
            return Qasm2Parser.RULE_noDesignatorType

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

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




    def noDesignatorType(self):

        localctx = Qasm2Parser.NoDesignatorTypeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 38, self.RULE_noDesignatorType)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 250
            self.match(Qasm2Parser.T__11)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ClassicalTypeContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def singleDesignatorType(self):
            return self.getTypedRuleContext(Qasm2Parser.SingleDesignatorTypeContext,0)


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


        def doubleDesignatorType(self):
            return self.getTypedRuleContext(Qasm2Parser.DoubleDesignatorTypeContext,0)


        def doubleDesignator(self):
            return self.getTypedRuleContext(Qasm2Parser.DoubleDesignatorContext,0)


        def noDesignatorType(self):
            return self.getTypedRuleContext(Qasm2Parser.NoDesignatorTypeContext,0)


        def bitType(self):
            return self.getTypedRuleContext(Qasm2Parser.BitTypeContext,0)


        def getRuleIndex(self):
            return Qasm2Parser.RULE_classicalType

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

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




    def classicalType(self):

        localctx = Qasm2Parser.ClassicalTypeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 40, self.RULE_classicalType)
        self._la = 0 # Token type
        try:
            self.state = 263
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [Qasm2Parser.T__6, Qasm2Parser.T__7, Qasm2Parser.T__8, Qasm2Parser.T__9]:
                self.enterOuterAlt(localctx, 1)
                self.state = 252
                self.singleDesignatorType()
                self.state = 253
                self.designator()
                pass
            elif token in [Qasm2Parser.T__10]:
                self.enterOuterAlt(localctx, 2)
                self.state = 255
                self.doubleDesignatorType()
                self.state = 256
                self.doubleDesignator()
                pass
            elif token in [Qasm2Parser.T__11]:
                self.enterOuterAlt(localctx, 3)
                self.state = 258
                self.noDesignatorType()
                pass
            elif token in [Qasm2Parser.T__4, Qasm2Parser.T__5]:
                self.enterOuterAlt(localctx, 4)
                self.state = 259
                self.bitType()
                self.state = 261
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==Qasm2Parser.LBRACKET:
                    self.state = 260
                    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 ConstantDeclarationContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

        def equalsExpression(self):
            return self.getTypedRuleContext(Qasm2Parser.EqualsExpressionContext,0)


        def getRuleIndex(self):
            return Qasm2Parser.RULE_constantDeclaration

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

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




    def constantDeclaration(self):

        localctx = Qasm2Parser.ConstantDeclarationContext(self, self._ctx, self.state)
        self.enterRule(localctx, 42, self.RULE_constantDeclaration)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 265
            self.match(Qasm2Parser.T__12)
            self.state = 266
            self.match(Qasm2Parser.Identifier)
            self.state = 268
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==Qasm2Parser.EQUALS:
                self.state = 267
                self.equalsExpression()


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


    class SingleDesignatorDeclarationContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def singleDesignatorType(self):
            return self.getTypedRuleContext(Qasm2Parser.SingleDesignatorTypeContext,0)


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


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

        def equalsExpression(self):
            return self.getTypedRuleContext(Qasm2Parser.EqualsExpressionContext,0)


        def getRuleIndex(self):
            return Qasm2Parser.RULE_singleDesignatorDeclaration

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

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




    def singleDesignatorDeclaration(self):

        localctx = Qasm2Parser.SingleDesignatorDeclarationContext(self, self._ctx, self.state)
        self.enterRule(localctx, 44, self.RULE_singleDesignatorDeclaration)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 270
            self.singleDesignatorType()
            self.state = 271
            self.designator()
            self.state = 272
            self.match(Qasm2Parser.Identifier)
            self.state = 274
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==Qasm2Parser.EQUALS:
                self.state = 273
                self.equalsExpression()


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


    class DoubleDesignatorDeclarationContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def doubleDesignatorType(self):
            return self.getTypedRuleContext(Qasm2Parser.DoubleDesignatorTypeContext,0)


        def doubleDesignator(self):
            return self.getTypedRuleContext(Qasm2Parser.DoubleDesignatorContext,0)


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

        def equalsExpression(self):
            return self.getTypedRuleContext(Qasm2Parser.EqualsExpressionContext,0)


        def getRuleIndex(self):
            return Qasm2Parser.RULE_doubleDesignatorDeclaration

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

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




    def doubleDesignatorDeclaration(self):

        localctx = Qasm2Parser.DoubleDesignatorDeclarationContext(self, self._ctx, self.state)
        self.enterRule(localctx, 46, self.RULE_doubleDesignatorDeclaration)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 276
            self.doubleDesignatorType()
            self.state = 277
            self.doubleDesignator()
            self.state = 278
            self.match(Qasm2Parser.Identifier)
            self.state = 280
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==Qasm2Parser.EQUALS:
                self.state = 279
                self.equalsExpression()


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


    class NoDesignatorDeclarationContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def noDesignatorType(self):
            return self.getTypedRuleContext(Qasm2Parser.NoDesignatorTypeContext,0)


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

        def equalsExpression(self):
            return self.getTypedRuleContext(Qasm2Parser.EqualsExpressionContext,0)


        def getRuleIndex(self):
            return Qasm2Parser.RULE_noDesignatorDeclaration

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

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




    def noDesignatorDeclaration(self):

        localctx = Qasm2Parser.NoDesignatorDeclarationContext(self, self._ctx, self.state)
        self.enterRule(localctx, 48, self.RULE_noDesignatorDeclaration)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 282
            self.noDesignatorType()
            self.state = 283
            self.match(Qasm2Parser.Identifier)
            self.state = 285
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==Qasm2Parser.EQUALS:
                self.state = 284
                self.equalsExpression()


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


    class BitDeclarationContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

        def equalsExpression(self):
            return self.getTypedRuleContext(Qasm2Parser.EqualsExpressionContext,0)


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


        def getRuleIndex(self):
            return Qasm2Parser.RULE_bitDeclaration

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

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




    def bitDeclaration(self):

        localctx = Qasm2Parser.BitDeclarationContext(self, self._ctx, self.state)
        self.enterRule(localctx, 50, self.RULE_bitDeclaration)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 297
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [Qasm2Parser.T__5]:
                self.state = 287
                self.match(Qasm2Parser.T__5)
                self.state = 288
                self.match(Qasm2Parser.Identifier)
                self.state = 290
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==Qasm2Parser.LBRACKET:
                    self.state = 289
                    self.designator()


                pass
            elif token in [Qasm2Parser.T__4]:
                self.state = 292
                self.match(Qasm2Parser.T__4)
                self.state = 294
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==Qasm2Parser.LBRACKET:
                    self.state = 293
                    self.designator()


                self.state = 296
                self.match(Qasm2Parser.Identifier)
                pass
            else:
                raise NoViableAltException(self)

            self.state = 300
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==Qasm2Parser.EQUALS:
                self.state = 299
                self.equalsExpression()


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


    class ClassicalDeclarationContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def singleDesignatorDeclaration(self):
            return self.getTypedRuleContext(Qasm2Parser.SingleDesignatorDeclarationContext,0)


        def doubleDesignatorDeclaration(self):
            return self.getTypedRuleContext(Qasm2Parser.DoubleDesignatorDeclarationContext,0)


        def noDesignatorDeclaration(self):
            return self.getTypedRuleContext(Qasm2Parser.NoDesignatorDeclarationContext,0)


        def bitDeclaration(self):
            return self.getTypedRuleContext(Qasm2Parser.BitDeclarationContext,0)


        def getRuleIndex(self):
            return Qasm2Parser.RULE_classicalDeclaration

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

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




    def classicalDeclaration(self):

        localctx = Qasm2Parser.ClassicalDeclarationContext(self, self._ctx, self.state)
        self.enterRule(localctx, 52, self.RULE_classicalDeclaration)
        try:
            self.state = 306
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [Qasm2Parser.T__6, Qasm2Parser.T__7, Qasm2Parser.T__8, Qasm2Parser.T__9]:
                self.enterOuterAlt(localctx, 1)
                self.state = 302
                self.singleDesignatorDeclaration()
                pass
            elif token in [Qasm2Parser.T__10]:
                self.enterOuterAlt(localctx, 2)
                self.state = 303
                self.doubleDesignatorDeclaration()
                pass
            elif token in [Qasm2Parser.T__11]:
                self.enterOuterAlt(localctx, 3)
                self.state = 304
                self.noDesignatorDeclaration()
                pass
            elif token in [Qasm2Parser.T__4, Qasm2Parser.T__5]:
                self.enterOuterAlt(localctx, 4)
                self.state = 305
                self.bitDeclaration()
                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 ClassicalTypeListContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def classicalType(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(Qasm2Parser.ClassicalTypeContext)
            else:
                return self.getTypedRuleContext(Qasm2Parser.ClassicalTypeContext,i)


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

        def getRuleIndex(self):
            return Qasm2Parser.RULE_classicalTypeList

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

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




    def classicalTypeList(self):

        localctx = Qasm2Parser.ClassicalTypeListContext(self, self._ctx, self.state)
        self.enterRule(localctx, 54, self.RULE_classicalTypeList)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 313
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,24,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 308
                    self.classicalType()
                    self.state = 309
                    self.match(Qasm2Parser.COMMA) 
                self.state = 315
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,24,self._ctx)

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


    class ClassicalArgumentContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

        def singleDesignatorType(self):
            return self.getTypedRuleContext(Qasm2Parser.SingleDesignatorTypeContext,0)


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


        def doubleDesignatorType(self):
            return self.getTypedRuleContext(Qasm2Parser.DoubleDesignatorTypeContext,0)


        def doubleDesignator(self):
            return self.getTypedRuleContext(Qasm2Parser.DoubleDesignatorContext,0)


        def noDesignatorType(self):
            return self.getTypedRuleContext(Qasm2Parser.NoDesignatorTypeContext,0)


        def getRuleIndex(self):
            return Qasm2Parser.RULE_classicalArgument

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

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




    def classicalArgument(self):

        localctx = Qasm2Parser.ClassicalArgumentContext(self, self._ctx, self.state)
        self.enterRule(localctx, 56, self.RULE_classicalArgument)
        self._la = 0 # Token type
        try:
            self.state = 339
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [Qasm2Parser.T__6, Qasm2Parser.T__7, Qasm2Parser.T__8, Qasm2Parser.T__9, Qasm2Parser.T__10, Qasm2Parser.T__11]:
                self.enterOuterAlt(localctx, 1)
                self.state = 325
                self._errHandler.sync(self)
                token = self._input.LA(1)
                if token in [Qasm2Parser.T__6, Qasm2Parser.T__7, Qasm2Parser.T__8, Qasm2Parser.T__9]:
                    self.state = 318
                    self.singleDesignatorType()
                    self.state = 319
                    self.designator()
                    pass
                elif token in [Qasm2Parser.T__10]:
                    self.state = 321
                    self.doubleDesignatorType()
                    self.state = 322
                    self.doubleDesignator()
                    pass
                elif token in [Qasm2Parser.T__11]:
                    self.state = 324
                    self.noDesignatorType()
                    pass
                else:
                    raise NoViableAltException(self)

                self.state = 327
                self.match(Qasm2Parser.Identifier)
                pass
            elif token in [Qasm2Parser.T__5]:
                self.enterOuterAlt(localctx, 2)
                self.state = 329
                self.match(Qasm2Parser.T__5)
                self.state = 330
                self.match(Qasm2Parser.Identifier)
                self.state = 332
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==Qasm2Parser.LBRACKET:
                    self.state = 331
                    self.designator()


                pass
            elif token in [Qasm2Parser.T__4]:
                self.enterOuterAlt(localctx, 3)
                self.state = 334
                self.match(Qasm2Parser.T__4)
                self.state = 336
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==Qasm2Parser.LBRACKET:
                    self.state = 335
                    self.designator()


                self.state = 338
                self.match(Qasm2Parser.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 ClassicalArgumentListContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def classicalArgument(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(Qasm2Parser.ClassicalArgumentContext)
            else:
                return self.getTypedRuleContext(Qasm2Parser.ClassicalArgumentContext,i)


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

        def getRuleIndex(self):
            return Qasm2Parser.RULE_classicalArgumentList

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

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




    def classicalArgumentList(self):

        localctx = Qasm2Parser.ClassicalArgumentListContext(self, self._ctx, self.state)
        self.enterRule(localctx, 58, self.RULE_classicalArgumentList)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 346
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,29,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 341
                    self.classicalArgument()
                    self.state = 342
                    self.match(Qasm2Parser.COMMA) 
                self.state = 348
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,29,self._ctx)

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


    class IndexIdentifierContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

        def rangeDefinition(self):
            return self.getTypedRuleContext(Qasm2Parser.RangeDefinitionContext,0)


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

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


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

        def indexIdentifier(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(Qasm2Parser.IndexIdentifierContext)
            else:
                return self.getTypedRuleContext(Qasm2Parser.IndexIdentifierContext,i)


        def getRuleIndex(self):
            return Qasm2Parser.RULE_indexIdentifier

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

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



    def indexIdentifier(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = Qasm2Parser.IndexIdentifierContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 60
        self.enterRecursionRule(localctx, 60, self.RULE_indexIdentifier, _p)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 361
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,31,self._ctx)
            if la_ == 1:
                self.state = 352
                self.match(Qasm2Parser.Identifier)
                self.state = 353
                self.rangeDefinition()
                pass

            elif la_ == 2:
                self.state = 354
                self.match(Qasm2Parser.Identifier)
                self.state = 359
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,30,self._ctx)
                if la_ == 1:
                    self.state = 355
                    self.match(Qasm2Parser.LBRACKET)
                    self.state = 356
                    self.expressionList()
                    self.state = 357
                    self.match(Qasm2Parser.RBRACKET)


                pass


            self._ctx.stop = self._input.LT(-1)
            self.state = 368
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,32,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    localctx = Qasm2Parser.IndexIdentifierContext(self, _parentctx, _parentState)
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_indexIdentifier)
                    self.state = 363
                    if not self.precpred(self._ctx, 1):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 1)")
                    self.state = 364
                    self.match(Qasm2Parser.T__13)
                    self.state = 365
                    self.indexIdentifier(2) 
                self.state = 370
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,32,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 IndexIdentifierListContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def indexIdentifier(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(Qasm2Parser.IndexIdentifierContext)
            else:
                return self.getTypedRuleContext(Qasm2Parser.IndexIdentifierContext,i)


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

        def getRuleIndex(self):
            return Qasm2Parser.RULE_indexIdentifierList

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

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




    def indexIdentifierList(self):

        localctx = Qasm2Parser.IndexIdentifierListContext(self, self._ctx, self.state)
        self.enterRule(localctx, 62, self.RULE_indexIdentifierList)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 376
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,33,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 371
                    self.indexIdentifier(0)
                    self.state = 372
                    self.match(Qasm2Parser.COMMA) 
                self.state = 378
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,33,self._ctx)

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


    class RangeDefinitionContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

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

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

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


        def getRuleIndex(self):
            return Qasm2Parser.RULE_rangeDefinition

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

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




    def rangeDefinition(self):

        localctx = Qasm2Parser.RangeDefinitionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 64, self.RULE_rangeDefinition)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 381
            self.match(Qasm2Parser.LBRACKET)
            self.state = 383
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << Qasm2Parser.T__29) | (1 << Qasm2Parser.T__30) | (1 << Qasm2Parser.T__43) | (1 << Qasm2Parser.T__44))) != 0) or ((((_la - 74)) & ~0x3f) == 0 and ((1 << (_la - 74)) & ((1 << (Qasm2Parser.LPAREN - 74)) | (1 << (Qasm2Parser.MINUS - 74)) | (1 << (Qasm2Parser.Constant - 74)) | (1 << (Qasm2Parser.Integer - 74)) | (1 << (Qasm2Parser.Identifier - 74)) | (1 << (Qasm2Parser.RealNumber - 74)) | (1 << (Qasm2Parser.StringLiteral - 74)))) != 0):
                self.state = 382
                self.expression(0)


            self.state = 385
            self.match(Qasm2Parser.COLON)
            self.state = 387
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << Qasm2Parser.T__29) | (1 << Qasm2Parser.T__30) | (1 << Qasm2Parser.T__43) | (1 << Qasm2Parser.T__44))) != 0) or ((((_la - 74)) & ~0x3f) == 0 and ((1 << (_la - 74)) & ((1 << (Qasm2Parser.LPAREN - 74)) | (1 << (Qasm2Parser.MINUS - 74)) | (1 << (Qasm2Parser.Constant - 74)) | (1 << (Qasm2Parser.Integer - 74)) | (1 << (Qasm2Parser.Identifier - 74)) | (1 << (Qasm2Parser.RealNumber - 74)) | (1 << (Qasm2Parser.StringLiteral - 74)))) != 0):
                self.state = 386
                self.expression(0)


            self.state = 391
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==Qasm2Parser.COLON:
                self.state = 389
                self.match(Qasm2Parser.COLON)
                self.state = 390
                self.expression(0)


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


    class QuantumGateDefinitionContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def quantumGateSignature(self):
            return self.getTypedRuleContext(Qasm2Parser.QuantumGateSignatureContext,0)


        def quantumBlock(self):
            return self.getTypedRuleContext(Qasm2Parser.QuantumBlockContext,0)


        def getRuleIndex(self):
            return Qasm2Parser.RULE_quantumGateDefinition

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

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




    def quantumGateDefinition(self):

        localctx = Qasm2Parser.QuantumGateDefinitionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 66, self.RULE_quantumGateDefinition)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 395
            self.match(Qasm2Parser.T__14)
            self.state = 396
            self.quantumGateSignature()
            self.state = 397
            self.quantumBlock()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class QuantumGateSignatureContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

        def identifierList(self):
            return self.getTypedRuleContext(Qasm2Parser.IdentifierListContext,0)


        def quantumGateParameter(self):
            return self.getTypedRuleContext(Qasm2Parser.QuantumGateParameterContext,0)


        def getRuleIndex(self):
            return Qasm2Parser.RULE_quantumGateSignature

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

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




    def quantumGateSignature(self):

        localctx = Qasm2Parser.QuantumGateSignatureContext(self, self._ctx, self.state)
        self.enterRule(localctx, 68, self.RULE_quantumGateSignature)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 399
            self.match(Qasm2Parser.Identifier)
            self.state = 401
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==Qasm2Parser.LPAREN:
                self.state = 400
                self.quantumGateParameter()


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


    class QuantumGateParameterContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

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

        def identifierList(self):
            return self.getTypedRuleContext(Qasm2Parser.IdentifierListContext,0)


        def getRuleIndex(self):
            return Qasm2Parser.RULE_quantumGateParameter

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

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




    def quantumGateParameter(self):

        localctx = Qasm2Parser.QuantumGateParameterContext(self, self._ctx, self.state)
        self.enterRule(localctx, 70, self.RULE_quantumGateParameter)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 405
            self.match(Qasm2Parser.LPAREN)
            self.state = 407
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==Qasm2Parser.Identifier:
                self.state = 406
                self.identifierList()


            self.state = 409
            self.match(Qasm2Parser.RPAREN)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class QuantumGateNameContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

        def getRuleIndex(self):
            return Qasm2Parser.RULE_quantumGateName

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

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




    def quantumGateName(self):

        localctx = Qasm2Parser.QuantumGateNameContext(self, self._ctx, self.state)
        self.enterRule(localctx, 72, self.RULE_quantumGateName)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 411
            _la = self._input.LA(1)
            if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << Qasm2Parser.T__15) | (1 << Qasm2Parser.T__16) | (1 << Qasm2Parser.T__17) | (1 << Qasm2Parser.T__18) | (1 << Qasm2Parser.T__19) | (1 << Qasm2Parser.T__20) | (1 << Qasm2Parser.T__21) | (1 << Qasm2Parser.T__22) | (1 << Qasm2Parser.T__23) | (1 << Qasm2Parser.T__24) | (1 << Qasm2Parser.T__25) | (1 << Qasm2Parser.T__26))) != 0) or _la==Qasm2Parser.Identifier):
                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 QuantumBlockContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

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

        def quantumStatement(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(Qasm2Parser.QuantumStatementContext)
            else:
                return self.getTypedRuleContext(Qasm2Parser.QuantumStatementContext,i)


        def getRuleIndex(self):
            return Qasm2Parser.RULE_quantumBlock

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

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




    def quantumBlock(self):

        localctx = Qasm2Parser.QuantumBlockContext(self, self._ctx, self.state)
        self.enterRule(localctx, 74, self.RULE_quantumBlock)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 413
            self.match(Qasm2Parser.LBRACE)
            self.state = 417
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << Qasm2Parser.T__15) | (1 << Qasm2Parser.T__16) | (1 << Qasm2Parser.T__17) | (1 << Qasm2Parser.T__18) | (1 << Qasm2Parser.T__19) | (1 << Qasm2Parser.T__20) | (1 << Qasm2Parser.T__21) | (1 << Qasm2Parser.T__22) | (1 << Qasm2Parser.T__23) | (1 << Qasm2Parser.T__24) | (1 << Qasm2Parser.T__25) | (1 << Qasm2Parser.T__26) | (1 << Qasm2Parser.T__27) | (1 << Qasm2Parser.T__28))) != 0) or _la==Qasm2Parser.Identifier:
                self.state = 414
                self.quantumStatement()
                self.state = 419
                self._errHandler.sync(self)
                _la = self._input.LA(1)

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


    class QuantumLoopBlockContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def quantumStatement(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(Qasm2Parser.QuantumStatementContext)
            else:
                return self.getTypedRuleContext(Qasm2Parser.QuantumStatementContext,i)


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

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

        def getRuleIndex(self):
            return Qasm2Parser.RULE_quantumLoopBlock

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

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




    def quantumLoopBlock(self):

        localctx = Qasm2Parser.QuantumLoopBlockContext(self, self._ctx, self.state)
        self.enterRule(localctx, 76, self.RULE_quantumLoopBlock)
        self._la = 0 # Token type
        try:
            self.state = 431
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [Qasm2Parser.T__15, Qasm2Parser.T__16, Qasm2Parser.T__17, Qasm2Parser.T__18, Qasm2Parser.T__19, Qasm2Parser.T__20, Qasm2Parser.T__21, Qasm2Parser.T__22, Qasm2Parser.T__23, Qasm2Parser.T__24, Qasm2Parser.T__25, Qasm2Parser.T__26, Qasm2Parser.T__27, Qasm2Parser.T__28, Qasm2Parser.Identifier]:
                self.enterOuterAlt(localctx, 1)
                self.state = 422
                self.quantumStatement()
                pass
            elif token in [Qasm2Parser.LBRACE]:
                self.enterOuterAlt(localctx, 2)
                self.state = 423
                self.match(Qasm2Parser.LBRACE)
                self.state = 427
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << Qasm2Parser.T__15) | (1 << Qasm2Parser.T__16) | (1 << Qasm2Parser.T__17) | (1 << Qasm2Parser.T__18) | (1 << Qasm2Parser.T__19) | (1 << Qasm2Parser.T__20) | (1 << Qasm2Parser.T__21) | (1 << Qasm2Parser.T__22) | (1 << Qasm2Parser.T__23) | (1 << Qasm2Parser.T__24) | (1 << Qasm2Parser.T__25) | (1 << Qasm2Parser.T__26) | (1 << Qasm2Parser.T__27) | (1 << Qasm2Parser.T__28))) != 0) or _la==Qasm2Parser.Identifier:
                    self.state = 424
                    self.quantumStatement()
                    self.state = 429
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

                self.state = 430
                self.match(Qasm2Parser.RBRACE)
                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 QuantumStatementContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def quantumInstruction(self):
            return self.getTypedRuleContext(Qasm2Parser.QuantumInstructionContext,0)


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

        def getRuleIndex(self):
            return Qasm2Parser.RULE_quantumStatement

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

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




    def quantumStatement(self):

        localctx = Qasm2Parser.QuantumStatementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 78, self.RULE_quantumStatement)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 433
            self.quantumInstruction()
            self.state = 434
            self.match(Qasm2Parser.SEMICOLON)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class QuantumInstructionContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def quantumGateCall(self):
            return self.getTypedRuleContext(Qasm2Parser.QuantumGateCallContext,0)


        def quantumMeasurement(self):
            return self.getTypedRuleContext(Qasm2Parser.QuantumMeasurementContext,0)


        def quantumBarrier(self):
            return self.getTypedRuleContext(Qasm2Parser.QuantumBarrierContext,0)


        def getRuleIndex(self):
            return Qasm2Parser.RULE_quantumInstruction

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

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




    def quantumInstruction(self):

        localctx = Qasm2Parser.QuantumInstructionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 80, self.RULE_quantumInstruction)
        try:
            self.state = 439
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [Qasm2Parser.T__15, Qasm2Parser.T__16, Qasm2Parser.T__17, Qasm2Parser.T__18, Qasm2Parser.T__19, Qasm2Parser.T__20, Qasm2Parser.T__21, Qasm2Parser.T__22, Qasm2Parser.T__23, Qasm2Parser.T__24, Qasm2Parser.T__25, Qasm2Parser.T__26, Qasm2Parser.Identifier]:
                self.enterOuterAlt(localctx, 1)
                self.state = 436
                self.quantumGateCall()
                pass
            elif token in [Qasm2Parser.T__27]:
                self.enterOuterAlt(localctx, 2)
                self.state = 437
                self.quantumMeasurement()
                pass
            elif token in [Qasm2Parser.T__28]:
                self.enterOuterAlt(localctx, 3)
                self.state = 438
                self.quantumBarrier()
                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 QuantumMeasurementContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def indexIdentifierList(self):
            return self.getTypedRuleContext(Qasm2Parser.IndexIdentifierListContext,0)


        def getRuleIndex(self):
            return Qasm2Parser.RULE_quantumMeasurement

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

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




    def quantumMeasurement(self):

        localctx = Qasm2Parser.QuantumMeasurementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 82, self.RULE_quantumMeasurement)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 441
            self.match(Qasm2Parser.T__27)
            self.state = 442
            self.indexIdentifierList()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class QuantumMeasurementAssignmentContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def quantumMeasurement(self):
            return self.getTypedRuleContext(Qasm2Parser.QuantumMeasurementContext,0)


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

        def indexIdentifierList(self):
            return self.getTypedRuleContext(Qasm2Parser.IndexIdentifierListContext,0)


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

        def getRuleIndex(self):
            return Qasm2Parser.RULE_quantumMeasurementAssignment

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

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




    def quantumMeasurementAssignment(self):

        localctx = Qasm2Parser.QuantumMeasurementAssignmentContext(self, self._ctx, self.state)
        self.enterRule(localctx, 84, self.RULE_quantumMeasurementAssignment)
        self._la = 0 # Token type
        try:
            self.state = 453
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [Qasm2Parser.T__27]:
                self.enterOuterAlt(localctx, 1)
                self.state = 444
                self.quantumMeasurement()
                self.state = 447
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==Qasm2Parser.ARROW:
                    self.state = 445
                    self.match(Qasm2Parser.ARROW)
                    self.state = 446
                    self.indexIdentifierList()


                pass
            elif token in [Qasm2Parser.Identifier]:
                self.enterOuterAlt(localctx, 2)
                self.state = 449
                self.indexIdentifierList()
                self.state = 450
                self.match(Qasm2Parser.EQUALS)
                self.state = 451
                self.quantumMeasurement()
                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 QuantumBarrierContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def indexIdentifierList(self):
            return self.getTypedRuleContext(Qasm2Parser.IndexIdentifierListContext,0)


        def getRuleIndex(self):
            return Qasm2Parser.RULE_quantumBarrier

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

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




    def quantumBarrier(self):

        localctx = Qasm2Parser.QuantumBarrierContext(self, self._ctx, self.state)
        self.enterRule(localctx, 86, self.RULE_quantumBarrier)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 455
            self.match(Qasm2Parser.T__28)
            self.state = 456
            self.indexIdentifierList()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class QuantumGateCallContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def quantumGateName(self):
            return self.getTypedRuleContext(Qasm2Parser.QuantumGateNameContext,0)


        def indexIdentifierList(self):
            return self.getTypedRuleContext(Qasm2Parser.IndexIdentifierListContext,0)


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

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

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


        def getRuleIndex(self):
            return Qasm2Parser.RULE_quantumGateCall

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

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




    def quantumGateCall(self):

        localctx = Qasm2Parser.QuantumGateCallContext(self, self._ctx, self.state)
        self.enterRule(localctx, 88, self.RULE_quantumGateCall)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 458
            self.quantumGateName()
            self.state = 464
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==Qasm2Parser.LPAREN:
                self.state = 459
                self.match(Qasm2Parser.LPAREN)
                self.state = 461
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << Qasm2Parser.T__29) | (1 << Qasm2Parser.T__30) | (1 << Qasm2Parser.T__43) | (1 << Qasm2Parser.T__44))) != 0) or ((((_la - 74)) & ~0x3f) == 0 and ((1 << (_la - 74)) & ((1 << (Qasm2Parser.LPAREN - 74)) | (1 << (Qasm2Parser.MINUS - 74)) | (1 << (Qasm2Parser.Constant - 74)) | (1 << (Qasm2Parser.Integer - 74)) | (1 << (Qasm2Parser.Identifier - 74)) | (1 << (Qasm2Parser.RealNumber - 74)) | (1 << (Qasm2Parser.StringLiteral - 74)))) != 0):
                    self.state = 460
                    self.expressionList()


                self.state = 463
                self.match(Qasm2Parser.RPAREN)


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


    class UnaryOperatorContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def MINUS(self):
            return self.getToken(Qasm2Parser.MINUS, 0)

        def getRuleIndex(self):
            return Qasm2Parser.RULE_unaryOperator

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

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




    def unaryOperator(self):

        localctx = Qasm2Parser.UnaryOperatorContext(self, self._ctx, self.state)
        self.enterRule(localctx, 90, self.RULE_unaryOperator)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 468
            _la = self._input.LA(1)
            if not(((((_la - 30)) & ~0x3f) == 0 and ((1 << (_la - 30)) & ((1 << (Qasm2Parser.T__29 - 30)) | (1 << (Qasm2Parser.T__30 - 30)) | (1 << (Qasm2Parser.MINUS - 30)))) != 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 ComparisonOperatorContext(ParserRuleContext):
        __slots__ = 'parser'

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


        def getRuleIndex(self):
            return Qasm2Parser.RULE_comparisonOperator

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

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




    def comparisonOperator(self):

        localctx = Qasm2Parser.ComparisonOperatorContext(self, self._ctx, self.state)
        self.enterRule(localctx, 92, self.RULE_comparisonOperator)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 470
            _la = self._input.LA(1)
            if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << Qasm2Parser.T__31) | (1 << Qasm2Parser.T__32) | (1 << Qasm2Parser.T__33) | (1 << Qasm2Parser.T__34))) != 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 EqualityOperatorContext(ParserRuleContext):
        __slots__ = 'parser'

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


        def getRuleIndex(self):
            return Qasm2Parser.RULE_equalityOperator

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

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




    def equalityOperator(self):

        localctx = Qasm2Parser.EqualityOperatorContext(self, self._ctx, self.state)
        self.enterRule(localctx, 94, self.RULE_equalityOperator)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 472
            _la = self._input.LA(1)
            if not(_la==Qasm2Parser.T__35 or _la==Qasm2Parser.T__36):
                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 LogicalOperatorContext(ParserRuleContext):
        __slots__ = 'parser'

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


        def getRuleIndex(self):
            return Qasm2Parser.RULE_logicalOperator

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

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




    def logicalOperator(self):

        localctx = Qasm2Parser.LogicalOperatorContext(self, self._ctx, self.state)
        self.enterRule(localctx, 96, self.RULE_logicalOperator)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 474
            _la = self._input.LA(1)
            if not(_la==Qasm2Parser.T__13 or _la==Qasm2Parser.T__37):
                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 ExpressionStatementContext(ParserRuleContext):
        __slots__ = 'parser'

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

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


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

        def getRuleIndex(self):
            return Qasm2Parser.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 expressionStatement(self):

        localctx = Qasm2Parser.ExpressionStatementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 98, self.RULE_expressionStatement)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 476
            self.expression(0)
            self.state = 477
            self.match(Qasm2Parser.SEMICOLON)
        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):
        __slots__ = 'parser'

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

        def expressionTerminator(self):
            return self.getTypedRuleContext(Qasm2Parser.ExpressionTerminatorContext,0)


        def unaryExpression(self):
            return self.getTypedRuleContext(Qasm2Parser.UnaryExpressionContext,0)


        def logicalAndExpression(self):
            return self.getTypedRuleContext(Qasm2Parser.LogicalAndExpressionContext,0)


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


        def getRuleIndex(self):
            return Qasm2Parser.RULE_expression

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

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



    def expression(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = Qasm2Parser.ExpressionContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 100
        self.enterRecursionRule(localctx, 100, self.RULE_expression, _p)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 483
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,47,self._ctx)
            if la_ == 1:
                self.state = 480
                self.expressionTerminator(0)
                pass

            elif la_ == 2:
                self.state = 481
                self.unaryExpression()
                pass

            elif la_ == 3:
                self.state = 482
                self.logicalAndExpression(0)
                pass


            self._ctx.stop = self._input.LT(-1)
            self.state = 490
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,48,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    localctx = Qasm2Parser.ExpressionContext(self, _parentctx, _parentState)
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_expression)
                    self.state = 485
                    if not self.precpred(self._ctx, 1):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 1)")
                    self.state = 486
                    self.match(Qasm2Parser.T__13)
                    self.state = 487
                    self.logicalAndExpression(0) 
                self.state = 492
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,48,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 LogicalAndExpressionContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def bitOrExpression(self):
            return self.getTypedRuleContext(Qasm2Parser.BitOrExpressionContext,0)


        def logicalAndExpression(self):
            return self.getTypedRuleContext(Qasm2Parser.LogicalAndExpressionContext,0)


        def getRuleIndex(self):
            return Qasm2Parser.RULE_logicalAndExpression

        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 logicalAndExpression(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = Qasm2Parser.LogicalAndExpressionContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 102
        self.enterRecursionRule(localctx, 102, self.RULE_logicalAndExpression, _p)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 494
            self.bitOrExpression(0)
            self._ctx.stop = self._input.LT(-1)
            self.state = 501
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,49,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    localctx = Qasm2Parser.LogicalAndExpressionContext(self, _parentctx, _parentState)
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_logicalAndExpression)
                    self.state = 496
                    if not self.precpred(self._ctx, 1):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 1)")
                    self.state = 497
                    self.match(Qasm2Parser.T__37)
                    self.state = 498
                    self.bitOrExpression(0) 
                self.state = 503
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,49,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 BitOrExpressionContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def xOrExpression(self):
            return self.getTypedRuleContext(Qasm2Parser.XOrExpressionContext,0)


        def bitOrExpression(self):
            return self.getTypedRuleContext(Qasm2Parser.BitOrExpressionContext,0)


        def getRuleIndex(self):
            return Qasm2Parser.RULE_bitOrExpression

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

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



    def bitOrExpression(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = Qasm2Parser.BitOrExpressionContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 104
        self.enterRecursionRule(localctx, 104, self.RULE_bitOrExpression, _p)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 505
            self.xOrExpression(0)
            self._ctx.stop = self._input.LT(-1)
            self.state = 512
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,50,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    localctx = Qasm2Parser.BitOrExpressionContext(self, _parentctx, _parentState)
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_bitOrExpression)
                    self.state = 507
                    if not self.precpred(self._ctx, 1):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 1)")
                    self.state = 508
                    self.match(Qasm2Parser.T__38)
                    self.state = 509
                    self.xOrExpression(0) 
                self.state = 514
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,50,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 XOrExpressionContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def bitAndExpression(self):
            return self.getTypedRuleContext(Qasm2Parser.BitAndExpressionContext,0)


        def xOrExpression(self):
            return self.getTypedRuleContext(Qasm2Parser.XOrExpressionContext,0)


        def getRuleIndex(self):
            return Qasm2Parser.RULE_xOrExpression

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

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



    def xOrExpression(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = Qasm2Parser.XOrExpressionContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 106
        self.enterRecursionRule(localctx, 106, self.RULE_xOrExpression, _p)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 516
            self.bitAndExpression(0)
            self._ctx.stop = self._input.LT(-1)
            self.state = 523
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,51,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    localctx = Qasm2Parser.XOrExpressionContext(self, _parentctx, _parentState)
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_xOrExpression)
                    self.state = 518
                    if not self.precpred(self._ctx, 1):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 1)")
                    self.state = 519
                    self.match(Qasm2Parser.T__39)
                    self.state = 520
                    self.bitAndExpression(0) 
                self.state = 525
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,51,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 BitAndExpressionContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def equalityExpression(self):
            return self.getTypedRuleContext(Qasm2Parser.EqualityExpressionContext,0)


        def bitAndExpression(self):
            return self.getTypedRuleContext(Qasm2Parser.BitAndExpressionContext,0)


        def getRuleIndex(self):
            return Qasm2Parser.RULE_bitAndExpression

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

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



    def bitAndExpression(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = Qasm2Parser.BitAndExpressionContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 108
        self.enterRecursionRule(localctx, 108, self.RULE_bitAndExpression, _p)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 527
            self.equalityExpression(0)
            self._ctx.stop = self._input.LT(-1)
            self.state = 534
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,52,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    localctx = Qasm2Parser.BitAndExpressionContext(self, _parentctx, _parentState)
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_bitAndExpression)
                    self.state = 529
                    if not self.precpred(self._ctx, 1):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 1)")
                    self.state = 530
                    self.match(Qasm2Parser.T__40)
                    self.state = 531
                    self.equalityExpression(0) 
                self.state = 536
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,52,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 EqualityExpressionContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def comparisonExpression(self):
            return self.getTypedRuleContext(Qasm2Parser.ComparisonExpressionContext,0)


        def equalityExpression(self):
            return self.getTypedRuleContext(Qasm2Parser.EqualityExpressionContext,0)


        def equalityOperator(self):
            return self.getTypedRuleContext(Qasm2Parser.EqualityOperatorContext,0)


        def getRuleIndex(self):
            return Qasm2Parser.RULE_equalityExpression

        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 equalityExpression(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = Qasm2Parser.EqualityExpressionContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 110
        self.enterRecursionRule(localctx, 110, self.RULE_equalityExpression, _p)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 538
            self.comparisonExpression(0)
            self._ctx.stop = self._input.LT(-1)
            self.state = 546
            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:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    localctx = Qasm2Parser.EqualityExpressionContext(self, _parentctx, _parentState)
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_equalityExpression)
                    self.state = 540
                    if not self.precpred(self._ctx, 1):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 1)")
                    self.state = 541
                    self.equalityOperator()
                    self.state = 542
                    self.comparisonExpression(0) 
                self.state = 548
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,53,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 ComparisonExpressionContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def bitShiftExpression(self):
            return self.getTypedRuleContext(Qasm2Parser.BitShiftExpressionContext,0)


        def comparisonExpression(self):
            return self.getTypedRuleContext(Qasm2Parser.ComparisonExpressionContext,0)


        def comparisonOperator(self):
            return self.getTypedRuleContext(Qasm2Parser.ComparisonOperatorContext,0)


        def getRuleIndex(self):
            return Qasm2Parser.RULE_comparisonExpression

        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 comparisonExpression(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = Qasm2Parser.ComparisonExpressionContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 112
        self.enterRecursionRule(localctx, 112, self.RULE_comparisonExpression, _p)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 550
            self.bitShiftExpression(0)
            self._ctx.stop = self._input.LT(-1)
            self.state = 558
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,54,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    localctx = Qasm2Parser.ComparisonExpressionContext(self, _parentctx, _parentState)
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_comparisonExpression)
                    self.state = 552
                    if not self.precpred(self._ctx, 1):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 1)")
                    self.state = 553
                    self.comparisonOperator()
                    self.state = 554
                    self.bitShiftExpression(0) 
                self.state = 560
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,54,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 BitShiftExpressionContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def additiveExpression(self):
            return self.getTypedRuleContext(Qasm2Parser.AdditiveExpressionContext,0)


        def bitShiftExpression(self):
            return self.getTypedRuleContext(Qasm2Parser.BitShiftExpressionContext,0)


        def getRuleIndex(self):
            return Qasm2Parser.RULE_bitShiftExpression

        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 bitShiftExpression(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = Qasm2Parser.BitShiftExpressionContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 114
        self.enterRecursionRule(localctx, 114, self.RULE_bitShiftExpression, _p)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 562
            self.additiveExpression(0)
            self._ctx.stop = self._input.LT(-1)
            self.state = 569
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,55,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    localctx = Qasm2Parser.BitShiftExpressionContext(self, _parentctx, _parentState)
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_bitShiftExpression)
                    self.state = 564
                    if not self.precpred(self._ctx, 1):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 1)")
                    self.state = 565
                    _la = self._input.LA(1)
                    if not(_la==Qasm2Parser.T__41 or _la==Qasm2Parser.T__42):
                        self._errHandler.recoverInline(self)
                    else:
                        self._errHandler.reportMatch(self)
                        self.consume()
                    self.state = 566
                    self.additiveExpression(0) 
                self.state = 571
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,55,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 AdditiveExpressionContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def multiplicativeExpression(self):
            return self.getTypedRuleContext(Qasm2Parser.MultiplicativeExpressionContext,0)


        def additiveExpression(self):
            return self.getTypedRuleContext(Qasm2Parser.AdditiveExpressionContext,0)


        def PLUS(self):
            return self.getToken(Qasm2Parser.PLUS, 0)

        def MINUS(self):
            return self.getToken(Qasm2Parser.MINUS, 0)

        def getRuleIndex(self):
            return Qasm2Parser.RULE_additiveExpression

        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 additiveExpression(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = Qasm2Parser.AdditiveExpressionContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 116
        self.enterRecursionRule(localctx, 116, self.RULE_additiveExpression, _p)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 573
            self.multiplicativeExpression(0)
            self._ctx.stop = self._input.LT(-1)
            self.state = 580
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,56,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    localctx = Qasm2Parser.AdditiveExpressionContext(self, _parentctx, _parentState)
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_additiveExpression)
                    self.state = 575
                    if not self.precpred(self._ctx, 1):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 1)")
                    self.state = 576
                    _la = self._input.LA(1)
                    if not(_la==Qasm2Parser.PLUS or _la==Qasm2Parser.MINUS):
                        self._errHandler.recoverInline(self)
                    else:
                        self._errHandler.reportMatch(self)
                        self.consume()
                    self.state = 577
                    self.multiplicativeExpression(0) 
                self.state = 582
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,56,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 MultiplicativeExpressionContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def expressionTerminator(self):
            return self.getTypedRuleContext(Qasm2Parser.ExpressionTerminatorContext,0)


        def unaryExpression(self):
            return self.getTypedRuleContext(Qasm2Parser.UnaryExpressionContext,0)


        def multiplicativeExpression(self):
            return self.getTypedRuleContext(Qasm2Parser.MultiplicativeExpressionContext,0)


        def MUL(self):
            return self.getToken(Qasm2Parser.MUL, 0)

        def DIV(self):
            return self.getToken(Qasm2Parser.DIV, 0)

        def MOD(self):
            return self.getToken(Qasm2Parser.MOD, 0)

        def getRuleIndex(self):
            return Qasm2Parser.RULE_multiplicativeExpression

        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 multiplicativeExpression(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = Qasm2Parser.MultiplicativeExpressionContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 118
        self.enterRecursionRule(localctx, 118, self.RULE_multiplicativeExpression, _p)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 586
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [Qasm2Parser.T__43, Qasm2Parser.T__44, Qasm2Parser.LPAREN, Qasm2Parser.Constant, Qasm2Parser.Integer, Qasm2Parser.Identifier, Qasm2Parser.RealNumber, Qasm2Parser.StringLiteral]:
                self.state = 584
                self.expressionTerminator(0)
                pass
            elif token in [Qasm2Parser.T__29, Qasm2Parser.T__30, Qasm2Parser.MINUS]:
                self.state = 585
                self.unaryExpression()
                pass
            else:
                raise NoViableAltException(self)

            self._ctx.stop = self._input.LT(-1)
            self.state = 596
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,59,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    localctx = Qasm2Parser.MultiplicativeExpressionContext(self, _parentctx, _parentState)
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_multiplicativeExpression)
                    self.state = 588
                    if not self.precpred(self._ctx, 1):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 1)")
                    self.state = 589
                    _la = self._input.LA(1)
                    if not(((((_la - 84)) & ~0x3f) == 0 and ((1 << (_la - 84)) & ((1 << (Qasm2Parser.MUL - 84)) | (1 << (Qasm2Parser.DIV - 84)) | (1 << (Qasm2Parser.MOD - 84)))) != 0)):
                        self._errHandler.recoverInline(self)
                    else:
                        self._errHandler.reportMatch(self)
                        self.consume()
                    self.state = 592
                    self._errHandler.sync(self)
                    token = self._input.LA(1)
                    if token in [Qasm2Parser.T__43, Qasm2Parser.T__44, Qasm2Parser.LPAREN, Qasm2Parser.Constant, Qasm2Parser.Integer, Qasm2Parser.Identifier, Qasm2Parser.RealNumber, Qasm2Parser.StringLiteral]:
                        self.state = 590
                        self.expressionTerminator(0)
                        pass
                    elif token in [Qasm2Parser.T__29, Qasm2Parser.T__30, Qasm2Parser.MINUS]:
                        self.state = 591
                        self.unaryExpression()
                        pass
                    else:
                        raise NoViableAltException(self)
             
                self.state = 598
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,59,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 UnaryExpressionContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def unaryOperator(self):
            return self.getTypedRuleContext(Qasm2Parser.UnaryOperatorContext,0)


        def expressionTerminator(self):
            return self.getTypedRuleContext(Qasm2Parser.ExpressionTerminatorContext,0)


        def getRuleIndex(self):
            return Qasm2Parser.RULE_unaryExpression

        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 unaryExpression(self):

        localctx = Qasm2Parser.UnaryExpressionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 120, self.RULE_unaryExpression)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 599
            self.unaryOperator()
            self.state = 600
            self.expressionTerminator(0)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ExpressionTerminatorContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def Constant(self):
            return self.getToken(Qasm2Parser.Constant, 0)

        def Integer(self):
            return self.getToken(Qasm2Parser.Integer, 0)

        def RealNumber(self):
            return self.getToken(Qasm2Parser.RealNumber, 0)

        def booleanLiteral(self):
            return self.getTypedRuleContext(Qasm2Parser.BooleanLiteralContext,0)


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

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

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

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


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

        def expressionTerminator(self):
            return self.getTypedRuleContext(Qasm2Parser.ExpressionTerminatorContext,0)


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

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

        def incrementor(self):
            return self.getTypedRuleContext(Qasm2Parser.IncrementorContext,0)


        def getRuleIndex(self):
            return Qasm2Parser.RULE_expressionTerminator

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

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



    def expressionTerminator(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = Qasm2Parser.ExpressionTerminatorContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 122
        self.enterRecursionRule(localctx, 122, self.RULE_expressionTerminator, _p)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 613
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [Qasm2Parser.Constant]:
                self.state = 603
                self.match(Qasm2Parser.Constant)
                pass
            elif token in [Qasm2Parser.Integer]:
                self.state = 604
                self.match(Qasm2Parser.Integer)
                pass
            elif token in [Qasm2Parser.RealNumber]:
                self.state = 605
                self.match(Qasm2Parser.RealNumber)
                pass
            elif token in [Qasm2Parser.T__43, Qasm2Parser.T__44]:
                self.state = 606
                self.booleanLiteral()
                pass
            elif token in [Qasm2Parser.Identifier]:
                self.state = 607
                self.match(Qasm2Parser.Identifier)
                pass
            elif token in [Qasm2Parser.StringLiteral]:
                self.state = 608
                self.match(Qasm2Parser.StringLiteral)
                pass
            elif token in [Qasm2Parser.LPAREN]:
                self.state = 609
                self.match(Qasm2Parser.LPAREN)
                self.state = 610
                self.expression(0)
                self.state = 611
                self.match(Qasm2Parser.RPAREN)
                pass
            else:
                raise NoViableAltException(self)

            self._ctx.stop = self._input.LT(-1)
            self.state = 624
            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:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    self.state = 622
                    self._errHandler.sync(self)
                    la_ = self._interp.adaptivePredict(self._input,61,self._ctx)
                    if la_ == 1:
                        localctx = Qasm2Parser.ExpressionTerminatorContext(self, _parentctx, _parentState)
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expressionTerminator)
                        self.state = 615
                        if not self.precpred(self._ctx, 2):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                        self.state = 616
                        self.match(Qasm2Parser.LBRACKET)
                        self.state = 617
                        self.expression(0)
                        self.state = 618
                        self.match(Qasm2Parser.RBRACKET)
                        pass

                    elif la_ == 2:
                        localctx = Qasm2Parser.ExpressionTerminatorContext(self, _parentctx, _parentState)
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expressionTerminator)
                        self.state = 620
                        if not self.precpred(self._ctx, 1):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 1)")
                        self.state = 621
                        self.incrementor()
                        pass

             
                self.state = 626
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,62,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 BooleanLiteralContext(ParserRuleContext):
        __slots__ = 'parser'

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


        def getRuleIndex(self):
            return Qasm2Parser.RULE_booleanLiteral

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

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




    def booleanLiteral(self):

        localctx = Qasm2Parser.BooleanLiteralContext(self, self._ctx, self.state)
        self.enterRule(localctx, 124, self.RULE_booleanLiteral)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 627
            _la = self._input.LA(1)
            if not(_la==Qasm2Parser.T__43 or _la==Qasm2Parser.T__44):
                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 IncrementorContext(ParserRuleContext):
        __slots__ = 'parser'

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


        def getRuleIndex(self):
            return Qasm2Parser.RULE_incrementor

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

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




    def incrementor(self):

        localctx = Qasm2Parser.IncrementorContext(self, self._ctx, self.state)
        self.enterRule(localctx, 126, self.RULE_incrementor)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 629
            _la = self._input.LA(1)
            if not(_la==Qasm2Parser.T__45 or _la==Qasm2Parser.T__46):
                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 BuiltInCallContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

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


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

        def builtInMath(self):
            return self.getTypedRuleContext(Qasm2Parser.BuiltInMathContext,0)


        def castOperator(self):
            return self.getTypedRuleContext(Qasm2Parser.CastOperatorContext,0)


        def getRuleIndex(self):
            return Qasm2Parser.RULE_builtInCall

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

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




    def builtInCall(self):

        localctx = Qasm2Parser.BuiltInCallContext(self, self._ctx, self.state)
        self.enterRule(localctx, 128, self.RULE_builtInCall)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 633
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [Qasm2Parser.T__47, Qasm2Parser.T__48, Qasm2Parser.T__49, Qasm2Parser.T__50, Qasm2Parser.T__51, Qasm2Parser.T__52, Qasm2Parser.T__53, Qasm2Parser.T__54, Qasm2Parser.T__55, Qasm2Parser.T__56]:
                self.state = 631
                self.builtInMath()
                pass
            elif token in [Qasm2Parser.T__4, Qasm2Parser.T__5, Qasm2Parser.T__6, Qasm2Parser.T__7, Qasm2Parser.T__8, Qasm2Parser.T__9, Qasm2Parser.T__10, Qasm2Parser.T__11]:
                self.state = 632
                self.castOperator()
                pass
            else:
                raise NoViableAltException(self)

            self.state = 635
            self.match(Qasm2Parser.LPAREN)
            self.state = 636
            self.expressionList()
            self.state = 637
            self.match(Qasm2Parser.RPAREN)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class BuiltInMathContext(ParserRuleContext):
        __slots__ = 'parser'

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


        def getRuleIndex(self):
            return Qasm2Parser.RULE_builtInMath

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

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




    def builtInMath(self):

        localctx = Qasm2Parser.BuiltInMathContext(self, self._ctx, self.state)
        self.enterRule(localctx, 130, self.RULE_builtInMath)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 639
            _la = self._input.LA(1)
            if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << Qasm2Parser.T__47) | (1 << Qasm2Parser.T__48) | (1 << Qasm2Parser.T__49) | (1 << Qasm2Parser.T__50) | (1 << Qasm2Parser.T__51) | (1 << Qasm2Parser.T__52) | (1 << Qasm2Parser.T__53) | (1 << Qasm2Parser.T__54) | (1 << Qasm2Parser.T__55) | (1 << Qasm2Parser.T__56))) != 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 CastOperatorContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def classicalType(self):
            return self.getTypedRuleContext(Qasm2Parser.ClassicalTypeContext,0)


        def getRuleIndex(self):
            return Qasm2Parser.RULE_castOperator

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

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




    def castOperator(self):

        localctx = Qasm2Parser.CastOperatorContext(self, self._ctx, self.state)
        self.enterRule(localctx, 132, self.RULE_castOperator)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 641
            self.classicalType()
        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):
        __slots__ = 'parser'

        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(Qasm2Parser.ExpressionContext)
            else:
                return self.getTypedRuleContext(Qasm2Parser.ExpressionContext,i)


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

        def getRuleIndex(self):
            return Qasm2Parser.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 expressionList(self):

        localctx = Qasm2Parser.ExpressionListContext(self, self._ctx, self.state)
        self.enterRule(localctx, 134, self.RULE_expressionList)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 648
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,64,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 643
                    self.expression(0)
                    self.state = 644
                    self.match(Qasm2Parser.COMMA) 
                self.state = 650
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,64,self._ctx)

            self.state = 651
            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 EqualsExpressionContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

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


        def getRuleIndex(self):
            return Qasm2Parser.RULE_equalsExpression

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

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




    def equalsExpression(self):

        localctx = Qasm2Parser.EqualsExpressionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 136, self.RULE_equalsExpression)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 653
            self.match(Qasm2Parser.EQUALS)
            self.state = 654
            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 AssignmentOperatorContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

        def getRuleIndex(self):
            return Qasm2Parser.RULE_assignmentOperator

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

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




    def assignmentOperator(self):

        localctx = Qasm2Parser.AssignmentOperatorContext(self, self._ctx, self.state)
        self.enterRule(localctx, 138, self.RULE_assignmentOperator)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 656
            _la = self._input.LA(1)
            if not(((((_la - 58)) & ~0x3f) == 0 and ((1 << (_la - 58)) & ((1 << (Qasm2Parser.T__57 - 58)) | (1 << (Qasm2Parser.T__58 - 58)) | (1 << (Qasm2Parser.T__59 - 58)) | (1 << (Qasm2Parser.T__60 - 58)) | (1 << (Qasm2Parser.T__61 - 58)) | (1 << (Qasm2Parser.T__62 - 58)) | (1 << (Qasm2Parser.T__63 - 58)) | (1 << (Qasm2Parser.T__64 - 58)) | (1 << (Qasm2Parser.T__65 - 58)) | (1 << (Qasm2Parser.T__66 - 58)) | (1 << (Qasm2Parser.EQUALS - 58)))) != 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 SetDeclarationContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

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


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

        def rangeDefinition(self):
            return self.getTypedRuleContext(Qasm2Parser.RangeDefinitionContext,0)


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

        def getRuleIndex(self):
            return Qasm2Parser.RULE_setDeclaration

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

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




    def setDeclaration(self):

        localctx = Qasm2Parser.SetDeclarationContext(self, self._ctx, self.state)
        self.enterRule(localctx, 140, self.RULE_setDeclaration)
        try:
            self.state = 664
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [Qasm2Parser.LBRACE]:
                self.enterOuterAlt(localctx, 1)
                self.state = 658
                self.match(Qasm2Parser.LBRACE)
                self.state = 659
                self.expressionList()
                self.state = 660
                self.match(Qasm2Parser.RBRACE)
                pass
            elif token in [Qasm2Parser.LBRACKET]:
                self.enterOuterAlt(localctx, 2)
                self.state = 662
                self.rangeDefinition()
                pass
            elif token in [Qasm2Parser.Identifier]:
                self.enterOuterAlt(localctx, 3)
                self.state = 663
                self.match(Qasm2Parser.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 ProgramBlockContext(ParserRuleContext):
        __slots__ = 'parser'

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

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


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

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

        def getRuleIndex(self):
            return Qasm2Parser.RULE_programBlock

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

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




    def programBlock(self):

        localctx = Qasm2Parser.ProgramBlockContext(self, self._ctx, self.state)
        self.enterRule(localctx, 142, self.RULE_programBlock)
        self._la = 0 # Token type
        try:
            self.state = 675
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [Qasm2Parser.T__15, Qasm2Parser.T__16, Qasm2Parser.T__17, Qasm2Parser.T__18, Qasm2Parser.T__19, Qasm2Parser.T__20, Qasm2Parser.T__21, Qasm2Parser.T__22, Qasm2Parser.T__23, Qasm2Parser.T__24, Qasm2Parser.T__25, Qasm2Parser.T__26, Qasm2Parser.T__27, Qasm2Parser.T__28, Qasm2Parser.T__67, Qasm2Parser.Identifier]:
                self.enterOuterAlt(localctx, 1)
                self.state = 666
                self.statement()
                pass
            elif token in [Qasm2Parser.LBRACE]:
                self.enterOuterAlt(localctx, 2)
                self.state = 667
                self.match(Qasm2Parser.LBRACE)
                self.state = 671
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << Qasm2Parser.T__15) | (1 << Qasm2Parser.T__16) | (1 << Qasm2Parser.T__17) | (1 << Qasm2Parser.T__18) | (1 << Qasm2Parser.T__19) | (1 << Qasm2Parser.T__20) | (1 << Qasm2Parser.T__21) | (1 << Qasm2Parser.T__22) | (1 << Qasm2Parser.T__23) | (1 << Qasm2Parser.T__24) | (1 << Qasm2Parser.T__25) | (1 << Qasm2Parser.T__26) | (1 << Qasm2Parser.T__27) | (1 << Qasm2Parser.T__28))) != 0) or _la==Qasm2Parser.T__67 or _la==Qasm2Parser.Identifier:
                    self.state = 668
                    self.statement()
                    self.state = 673
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

                self.state = 674
                self.match(Qasm2Parser.RBRACE)
                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 BranchingStatementContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

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


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

        def programBlock(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(Qasm2Parser.ProgramBlockContext)
            else:
                return self.getTypedRuleContext(Qasm2Parser.ProgramBlockContext,i)


        def getRuleIndex(self):
            return Qasm2Parser.RULE_branchingStatement

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

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




    def branchingStatement(self):

        localctx = Qasm2Parser.BranchingStatementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 144, self.RULE_branchingStatement)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 677
            self.match(Qasm2Parser.T__67)
            self.state = 678
            self.match(Qasm2Parser.LPAREN)
            self.state = 679
            self.expression(0)
            self.state = 680
            self.match(Qasm2Parser.RPAREN)
            self.state = 681
            self.programBlock()
            self.state = 684
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,68,self._ctx)
            if la_ == 1:
                self.state = 682
                self.match(Qasm2Parser.T__68)
                self.state = 683
                self.programBlock()


        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[30] = self.indexIdentifier_sempred
        self._predicates[50] = self.expression_sempred
        self._predicates[51] = self.logicalAndExpression_sempred
        self._predicates[52] = self.bitOrExpression_sempred
        self._predicates[53] = self.xOrExpression_sempred
        self._predicates[54] = self.bitAndExpression_sempred
        self._predicates[55] = self.equalityExpression_sempred
        self._predicates[56] = self.comparisonExpression_sempred
        self._predicates[57] = self.bitShiftExpression_sempred
        self._predicates[58] = self.additiveExpression_sempred
        self._predicates[59] = self.multiplicativeExpression_sempred
        self._predicates[61] = self.expressionTerminator_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 indexIdentifier_sempred(self, localctx:IndexIdentifierContext, predIndex:int):
            if predIndex == 0:
                return self.precpred(self._ctx, 1)
         

    def expression_sempred(self, localctx:ExpressionContext, predIndex:int):
            if predIndex == 1:
                return self.precpred(self._ctx, 1)
         

    def logicalAndExpression_sempred(self, localctx:LogicalAndExpressionContext, predIndex:int):
            if predIndex == 2:
                return self.precpred(self._ctx, 1)
         

    def bitOrExpression_sempred(self, localctx:BitOrExpressionContext, predIndex:int):
            if predIndex == 3:
                return self.precpred(self._ctx, 1)
         

    def xOrExpression_sempred(self, localctx:XOrExpressionContext, predIndex:int):
            if predIndex == 4:
                return self.precpred(self._ctx, 1)
         

    def bitAndExpression_sempred(self, localctx:BitAndExpressionContext, predIndex:int):
            if predIndex == 5:
                return self.precpred(self._ctx, 1)
         

    def equalityExpression_sempred(self, localctx:EqualityExpressionContext, predIndex:int):
            if predIndex == 6:
                return self.precpred(self._ctx, 1)
         

    def comparisonExpression_sempred(self, localctx:ComparisonExpressionContext, predIndex:int):
            if predIndex == 7:
                return self.precpred(self._ctx, 1)
         

    def bitShiftExpression_sempred(self, localctx:BitShiftExpressionContext, predIndex:int):
            if predIndex == 8:
                return self.precpred(self._ctx, 1)
         

    def additiveExpression_sempred(self, localctx:AdditiveExpressionContext, predIndex:int):
            if predIndex == 9:
                return self.precpred(self._ctx, 1)
         

    def multiplicativeExpression_sempred(self, localctx:MultiplicativeExpressionContext, predIndex:int):
            if predIndex == 10:
                return self.precpred(self._ctx, 1)
         

    def expressionTerminator_sempred(self, localctx:ExpressionTerminatorContext, predIndex:int):
            if predIndex == 11:
                return self.precpred(self._ctx, 2)
         

            if predIndex == 12:
                return self.precpred(self._ctx, 1)
         





# Copyright 2021 SpinQ Technology Co., Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Generated from Qasm2.g4 by ANTLR 4.9.2
# 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\3c")
        buf.write("\u02b1\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\4D\t")
        buf.write("D\4E\tE\4F\tF\4G\tG\4H\tH\4I\tI\4J\tJ\3\2\3\2\3\2\7\2")
        buf.write("\u0098\n\2\f\2\16\2\u009b\13\2\3\2\3\2\3\3\5\3\u00a0\n")
        buf.write("\3\3\3\7\3\u00a3\n\3\f\3\16\3\u00a6\13\3\3\4\3\4\3\4\3")
        buf.write("\4\3\5\3\5\3\5\3\5\3\6\3\6\3\6\5\6\u00b3\n\6\3\7\3\7\3")
        buf.write("\7\5\7\u00b8\n\7\3\b\3\b\3\b\3\t\3\t\5\t\u00bf\n\t\3\t")
        buf.write("\3\t\3\n\3\n\3\n\3\13\3\13\3\13\3\f\3\f\3\f\3\f\3\r\3")
        buf.write("\r\3\r\3\r\3\r\3\r\3\16\3\16\7\16\u00d5\n\16\f\16\16\16")
        buf.write("\u00d8\13\16\3\16\3\16\3\17\3\17\3\17\5\17\u00df\n\17")
        buf.write("\3\20\3\20\3\20\5\20\u00e4\n\20\3\20\3\20\5\20\u00e8\n")
        buf.write("\20\3\20\5\20\u00eb\n\20\3\21\3\21\3\21\7\21\u00f0\n\21")
        buf.write("\f\21\16\21\u00f3\13\21\3\21\3\21\3\22\3\22\3\23\3\23")
        buf.write("\3\24\3\24\3\25\3\25\3\26\3\26\3\26\3\26\3\26\3\26\3\26")
        buf.write("\3\26\3\26\5\26\u0108\n\26\5\26\u010a\n\26\3\27\3\27\3")
        buf.write("\27\5\27\u010f\n\27\3\30\3\30\3\30\3\30\5\30\u0115\n\30")
        buf.write("\3\31\3\31\3\31\3\31\5\31\u011b\n\31\3\32\3\32\3\32\5")
        buf.write("\32\u0120\n\32\3\33\3\33\3\33\5\33\u0125\n\33\3\33\3\33")
        buf.write("\5\33\u0129\n\33\3\33\5\33\u012c\n\33\3\33\5\33\u012f")
        buf.write("\n\33\3\34\3\34\3\34\3\34\5\34\u0135\n\34\3\35\3\35\3")
        buf.write("\35\7\35\u013a\n\35\f\35\16\35\u013d\13\35\3\35\3\35\3")
        buf.write("\36\3\36\3\36\3\36\3\36\3\36\3\36\5\36\u0148\n\36\3\36")
        buf.write("\3\36\3\36\3\36\3\36\5\36\u014f\n\36\3\36\3\36\5\36\u0153")
        buf.write("\n\36\3\36\5\36\u0156\n\36\3\37\3\37\3\37\7\37\u015b\n")
        buf.write("\37\f\37\16\37\u015e\13\37\3\37\3\37\3 \3 \3 \3 \3 \3")
        buf.write(" \3 \3 \5 \u016a\n \5 \u016c\n \3 \3 \3 \7 \u0171\n \f")
        buf.write(" \16 \u0174\13 \3!\3!\3!\7!\u0179\n!\f!\16!\u017c\13!")
        buf.write("\3!\3!\3\"\3\"\5\"\u0182\n\"\3\"\3\"\5\"\u0186\n\"\3\"")
        buf.write("\3\"\5\"\u018a\n\"\3\"\3\"\3#\3#\3#\3#\3$\3$\5$\u0194")
        buf.write("\n$\3$\3$\3%\3%\5%\u019a\n%\3%\3%\3&\3&\3\'\3\'\7\'\u01a2")
        buf.write("\n\'\f\'\16\'\u01a5\13\'\3\'\3\'\3(\3(\3(\7(\u01ac\n(")
        buf.write("\f(\16(\u01af\13(\3(\5(\u01b2\n(\3)\3)\3)\3*\3*\3*\5*")
        buf.write("\u01ba\n*\3+\3+\3+\3,\3,\3,\5,\u01c2\n,\3,\3,\3,\3,\5")
        buf.write(",\u01c8\n,\3-\3-\3-\3.\3.\3.\5.\u01d0\n.\3.\5.\u01d3\n")
        buf.write(".\3.\3.\3/\3/\3\60\3\60\3\61\3\61\3\62\3\62\3\63\3\63")
        buf.write("\3\63\3\64\3\64\3\64\3\64\5\64\u01e6\n\64\3\64\3\64\3")
        buf.write("\64\7\64\u01eb\n\64\f\64\16\64\u01ee\13\64\3\65\3\65\3")
        buf.write("\65\3\65\3\65\3\65\7\65\u01f6\n\65\f\65\16\65\u01f9\13")
        buf.write("\65\3\66\3\66\3\66\3\66\3\66\3\66\7\66\u0201\n\66\f\66")
        buf.write("\16\66\u0204\13\66\3\67\3\67\3\67\3\67\3\67\3\67\7\67")
        buf.write("\u020c\n\67\f\67\16\67\u020f\13\67\38\38\38\38\38\38\7")
        buf.write("8\u0217\n8\f8\168\u021a\138\39\39\39\39\39\39\39\79\u0223")
        buf.write("\n9\f9\169\u0226\139\3:\3:\3:\3:\3:\3:\3:\7:\u022f\n:")
        buf.write("\f:\16:\u0232\13:\3;\3;\3;\3;\3;\3;\7;\u023a\n;\f;\16")
        buf.write(";\u023d\13;\3<\3<\3<\3<\3<\3<\7<\u0245\n<\f<\16<\u0248")
        buf.write("\13<\3=\3=\3=\5=\u024d\n=\3=\3=\3=\3=\5=\u0253\n=\7=\u0255")
        buf.write("\n=\f=\16=\u0258\13=\3>\3>\3>\3?\3?\3?\3?\3?\3?\3?\3?")
        buf.write("\3?\3?\3?\5?\u0268\n?\3?\3?\3?\3?\3?\3?\3?\7?\u0271\n")
        buf.write("?\f?\16?\u0274\13?\3@\3@\3A\3A\3B\3B\5B\u027c\nB\3B\3")
        buf.write("B\3B\3B\3C\3C\3D\3D\3E\3E\3E\7E\u0289\nE\fE\16E\u028c")
        buf.write("\13E\3E\3E\3F\3F\3F\3G\3G\3H\3H\3H\3H\3H\3H\5H\u029b\n")
        buf.write("H\3I\3I\3I\7I\u02a0\nI\fI\16I\u02a3\13I\3I\5I\u02a6\n")
        buf.write("I\3J\3J\3J\3J\3J\3J\3J\5J\u02af\nJ\3J\2\16>fhjlnprtvx")
        buf.write("|K\2\4\6\b\n\f\16\20\22\24\26\30\32\34\36 \"$&(*,.\60")
        buf.write("\62\64\668:<>@BDFHJLNPRTVXZ\\^`bdfhjlnprtvxz|~\u0080\u0082")
        buf.write("\u0084\u0086\u0088\u008a\u008c\u008e\u0090\u0092\2\21")
        buf.write("\4\2\\\\__\3\2\7\b\3\2\t\f\4\2\22\35^^\4\2 !UU\3\2\"%")
        buf.write("\3\2&\'\4\2\20\20((\3\2,-\3\2TU\3\2VX\3\2./\3\2\60\61")
        buf.write("\3\2\62;\4\2<ERR\2\u02bc\2\u0094\3\2\2\2\4\u009f\3\2\2")
        buf.write("\2\6\u00a7\3\2\2\2\b\u00ab\3\2\2\2\n\u00b2\3\2\2\2\f\u00b7")
        buf.write("\3\2\2\2\16\u00b9\3\2\2\2\20\u00be\3\2\2\2\22\u00c2\3")
        buf.write("\2\2\2\24\u00c5\3\2\2\2\26\u00c8\3\2\2\2\30\u00cc\3\2")
        buf.write("\2\2\32\u00d6\3\2\2\2\34\u00db\3\2\2\2\36\u00ea\3\2\2")
        buf.write("\2 \u00f1\3\2\2\2\"\u00f6\3\2\2\2$\u00f8\3\2\2\2&\u00fa")
        buf.write("\3\2\2\2(\u00fc\3\2\2\2*\u0109\3\2\2\2,\u010b\3\2\2\2")
        buf.write(".\u0110\3\2\2\2\60\u0116\3\2\2\2\62\u011c\3\2\2\2\64\u012b")
        buf.write("\3\2\2\2\66\u0134\3\2\2\28\u013b\3\2\2\2:\u0155\3\2\2")
        buf.write("\2<\u015c\3\2\2\2>\u016b\3\2\2\2@\u017a\3\2\2\2B\u017f")
        buf.write("\3\2\2\2D\u018d\3\2\2\2F\u0191\3\2\2\2H\u0197\3\2\2\2")
        buf.write("J\u019d\3\2\2\2L\u019f\3\2\2\2N\u01b1\3\2\2\2P\u01b3\3")
        buf.write("\2\2\2R\u01b9\3\2\2\2T\u01bb\3\2\2\2V\u01c7\3\2\2\2X\u01c9")
        buf.write("\3\2\2\2Z\u01cc\3\2\2\2\\\u01d6\3\2\2\2^\u01d8\3\2\2\2")
        buf.write("`\u01da\3\2\2\2b\u01dc\3\2\2\2d\u01de\3\2\2\2f\u01e5\3")
        buf.write("\2\2\2h\u01ef\3\2\2\2j\u01fa\3\2\2\2l\u0205\3\2\2\2n\u0210")
        buf.write("\3\2\2\2p\u021b\3\2\2\2r\u0227\3\2\2\2t\u0233\3\2\2\2")
        buf.write("v\u023e\3\2\2\2x\u024c\3\2\2\2z\u0259\3\2\2\2|\u0267\3")
        buf.write("\2\2\2~\u0275\3\2\2\2\u0080\u0277\3\2\2\2\u0082\u027b")
        buf.write("\3\2\2\2\u0084\u0281\3\2\2\2\u0086\u0283\3\2\2\2\u0088")
        buf.write("\u028a\3\2\2\2\u008a\u028f\3\2\2\2\u008c\u0292\3\2\2\2")
        buf.write("\u008e\u029a\3\2\2\2\u0090\u02a5\3\2\2\2\u0092\u02a7\3")
        buf.write("\2\2\2\u0094\u0099\5\4\3\2\u0095\u0098\5\n\6\2\u0096\u0098")
        buf.write("\5\f\7\2\u0097\u0095\3\2\2\2\u0097\u0096\3\2\2\2\u0098")
        buf.write("\u009b\3\2\2\2\u0099\u0097\3\2\2\2\u0099\u009a\3\2\2\2")
        buf.write("\u009a\u009c\3\2\2\2\u009b\u0099\3\2\2\2\u009c\u009d\7")
        buf.write("\2\2\3\u009d\3\3\2\2\2\u009e\u00a0\5\6\4\2\u009f\u009e")
        buf.write("\3\2\2\2\u009f\u00a0\3\2\2\2\u00a0\u00a4\3\2\2\2\u00a1")
        buf.write("\u00a3\5\b\5\2\u00a2\u00a1\3\2\2\2\u00a3\u00a6\3\2\2\2")
        buf.write("\u00a4\u00a2\3\2\2\2\u00a4\u00a5\3\2\2\2\u00a5\5\3\2\2")
        buf.write("\2\u00a6\u00a4\3\2\2\2\u00a7\u00a8\7\3\2\2\u00a8\u00a9")
        buf.write("\t\2\2\2\u00a9\u00aa\7O\2\2\u00aa\7\3\2\2\2\u00ab\u00ac")
        buf.write("\7\4\2\2\u00ac\u00ad\7a\2\2\u00ad\u00ae\7O\2\2\u00ae\t")
        buf.write("\3\2\2\2\u00af\u00b3\5\16\b\2\u00b0\u00b3\5D#\2\u00b1")
        buf.write("\u00b3\5\20\t\2\u00b2\u00af\3\2\2\2\u00b2\u00b0\3\2\2")
        buf.write("\2\u00b2\u00b1\3\2\2\2\u00b3\13\3\2\2\2\u00b4\u00b8\5")
        buf.write("P)\2\u00b5\u00b8\5\22\n\2\u00b6\u00b8\5\u0092J\2\u00b7")
        buf.write("\u00b4\3\2\2\2\u00b7\u00b5\3\2\2\2\u00b7\u00b6\3\2\2\2")
        buf.write("\u00b8\r\3\2\2\2\u00b9\u00ba\5\34\17\2\u00ba\u00bb\7O")
        buf.write("\2\2\u00bb\17\3\2\2\2\u00bc\u00bf\5\66\34\2\u00bd\u00bf")
        buf.write("\5,\27\2\u00be\u00bc\3\2\2\2\u00be\u00bd\3\2\2\2\u00bf")
        buf.write("\u00c0\3\2\2\2\u00c0\u00c1\7O\2\2\u00c1\21\3\2\2\2\u00c2")
        buf.write("\u00c3\5V,\2\u00c3\u00c4\7O\2\2\u00c4\23\3\2\2\2\u00c5")
        buf.write("\u00c6\7S\2\2\u00c6\u00c7\5*\26\2\u00c7\25\3\2\2\2\u00c8")
        buf.write("\u00c9\7H\2\2\u00c9\u00ca\5f\64\2\u00ca\u00cb\7I\2\2\u00cb")
        buf.write("\27\3\2\2\2\u00cc\u00cd\7H\2\2\u00cd\u00ce\5f\64\2\u00ce")
        buf.write("\u00cf\7Q\2\2\u00cf\u00d0\5f\64\2\u00d0\u00d1\7I\2\2\u00d1")
        buf.write("\31\3\2\2\2\u00d2\u00d3\7^\2\2\u00d3\u00d5\7Q\2\2\u00d4")
        buf.write("\u00d2\3\2\2\2\u00d5\u00d8\3\2\2\2\u00d6\u00d4\3\2\2\2")
        buf.write("\u00d6\u00d7\3\2\2\2\u00d7\u00d9\3\2\2\2\u00d8\u00d6\3")
        buf.write("\2\2\2\u00d9\u00da\7^\2\2\u00da\33\3\2\2\2\u00db\u00dc")
        buf.write("\7\5\2\2\u00dc\u00de\7^\2\2\u00dd\u00df\5\26\f\2\u00de")
        buf.write("\u00dd\3\2\2\2\u00de\u00df\3\2\2\2\u00df\35\3\2\2\2\u00e0")
        buf.write("\u00e1\7\5\2\2\u00e1\u00e3\7^\2\2\u00e2\u00e4\5\26\f\2")
        buf.write("\u00e3\u00e2\3\2\2\2\u00e3\u00e4\3\2\2\2\u00e4\u00eb\3")
        buf.write("\2\2\2\u00e5\u00e7\7\6\2\2\u00e6\u00e8\5\26\f\2\u00e7")
        buf.write("\u00e6\3\2\2\2\u00e7\u00e8\3\2\2\2\u00e8\u00e9\3\2\2\2")
        buf.write("\u00e9\u00eb\7^\2\2\u00ea\u00e0\3\2\2\2\u00ea\u00e5\3")
        buf.write("\2\2\2\u00eb\37\3\2\2\2\u00ec\u00ed\5\36\20\2\u00ed\u00ee")
        buf.write("\7Q\2\2\u00ee\u00f0\3\2\2\2\u00ef\u00ec\3\2\2\2\u00f0")
        buf.write("\u00f3\3\2\2\2\u00f1\u00ef\3\2\2\2\u00f1\u00f2\3\2\2\2")
        buf.write("\u00f2\u00f4\3\2\2\2\u00f3\u00f1\3\2\2\2\u00f4\u00f5\5")
        buf.write("\36\20\2\u00f5!\3\2\2\2\u00f6\u00f7\t\3\2\2\u00f7#\3\2")
        buf.write("\2\2\u00f8\u00f9\t\4\2\2\u00f9%\3\2\2\2\u00fa\u00fb\7")
        buf.write("\r\2\2\u00fb\'\3\2\2\2\u00fc\u00fd\7\16\2\2\u00fd)\3\2")
        buf.write("\2\2\u00fe\u00ff\5$\23\2\u00ff\u0100\5\26\f\2\u0100\u010a")
        buf.write("\3\2\2\2\u0101\u0102\5&\24\2\u0102\u0103\5\30\r\2\u0103")
        buf.write("\u010a\3\2\2\2\u0104\u010a\5(\25\2\u0105\u0107\5\"\22")
        buf.write("\2\u0106\u0108\5\26\f\2\u0107\u0106\3\2\2\2\u0107\u0108")
        buf.write("\3\2\2\2\u0108\u010a\3\2\2\2\u0109\u00fe\3\2\2\2\u0109")
        buf.write("\u0101\3\2\2\2\u0109\u0104\3\2\2\2\u0109\u0105\3\2\2\2")
        buf.write("\u010a+\3\2\2\2\u010b\u010c\7\17\2\2\u010c\u010e\7^\2")
        buf.write("\2\u010d\u010f\5\u008aF\2\u010e\u010d\3\2\2\2\u010e\u010f")
        buf.write("\3\2\2\2\u010f-\3\2\2\2\u0110\u0111\5$\23\2\u0111\u0112")
        buf.write("\5\26\f\2\u0112\u0114\7^\2\2\u0113\u0115\5\u008aF\2\u0114")
        buf.write("\u0113\3\2\2\2\u0114\u0115\3\2\2\2\u0115/\3\2\2\2\u0116")
        buf.write("\u0117\5&\24\2\u0117\u0118\5\30\r\2\u0118\u011a\7^\2\2")
        buf.write("\u0119\u011b\5\u008aF\2\u011a\u0119\3\2\2\2\u011a\u011b")
        buf.write("\3\2\2\2\u011b\61\3\2\2\2\u011c\u011d\5(\25\2\u011d\u011f")
        buf.write("\7^\2\2\u011e\u0120\5\u008aF\2\u011f\u011e\3\2\2\2\u011f")
        buf.write("\u0120\3\2\2\2\u0120\63\3\2\2\2\u0121\u0122\7\b\2\2\u0122")
        buf.write("\u0124\7^\2\2\u0123\u0125\5\26\f\2\u0124\u0123\3\2\2\2")
        buf.write("\u0124\u0125\3\2\2\2\u0125\u012c\3\2\2\2\u0126\u0128\7")
        buf.write("\7\2\2\u0127\u0129\5\26\f\2\u0128\u0127\3\2\2\2\u0128")
        buf.write("\u0129\3\2\2\2\u0129\u012a\3\2\2\2\u012a\u012c\7^\2\2")
        buf.write("\u012b\u0121\3\2\2\2\u012b\u0126\3\2\2\2\u012c\u012e\3")
        buf.write("\2\2\2\u012d\u012f\5\u008aF\2\u012e\u012d\3\2\2\2\u012e")
        buf.write("\u012f\3\2\2\2\u012f\65\3\2\2\2\u0130\u0135\5.\30\2\u0131")
        buf.write("\u0135\5\60\31\2\u0132\u0135\5\62\32\2\u0133\u0135\5\64")
        buf.write("\33\2\u0134\u0130\3\2\2\2\u0134\u0131\3\2\2\2\u0134\u0132")
        buf.write("\3\2\2\2\u0134\u0133\3\2\2\2\u0135\67\3\2\2\2\u0136\u0137")
        buf.write("\5*\26\2\u0137\u0138\7Q\2\2\u0138\u013a\3\2\2\2\u0139")
        buf.write("\u0136\3\2\2\2\u013a\u013d\3\2\2\2\u013b\u0139\3\2\2\2")
        buf.write("\u013b\u013c\3\2\2\2\u013c\u013e\3\2\2\2\u013d\u013b\3")
        buf.write("\2\2\2\u013e\u013f\5*\26\2\u013f9\3\2\2\2\u0140\u0141")
        buf.write("\5$\23\2\u0141\u0142\5\26\f\2\u0142\u0148\3\2\2\2\u0143")
        buf.write("\u0144\5&\24\2\u0144\u0145\5\30\r\2\u0145\u0148\3\2\2")
        buf.write("\2\u0146\u0148\5(\25\2\u0147\u0140\3\2\2\2\u0147\u0143")
        buf.write("\3\2\2\2\u0147\u0146\3\2\2\2\u0148\u0149\3\2\2\2\u0149")
        buf.write("\u014a\7^\2\2\u014a\u0156\3\2\2\2\u014b\u014c\7\b\2\2")
        buf.write("\u014c\u014e\7^\2\2\u014d\u014f\5\26\f\2\u014e\u014d\3")
        buf.write("\2\2\2\u014e\u014f\3\2\2\2\u014f\u0156\3\2\2\2\u0150\u0152")
        buf.write("\7\7\2\2\u0151\u0153\5\26\f\2\u0152\u0151\3\2\2\2\u0152")
        buf.write("\u0153\3\2\2\2\u0153\u0154\3\2\2\2\u0154\u0156\7^\2\2")
        buf.write("\u0155\u0147\3\2\2\2\u0155\u014b\3\2\2\2\u0155\u0150\3")
        buf.write("\2\2\2\u0156;\3\2\2\2\u0157\u0158\5:\36\2\u0158\u0159")
        buf.write("\7Q\2\2\u0159\u015b\3\2\2\2\u015a\u0157\3\2\2\2\u015b")
        buf.write("\u015e\3\2\2\2\u015c\u015a\3\2\2\2\u015c\u015d\3\2\2\2")
        buf.write("\u015d\u015f\3\2\2\2\u015e\u015c\3\2\2\2\u015f\u0160\5")
        buf.write(":\36\2\u0160=\3\2\2\2\u0161\u0162\b \1\2\u0162\u0163\7")
        buf.write("^\2\2\u0163\u016c\5B\"\2\u0164\u0169\7^\2\2\u0165\u0166")
        buf.write("\7H\2\2\u0166\u0167\5\u0088E\2\u0167\u0168\7I\2\2\u0168")
        buf.write("\u016a\3\2\2\2\u0169\u0165\3\2\2\2\u0169\u016a\3\2\2\2")
        buf.write("\u016a\u016c\3\2\2\2\u016b\u0161\3\2\2\2\u016b\u0164\3")
        buf.write("\2\2\2\u016c\u0172\3\2\2\2\u016d\u016e\f\3\2\2\u016e\u016f")
        buf.write("\7\20\2\2\u016f\u0171\5> \4\u0170\u016d\3\2\2\2\u0171")
        buf.write("\u0174\3\2\2\2\u0172\u0170\3\2\2\2\u0172\u0173\3\2\2\2")
        buf.write("\u0173?\3\2\2\2\u0174\u0172\3\2\2\2\u0175\u0176\5> \2")
        buf.write("\u0176\u0177\7Q\2\2\u0177\u0179\3\2\2\2\u0178\u0175\3")
        buf.write("\2\2\2\u0179\u017c\3\2\2\2\u017a\u0178\3\2\2\2\u017a\u017b")
        buf.write("\3\2\2\2\u017b\u017d\3\2\2\2\u017c\u017a\3\2\2\2\u017d")
        buf.write("\u017e\5> \2\u017eA\3\2\2\2\u017f\u0181\7H\2\2\u0180\u0182")
        buf.write("\5f\64\2\u0181\u0180\3\2\2\2\u0181\u0182\3\2\2\2\u0182")
        buf.write("\u0183\3\2\2\2\u0183\u0185\7N\2\2\u0184\u0186\5f\64\2")
        buf.write("\u0185\u0184\3\2\2\2\u0185\u0186\3\2\2\2\u0186\u0189\3")
        buf.write("\2\2\2\u0187\u0188\7N\2\2\u0188\u018a\5f\64\2\u0189\u0187")
        buf.write("\3\2\2\2\u0189\u018a\3\2\2\2\u018a\u018b\3\2\2\2\u018b")
        buf.write("\u018c\7I\2\2\u018cC\3\2\2\2\u018d\u018e\7\21\2\2\u018e")
        buf.write("\u018f\5F$\2\u018f\u0190\5L\'\2\u0190E\3\2\2\2\u0191\u0193")
        buf.write("\7^\2\2\u0192\u0194\5H%\2\u0193\u0192\3\2\2\2\u0193\u0194")
        buf.write("\3\2\2\2\u0194\u0195\3\2\2\2\u0195\u0196\5\32\16\2\u0196")
        buf.write("G\3\2\2\2\u0197\u0199\7L\2\2\u0198\u019a\5\32\16\2\u0199")
        buf.write("\u0198\3\2\2\2\u0199\u019a\3\2\2\2\u019a\u019b\3\2\2\2")
        buf.write("\u019b\u019c\7M\2\2\u019cI\3\2\2\2\u019d\u019e\t\5\2\2")
        buf.write("\u019eK\3\2\2\2\u019f\u01a3\7J\2\2\u01a0\u01a2\5P)\2\u01a1")
        buf.write("\u01a0\3\2\2\2\u01a2\u01a5\3\2\2\2\u01a3\u01a1\3\2\2\2")
        buf.write("\u01a3\u01a4\3\2\2\2\u01a4\u01a6\3\2\2\2\u01a5\u01a3\3")
        buf.write("\2\2\2\u01a6\u01a7\7K\2\2\u01a7M\3\2\2\2\u01a8\u01b2\5")
        buf.write("P)\2\u01a9\u01ad\7J\2\2\u01aa\u01ac\5P)\2\u01ab\u01aa")
        buf.write("\3\2\2\2\u01ac\u01af\3\2\2\2\u01ad\u01ab\3\2\2\2\u01ad")
        buf.write("\u01ae\3\2\2\2\u01ae\u01b0\3\2\2\2\u01af\u01ad\3\2\2\2")
        buf.write("\u01b0\u01b2\7K\2\2\u01b1\u01a8\3\2\2\2\u01b1\u01a9\3")
        buf.write("\2\2\2\u01b2O\3\2\2\2\u01b3\u01b4\5R*\2\u01b4\u01b5\7")
        buf.write("O\2\2\u01b5Q\3\2\2\2\u01b6\u01ba\5Z.\2\u01b7\u01ba\5T")
        buf.write("+\2\u01b8\u01ba\5X-\2\u01b9\u01b6\3\2\2\2\u01b9\u01b7")
        buf.write("\3\2\2\2\u01b9\u01b8\3\2\2\2\u01baS\3\2\2\2\u01bb\u01bc")
        buf.write("\7\36\2\2\u01bc\u01bd\5@!\2\u01bdU\3\2\2\2\u01be\u01c1")
        buf.write("\5T+\2\u01bf\u01c0\7S\2\2\u01c0\u01c2\5@!\2\u01c1\u01bf")
        buf.write("\3\2\2\2\u01c1\u01c2\3\2\2\2\u01c2\u01c8\3\2\2\2\u01c3")
        buf.write("\u01c4\5@!\2\u01c4\u01c5\7R\2\2\u01c5\u01c6\5T+\2\u01c6")
        buf.write("\u01c8\3\2\2\2\u01c7\u01be\3\2\2\2\u01c7\u01c3\3\2\2\2")
        buf.write("\u01c8W\3\2\2\2\u01c9\u01ca\7\37\2\2\u01ca\u01cb\5@!\2")
        buf.write("\u01cbY\3\2\2\2\u01cc\u01d2\5J&\2\u01cd\u01cf\7L\2\2\u01ce")
        buf.write("\u01d0\5\u0088E\2\u01cf\u01ce\3\2\2\2\u01cf\u01d0\3\2")
        buf.write("\2\2\u01d0\u01d1\3\2\2\2\u01d1\u01d3\7M\2\2\u01d2\u01cd")
        buf.write("\3\2\2\2\u01d2\u01d3\3\2\2\2\u01d3\u01d4\3\2\2\2\u01d4")
        buf.write("\u01d5\5@!\2\u01d5[\3\2\2\2\u01d6\u01d7\t\6\2\2\u01d7")
        buf.write("]\3\2\2\2\u01d8\u01d9\t\7\2\2\u01d9_\3\2\2\2\u01da\u01db")
        buf.write("\t\b\2\2\u01dba\3\2\2\2\u01dc\u01dd\t\t\2\2\u01ddc\3\2")
        buf.write("\2\2\u01de\u01df\5f\64\2\u01df\u01e0\7O\2\2\u01e0e\3\2")
        buf.write("\2\2\u01e1\u01e2\b\64\1\2\u01e2\u01e6\5|?\2\u01e3\u01e6")
        buf.write("\5z>\2\u01e4\u01e6\5h\65\2\u01e5\u01e1\3\2\2\2\u01e5\u01e3")
        buf.write("\3\2\2\2\u01e5\u01e4\3\2\2\2\u01e6\u01ec\3\2\2\2\u01e7")
        buf.write("\u01e8\f\3\2\2\u01e8\u01e9\7\20\2\2\u01e9\u01eb\5h\65")
        buf.write("\2\u01ea\u01e7\3\2\2\2\u01eb\u01ee\3\2\2\2\u01ec\u01ea")
        buf.write("\3\2\2\2\u01ec\u01ed\3\2\2\2\u01edg\3\2\2\2\u01ee\u01ec")
        buf.write("\3\2\2\2\u01ef\u01f0\b\65\1\2\u01f0\u01f1\5j\66\2\u01f1")
        buf.write("\u01f7\3\2\2\2\u01f2\u01f3\f\3\2\2\u01f3\u01f4\7(\2\2")
        buf.write("\u01f4\u01f6\5j\66\2\u01f5\u01f2\3\2\2\2\u01f6\u01f9\3")
        buf.write("\2\2\2\u01f7\u01f5\3\2\2\2\u01f7\u01f8\3\2\2\2\u01f8i")
        buf.write("\3\2\2\2\u01f9\u01f7\3\2\2\2\u01fa\u01fb\b\66\1\2\u01fb")
        buf.write("\u01fc\5l\67\2\u01fc\u0202\3\2\2\2\u01fd\u01fe\f\3\2\2")
        buf.write("\u01fe\u01ff\7)\2\2\u01ff\u0201\5l\67\2\u0200\u01fd\3")
        buf.write("\2\2\2\u0201\u0204\3\2\2\2\u0202\u0200\3\2\2\2\u0202\u0203")
        buf.write("\3\2\2\2\u0203k\3\2\2\2\u0204\u0202\3\2\2\2\u0205\u0206")
        buf.write("\b\67\1\2\u0206\u0207\5n8\2\u0207\u020d\3\2\2\2\u0208")
        buf.write("\u0209\f\3\2\2\u0209\u020a\7*\2\2\u020a\u020c\5n8\2\u020b")
        buf.write("\u0208\3\2\2\2\u020c\u020f\3\2\2\2\u020d\u020b\3\2\2\2")
        buf.write("\u020d\u020e\3\2\2\2\u020em\3\2\2\2\u020f\u020d\3\2\2")
        buf.write("\2\u0210\u0211\b8\1\2\u0211\u0212\5p9\2\u0212\u0218\3")
        buf.write("\2\2\2\u0213\u0214\f\3\2\2\u0214\u0215\7+\2\2\u0215\u0217")
        buf.write("\5p9\2\u0216\u0213\3\2\2\2\u0217\u021a\3\2\2\2\u0218\u0216")
        buf.write("\3\2\2\2\u0218\u0219\3\2\2\2\u0219o\3\2\2\2\u021a\u0218")
        buf.write("\3\2\2\2\u021b\u021c\b9\1\2\u021c\u021d\5r:\2\u021d\u0224")
        buf.write("\3\2\2\2\u021e\u021f\f\3\2\2\u021f\u0220\5`\61\2\u0220")
        buf.write("\u0221\5r:\2\u0221\u0223\3\2\2\2\u0222\u021e\3\2\2\2\u0223")
        buf.write("\u0226\3\2\2\2\u0224\u0222\3\2\2\2\u0224\u0225\3\2\2\2")
        buf.write("\u0225q\3\2\2\2\u0226\u0224\3\2\2\2\u0227\u0228\b:\1\2")
        buf.write("\u0228\u0229\5t;\2\u0229\u0230\3\2\2\2\u022a\u022b\f\3")
        buf.write("\2\2\u022b\u022c\5^\60\2\u022c\u022d\5t;\2\u022d\u022f")
        buf.write("\3\2\2\2\u022e\u022a\3\2\2\2\u022f\u0232\3\2\2\2\u0230")
        buf.write("\u022e\3\2\2\2\u0230\u0231\3\2\2\2\u0231s\3\2\2\2\u0232")
        buf.write("\u0230\3\2\2\2\u0233\u0234\b;\1\2\u0234\u0235\5v<\2\u0235")
        buf.write("\u023b\3\2\2\2\u0236\u0237\f\3\2\2\u0237\u0238\t\n\2\2")
        buf.write("\u0238\u023a\5v<\2\u0239\u0236\3\2\2\2\u023a\u023d\3\2")
        buf.write("\2\2\u023b\u0239\3\2\2\2\u023b\u023c\3\2\2\2\u023cu\3")
        buf.write("\2\2\2\u023d\u023b\3\2\2\2\u023e\u023f\b<\1\2\u023f\u0240")
        buf.write("\5x=\2\u0240\u0246\3\2\2\2\u0241\u0242\f\3\2\2\u0242\u0243")
        buf.write("\t\13\2\2\u0243\u0245\5x=\2\u0244\u0241\3\2\2\2\u0245")
        buf.write("\u0248\3\2\2\2\u0246\u0244\3\2\2\2\u0246\u0247\3\2\2\2")
        buf.write("\u0247w\3\2\2\2\u0248\u0246\3\2\2\2\u0249\u024a\b=\1\2")
        buf.write("\u024a\u024d\5|?\2\u024b\u024d\5z>\2\u024c\u0249\3\2\2")
        buf.write("\2\u024c\u024b\3\2\2\2\u024d\u0256\3\2\2\2\u024e\u024f")
        buf.write("\f\3\2\2\u024f\u0252\t\f\2\2\u0250\u0253\5|?\2\u0251\u0253")
        buf.write("\5z>\2\u0252\u0250\3\2\2\2\u0252\u0251\3\2\2\2\u0253\u0255")
        buf.write("\3\2\2\2\u0254\u024e\3\2\2\2\u0255\u0258\3\2\2\2\u0256")
        buf.write("\u0254\3\2\2\2\u0256\u0257\3\2\2\2\u0257y\3\2\2\2\u0258")
        buf.write("\u0256\3\2\2\2\u0259\u025a\5\\/\2\u025a\u025b\5|?\2\u025b")
        buf.write("{\3\2\2\2\u025c\u025d\b?\1\2\u025d\u0268\7Y\2\2\u025e")
        buf.write("\u0268\7\\\2\2\u025f\u0268\7_\2\2\u0260\u0268\5~@\2\u0261")
        buf.write("\u0268\7^\2\2\u0262\u0268\7a\2\2\u0263\u0264\7L\2\2\u0264")
        buf.write("\u0265\5f\64\2\u0265\u0266\7M\2\2\u0266\u0268\3\2\2\2")
        buf.write("\u0267\u025c\3\2\2\2\u0267\u025e\3\2\2\2\u0267\u025f\3")
        buf.write("\2\2\2\u0267\u0260\3\2\2\2\u0267\u0261\3\2\2\2\u0267\u0262")
        buf.write("\3\2\2\2\u0267\u0263\3\2\2\2\u0268\u0272\3\2\2\2\u0269")
        buf.write("\u026a\f\4\2\2\u026a\u026b\7H\2\2\u026b\u026c\5f\64\2")
        buf.write("\u026c\u026d\7I\2\2\u026d\u0271\3\2\2\2\u026e\u026f\f")
        buf.write("\3\2\2\u026f\u0271\5\u0080A\2\u0270\u0269\3\2\2\2\u0270")
        buf.write("\u026e\3\2\2\2\u0271\u0274\3\2\2\2\u0272\u0270\3\2\2\2")
        buf.write("\u0272\u0273\3\2\2\2\u0273}\3\2\2\2\u0274\u0272\3\2\2")
        buf.write("\2\u0275\u0276\t\r\2\2\u0276\177\3\2\2\2\u0277\u0278\t")
        buf.write("\16\2\2\u0278\u0081\3\2\2\2\u0279\u027c\5\u0084C\2\u027a")
        buf.write("\u027c\5\u0086D\2\u027b\u0279\3\2\2\2\u027b\u027a\3\2")
        buf.write("\2\2\u027c\u027d\3\2\2\2\u027d\u027e\7L\2\2\u027e\u027f")
        buf.write("\5\u0088E\2\u027f\u0280\7M\2\2\u0280\u0083\3\2\2\2\u0281")
        buf.write("\u0282\t\17\2\2\u0282\u0085\3\2\2\2\u0283\u0284\5*\26")
        buf.write("\2\u0284\u0087\3\2\2\2\u0285\u0286\5f\64\2\u0286\u0287")
        buf.write("\7Q\2\2\u0287\u0289\3\2\2\2\u0288\u0285\3\2\2\2\u0289")
        buf.write("\u028c\3\2\2\2\u028a\u0288\3\2\2\2\u028a\u028b\3\2\2\2")
        buf.write("\u028b\u028d\3\2\2\2\u028c\u028a\3\2\2\2\u028d\u028e\5")
        buf.write("f\64\2\u028e\u0089\3\2\2\2\u028f\u0290\7R\2\2\u0290\u0291")
        buf.write("\5f\64\2\u0291\u008b\3\2\2\2\u0292\u0293\t\20\2\2\u0293")
        buf.write("\u008d\3\2\2\2\u0294\u0295\7J\2\2\u0295\u0296\5\u0088")
        buf.write("E\2\u0296\u0297\7K\2\2\u0297\u029b\3\2\2\2\u0298\u029b")
        buf.write("\5B\"\2\u0299\u029b\7^\2\2\u029a\u0294\3\2\2\2\u029a\u0298")
        buf.write("\3\2\2\2\u029a\u0299\3\2\2\2\u029b\u008f\3\2\2\2\u029c")
        buf.write("\u02a6\5\f\7\2\u029d\u02a1\7J\2\2\u029e\u02a0\5\f\7\2")
        buf.write("\u029f\u029e\3\2\2\2\u02a0\u02a3\3\2\2\2\u02a1\u029f\3")
        buf.write("\2\2\2\u02a1\u02a2\3\2\2\2\u02a2\u02a4\3\2\2\2\u02a3\u02a1")
        buf.write("\3\2\2\2\u02a4\u02a6\7K\2\2\u02a5\u029c\3\2\2\2\u02a5")
        buf.write("\u029d\3\2\2\2\u02a6\u0091\3\2\2\2\u02a7\u02a8\7F\2\2")
        buf.write("\u02a8\u02a9\7L\2\2\u02a9\u02aa\5f\64\2\u02aa\u02ab\7")
        buf.write("M\2\2\u02ab\u02ae\5\u0090I\2\u02ac\u02ad\7G\2\2\u02ad")
        buf.write("\u02af\5\u0090I\2\u02ae\u02ac\3\2\2\2\u02ae\u02af\3\2")
        buf.write("\2\2\u02af\u0093\3\2\2\2G\u0097\u0099\u009f\u00a4\u00b2")
        buf.write("\u00b7\u00be\u00d6\u00de\u00e3\u00e7\u00ea\u00f1\u0107")
        buf.write("\u0109\u010e\u0114\u011a\u011f\u0124\u0128\u012b\u012e")
        buf.write("\u0134\u013b\u0147\u014e\u0152\u0155\u015c\u0169\u016b")
        buf.write("\u0172\u017a\u0181\u0185\u0189\u0193\u0199\u01a3\u01ad")
        buf.write("\u01b1\u01b9\u01c1\u01c7\u01cf\u01d2\u01e5\u01ec\u01f7")
        buf.write("\u0202\u020d\u0218\u0224\u0230\u023b\u0246\u024c\u0252")
        buf.write("\u0256\u0267\u0270\u0272\u027b\u028a\u029a\u02a1\u02a5")
        buf.write("\u02ae")
        return buf.getvalue()


class Qasm2Parser ( Parser ):

    grammarFileName = "Qasm2.g4"

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

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

    sharedContextCache = PredictionContextCache()

    literalNames = [ "<INVALID>", "'OPENQASM'", "'include'", "'qreg'", "'qubit'", 
                     "'bit'", "'creg'", "'int'", "'uint'", "'float'", "'angle'", 
                     "'fixed'", "'bool'", "'const'", "'||'", "'gate'", "'U'", 
                     "'CX'", "'cz'", "'cx'", "'cy'", "'x'", "'y'", "'z'", 
                     "'h'", "'rx'", "'ry'", "'rz'", "'measure'", "'barrier'", 
                     "'~'", "'!'", "'>'", "'<'", "'>='", "'<='", "'=='", 
                     "'!='", "'&&'", "'|'", "'^'", "'&'", "'<<'", "'>>'", 
                     "'true'", "'false'", "'++'", "'--'", "'sin'", "'cos'", 
                     "'tan'", "'exp'", "'ln'", "'sqrt'", "'rotl'", "'rotr'", 
                     "'popcount'", "'lengthof'", "'+='", "'-='", "'*='", 
                     "'/='", "'&='", "'|='", "'~='", "'^='", "'<<='", "'>>='", 
                     "'if'", "'else'", "'['", "']'", "'{'", "'}'", "'('", 
                     "')'", "':'", "';'", "'.'", "','", "'='", "'->'", "'+'", 
                     "'-'", "'*'", "'/'", "'%'" ]

    symbolicNames = [ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "LBRACKET", "RBRACKET", 
                      "LBRACE", "RBRACE", "LPAREN", "RPAREN", "COLON", "SEMICOLON", 
                      "DOT", "COMMA", "EQUALS", "ARROW", "PLUS", "MINUS", 
                      "MUL", "DIV", "MOD", "Constant", "Whitespace", "Newline", 
                      "Integer", "StretchN", "Identifier", "RealNumber", 
                      "TimingLiteral", "StringLiteral", "LineComment", "BlockComment" ]

    RULE_program = 0
    RULE_header = 1
    RULE_version = 2
    RULE_include = 3
    RULE_globalStatement = 4
    RULE_statement = 5
    RULE_quantumDeclarationStatement = 6
    RULE_classicalDeclarationStatement = 7
    RULE_assignmentStatement = 8
    RULE_returnSignature = 9
    RULE_designator = 10
    RULE_doubleDesignator = 11
    RULE_identifierList = 12
    RULE_quantumDeclaration = 13
    RULE_quantumArgument = 14
    RULE_quantumArgumentList = 15
    RULE_bitType = 16
    RULE_singleDesignatorType = 17
    RULE_doubleDesignatorType = 18
    RULE_noDesignatorType = 19
    RULE_classicalType = 20
    RULE_constantDeclaration = 21
    RULE_singleDesignatorDeclaration = 22
    RULE_doubleDesignatorDeclaration = 23
    RULE_noDesignatorDeclaration = 24
    RULE_bitDeclaration = 25
    RULE_classicalDeclaration = 26
    RULE_classicalTypeList = 27
    RULE_classicalArgument = 28
    RULE_classicalArgumentList = 29
    RULE_indexIdentifier = 30
    RULE_indexIdentifierList = 31
    RULE_rangeDefinition = 32
    RULE_quantumGateDefinition = 33
    RULE_quantumGateSignature = 34
    RULE_quantumGateParameter = 35
    RULE_quantumGateName = 36
    RULE_quantumBlock = 37
    RULE_quantumLoopBlock = 38
    RULE_quantumStatement = 39
    RULE_quantumInstruction = 40
    RULE_quantumMeasurement = 41
    RULE_quantumMeasurementAssignment = 42
    RULE_quantumBarrier = 43
    RULE_quantumGateCall = 44
    RULE_unaryOperator = 45
    RULE_comparisonOperator = 46
    RULE_equalityOperator = 47
    RULE_logicalOperator = 48
    RULE_expressionStatement = 49
    RULE_expression = 50
    RULE_logicalAndExpression = 51
    RULE_bitOrExpression = 52
    RULE_xOrExpression = 53
    RULE_bitAndExpression = 54
    RULE_equalityExpression = 55
    RULE_comparisonExpression = 56
    RULE_bitShiftExpression = 57
    RULE_additiveExpression = 58
    RULE_multiplicativeExpression = 59
    RULE_unaryExpression = 60
    RULE_expressionTerminator = 61
    RULE_booleanLiteral = 62
    RULE_incrementor = 63
    RULE_builtInCall = 64
    RULE_builtInMath = 65
    RULE_castOperator = 66
    RULE_expressionList = 67
    RULE_equalsExpression = 68
    RULE_assignmentOperator = 69
    RULE_setDeclaration = 70
    RULE_programBlock = 71
    RULE_branchingStatement = 72

    ruleNames =  [ "program", "header", "version", "include", "globalStatement", 
                   "statement", "quantumDeclarationStatement", "classicalDeclarationStatement", 
                   "assignmentStatement", "returnSignature", "designator", 
                   "doubleDesignator", "identifierList", "quantumDeclaration", 
                   "quantumArgument", "quantumArgumentList", "bitType", 
                   "singleDesignatorType", "doubleDesignatorType", "noDesignatorType", 
                   "classicalType", "constantDeclaration", "singleDesignatorDeclaration", 
                   "doubleDesignatorDeclaration", "noDesignatorDeclaration", 
                   "bitDeclaration", "classicalDeclaration", "classicalTypeList", 
                   "classicalArgument", "classicalArgumentList", "indexIdentifier", 
                   "indexIdentifierList", "rangeDefinition", "quantumGateDefinition", 
                   "quantumGateSignature", "quantumGateParameter", "quantumGateName", 
                   "quantumBlock", "quantumLoopBlock", "quantumStatement", 
                   "quantumInstruction", "quantumMeasurement", "quantumMeasurementAssignment", 
                   "quantumBarrier", "quantumGateCall", "unaryOperator", 
                   "comparisonOperator", "equalityOperator", "logicalOperator", 
                   "expressionStatement", "expression", "logicalAndExpression", 
                   "bitOrExpression", "xOrExpression", "bitAndExpression", 
                   "equalityExpression", "comparisonExpression", "bitShiftExpression", 
                   "additiveExpression", "multiplicativeExpression", "unaryExpression", 
                   "expressionTerminator", "booleanLiteral", "incrementor", 
                   "builtInCall", "builtInMath", "castOperator", "expressionList", 
                   "equalsExpression", "assignmentOperator", "setDeclaration", 
                   "programBlock", "branchingStatement" ]

    EOF = Token.EOF
    T__0=1
    T__1=2
    T__2=3
    T__3=4
    T__4=5
    T__5=6
    T__6=7
    T__7=8
    T__8=9
    T__9=10
    T__10=11
    T__11=12
    T__12=13
    T__13=14
    T__14=15
    T__15=16
    T__16=17
    T__17=18
    T__18=19
    T__19=20
    T__20=21
    T__21=22
    T__22=23
    T__23=24
    T__24=25
    T__25=26
    T__26=27
    T__27=28
    T__28=29
    T__29=30
    T__30=31
    T__31=32
    T__32=33
    T__33=34
    T__34=35
    T__35=36
    T__36=37
    T__37=38
    T__38=39
    T__39=40
    T__40=41
    T__41=42
    T__42=43
    T__43=44
    T__44=45
    T__45=46
    T__46=47
    T__47=48
    T__48=49
    T__49=50
    T__50=51
    T__51=52
    T__52=53
    T__53=54
    T__54=55
    T__55=56
    T__56=57
    T__57=58
    T__58=59
    T__59=60
    T__60=61
    T__61=62
    T__62=63
    T__63=64
    T__64=65
    T__65=66
    T__66=67
    T__67=68
    T__68=69
    LBRACKET=70
    RBRACKET=71
    LBRACE=72
    RBRACE=73
    LPAREN=74
    RPAREN=75
    COLON=76
    SEMICOLON=77
    DOT=78
    COMMA=79
    EQUALS=80
    ARROW=81
    PLUS=82
    MINUS=83
    MUL=84
    DIV=85
    MOD=86
    Constant=87
    Whitespace=88
    Newline=89
    Integer=90
    StretchN=91
    Identifier=92
    RealNumber=93
    TimingLiteral=94
    StringLiteral=95
    LineComment=96
    BlockComment=97

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




    class ProgramContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def header(self):
            return self.getTypedRuleContext(Qasm2Parser.HeaderContext,0)


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

        def globalStatement(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(Qasm2Parser.GlobalStatementContext)
            else:
                return self.getTypedRuleContext(Qasm2Parser.GlobalStatementContext,i)


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


        def getRuleIndex(self):
            return Qasm2Parser.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 program(self):

        localctx = Qasm2Parser.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 = 146
            self.header()
            self.state = 151
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << Qasm2Parser.T__2) | (1 << Qasm2Parser.T__4) | (1 << Qasm2Parser.T__5) | (1 << Qasm2Parser.T__6) | (1 << Qasm2Parser.T__7) | (1 << Qasm2Parser.T__8) | (1 << Qasm2Parser.T__9) | (1 << Qasm2Parser.T__10) | (1 << Qasm2Parser.T__11) | (1 << Qasm2Parser.T__12) | (1 << Qasm2Parser.T__14) | (1 << Qasm2Parser.T__15) | (1 << Qasm2Parser.T__16) | (1 << Qasm2Parser.T__17) | (1 << Qasm2Parser.T__18) | (1 << Qasm2Parser.T__19) | (1 << Qasm2Parser.T__20) | (1 << Qasm2Parser.T__21) | (1 << Qasm2Parser.T__22) | (1 << Qasm2Parser.T__23) | (1 << Qasm2Parser.T__24) | (1 << Qasm2Parser.T__25) | (1 << Qasm2Parser.T__26) | (1 << Qasm2Parser.T__27) | (1 << Qasm2Parser.T__28))) != 0) or _la==Qasm2Parser.T__67 or _la==Qasm2Parser.Identifier:
                self.state = 149
                self._errHandler.sync(self)
                token = self._input.LA(1)
                if token in [Qasm2Parser.T__2, Qasm2Parser.T__4, Qasm2Parser.T__5, Qasm2Parser.T__6, Qasm2Parser.T__7, Qasm2Parser.T__8, Qasm2Parser.T__9, Qasm2Parser.T__10, Qasm2Parser.T__11, Qasm2Parser.T__12, Qasm2Parser.T__14]:
                    self.state = 147
                    self.globalStatement()
                    pass
                elif token in [Qasm2Parser.T__15, Qasm2Parser.T__16, Qasm2Parser.T__17, Qasm2Parser.T__18, Qasm2Parser.T__19, Qasm2Parser.T__20, Qasm2Parser.T__21, Qasm2Parser.T__22, Qasm2Parser.T__23, Qasm2Parser.T__24, Qasm2Parser.T__25, Qasm2Parser.T__26, Qasm2Parser.T__27, Qasm2Parser.T__28, Qasm2Parser.T__67, Qasm2Parser.Identifier]:
                    self.state = 148
                    self.statement()
                    pass
                else:
                    raise NoViableAltException(self)

                self.state = 153
                self._errHandler.sync(self)
                _la = self._input.LA(1)

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


    class HeaderContext(ParserRuleContext):
        __slots__ = 'parser'

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

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


        def include(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(Qasm2Parser.IncludeContext)
            else:
                return self.getTypedRuleContext(Qasm2Parser.IncludeContext,i)


        def getRuleIndex(self):
            return Qasm2Parser.RULE_header

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

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




    def header(self):

        localctx = Qasm2Parser.HeaderContext(self, self._ctx, self.state)
        self.enterRule(localctx, 2, self.RULE_header)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 157
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==Qasm2Parser.T__0:
                self.state = 156
                self.version()


            self.state = 162
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==Qasm2Parser.T__1:
                self.state = 159
                self.include()
                self.state = 164
                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 VersionContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

        def Integer(self):
            return self.getToken(Qasm2Parser.Integer, 0)

        def RealNumber(self):
            return self.getToken(Qasm2Parser.RealNumber, 0)

        def getRuleIndex(self):
            return Qasm2Parser.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 version(self):

        localctx = Qasm2Parser.VersionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 4, self.RULE_version)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 165
            self.match(Qasm2Parser.T__0)
            self.state = 166
            _la = self._input.LA(1)
            if not(_la==Qasm2Parser.Integer or _la==Qasm2Parser.RealNumber):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
            self.state = 167
            self.match(Qasm2Parser.SEMICOLON)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class IncludeContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

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

        def getRuleIndex(self):
            return Qasm2Parser.RULE_include

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

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




    def include(self):

        localctx = Qasm2Parser.IncludeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 6, self.RULE_include)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 169
            self.match(Qasm2Parser.T__1)
            self.state = 170
            self.match(Qasm2Parser.StringLiteral)
            self.state = 171
            self.match(Qasm2Parser.SEMICOLON)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class GlobalStatementContext(ParserRuleContext):
        __slots__ = 'parser'

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

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


        def quantumGateDefinition(self):
            return self.getTypedRuleContext(Qasm2Parser.QuantumGateDefinitionContext,0)


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


        def getRuleIndex(self):
            return Qasm2Parser.RULE_globalStatement

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

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




    def globalStatement(self):

        localctx = Qasm2Parser.GlobalStatementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 8, self.RULE_globalStatement)
        try:
            self.state = 176
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [Qasm2Parser.T__2]:
                self.enterOuterAlt(localctx, 1)
                self.state = 173
                self.quantumDeclarationStatement()
                pass
            elif token in [Qasm2Parser.T__14]:
                self.enterOuterAlt(localctx, 2)
                self.state = 174
                self.quantumGateDefinition()
                pass
            elif token in [Qasm2Parser.T__4, Qasm2Parser.T__5, Qasm2Parser.T__6, Qasm2Parser.T__7, Qasm2Parser.T__8, Qasm2Parser.T__9, Qasm2Parser.T__10, Qasm2Parser.T__11, Qasm2Parser.T__12]:
                self.enterOuterAlt(localctx, 3)
                self.state = 175
                self.classicalDeclarationStatement()
                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 StatementContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def quantumStatement(self):
            return self.getTypedRuleContext(Qasm2Parser.QuantumStatementContext,0)


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


        def branchingStatement(self):
            return self.getTypedRuleContext(Qasm2Parser.BranchingStatementContext,0)


        def getRuleIndex(self):
            return Qasm2Parser.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 statement(self):

        localctx = Qasm2Parser.StatementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 10, self.RULE_statement)
        try:
            self.state = 181
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,5,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 178
                self.quantumStatement()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 179
                self.assignmentStatement()
                pass

            elif la_ == 3:
                self.enterOuterAlt(localctx, 3)
                self.state = 180
                self.branchingStatement()
                pass


        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):
        __slots__ = 'parser'

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

        def quantumDeclaration(self):
            return self.getTypedRuleContext(Qasm2Parser.QuantumDeclarationContext,0)


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

        def getRuleIndex(self):
            return Qasm2Parser.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 quantumDeclarationStatement(self):

        localctx = Qasm2Parser.QuantumDeclarationStatementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 12, self.RULE_quantumDeclarationStatement)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 183
            self.quantumDeclaration()
            self.state = 184
            self.match(Qasm2Parser.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):
        __slots__ = 'parser'

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

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

        def classicalDeclaration(self):
            return self.getTypedRuleContext(Qasm2Parser.ClassicalDeclarationContext,0)


        def constantDeclaration(self):
            return self.getTypedRuleContext(Qasm2Parser.ConstantDeclarationContext,0)


        def getRuleIndex(self):
            return Qasm2Parser.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 classicalDeclarationStatement(self):

        localctx = Qasm2Parser.ClassicalDeclarationStatementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 14, self.RULE_classicalDeclarationStatement)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 188
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [Qasm2Parser.T__4, Qasm2Parser.T__5, Qasm2Parser.T__6, Qasm2Parser.T__7, Qasm2Parser.T__8, Qasm2Parser.T__9, Qasm2Parser.T__10, Qasm2Parser.T__11]:
                self.state = 186
                self.classicalDeclaration()
                pass
            elif token in [Qasm2Parser.T__12]:
                self.state = 187
                self.constantDeclaration()
                pass
            else:
                raise NoViableAltException(self)

            self.state = 190
            self.match(Qasm2Parser.SEMICOLON)
        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):
        __slots__ = 'parser'

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

        def quantumMeasurementAssignment(self):
            return self.getTypedRuleContext(Qasm2Parser.QuantumMeasurementAssignmentContext,0)


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

        def getRuleIndex(self):
            return Qasm2Parser.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 assignmentStatement(self):

        localctx = Qasm2Parser.AssignmentStatementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 16, self.RULE_assignmentStatement)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 192
            self.quantumMeasurementAssignment()
            self.state = 193
            self.match(Qasm2Parser.SEMICOLON)
        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):
        __slots__ = 'parser'

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

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

        def classicalType(self):
            return self.getTypedRuleContext(Qasm2Parser.ClassicalTypeContext,0)


        def getRuleIndex(self):
            return Qasm2Parser.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 returnSignature(self):

        localctx = Qasm2Parser.ReturnSignatureContext(self, self._ctx, self.state)
        self.enterRule(localctx, 18, self.RULE_returnSignature)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 195
            self.match(Qasm2Parser.ARROW)
            self.state = 196
            self.classicalType()
        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):
        __slots__ = 'parser'

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

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

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


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

        def getRuleIndex(self):
            return Qasm2Parser.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 designator(self):

        localctx = Qasm2Parser.DesignatorContext(self, self._ctx, self.state)
        self.enterRule(localctx, 20, self.RULE_designator)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 198
            self.match(Qasm2Parser.LBRACKET)
            self.state = 199
            self.expression(0)
            self.state = 200
            self.match(Qasm2Parser.RBRACKET)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class DoubleDesignatorContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

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


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

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

        def getRuleIndex(self):
            return Qasm2Parser.RULE_doubleDesignator

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

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




    def doubleDesignator(self):

        localctx = Qasm2Parser.DoubleDesignatorContext(self, self._ctx, self.state)
        self.enterRule(localctx, 22, self.RULE_doubleDesignator)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 202
            self.match(Qasm2Parser.LBRACKET)
            self.state = 203
            self.expression(0)
            self.state = 204
            self.match(Qasm2Parser.COMMA)
            self.state = 205
            self.expression(0)
            self.state = 206
            self.match(Qasm2Parser.RBRACKET)
        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):
        __slots__ = 'parser'

        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(Qasm2Parser.Identifier)
            else:
                return self.getToken(Qasm2Parser.Identifier, i)

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

        def getRuleIndex(self):
            return Qasm2Parser.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 identifierList(self):

        localctx = Qasm2Parser.IdentifierListContext(self, self._ctx, self.state)
        self.enterRule(localctx, 24, self.RULE_identifierList)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 212
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,7,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 208
                    self.match(Qasm2Parser.Identifier)
                    self.state = 209
                    self.match(Qasm2Parser.COMMA) 
                self.state = 214
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,7,self._ctx)

            self.state = 215
            self.match(Qasm2Parser.Identifier)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class QuantumDeclarationContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

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


        def getRuleIndex(self):
            return Qasm2Parser.RULE_quantumDeclaration

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

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




    def quantumDeclaration(self):

        localctx = Qasm2Parser.QuantumDeclarationContext(self, self._ctx, self.state)
        self.enterRule(localctx, 26, self.RULE_quantumDeclaration)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 217
            self.match(Qasm2Parser.T__2)
            self.state = 218
            self.match(Qasm2Parser.Identifier)
            self.state = 220
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==Qasm2Parser.LBRACKET:
                self.state = 219
                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 QuantumArgumentContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

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


        def getRuleIndex(self):
            return Qasm2Parser.RULE_quantumArgument

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

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




    def quantumArgument(self):

        localctx = Qasm2Parser.QuantumArgumentContext(self, self._ctx, self.state)
        self.enterRule(localctx, 28, self.RULE_quantumArgument)
        self._la = 0 # Token type
        try:
            self.state = 232
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [Qasm2Parser.T__2]:
                self.enterOuterAlt(localctx, 1)
                self.state = 222
                self.match(Qasm2Parser.T__2)
                self.state = 223
                self.match(Qasm2Parser.Identifier)
                self.state = 225
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==Qasm2Parser.LBRACKET:
                    self.state = 224
                    self.designator()


                pass
            elif token in [Qasm2Parser.T__3]:
                self.enterOuterAlt(localctx, 2)
                self.state = 227
                self.match(Qasm2Parser.T__3)
                self.state = 229
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==Qasm2Parser.LBRACKET:
                    self.state = 228
                    self.designator()


                self.state = 231
                self.match(Qasm2Parser.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 QuantumArgumentListContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def quantumArgument(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(Qasm2Parser.QuantumArgumentContext)
            else:
                return self.getTypedRuleContext(Qasm2Parser.QuantumArgumentContext,i)


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

        def getRuleIndex(self):
            return Qasm2Parser.RULE_quantumArgumentList

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

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




    def quantumArgumentList(self):

        localctx = Qasm2Parser.QuantumArgumentListContext(self, self._ctx, self.state)
        self.enterRule(localctx, 30, self.RULE_quantumArgumentList)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 239
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,12,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 234
                    self.quantumArgument()
                    self.state = 235
                    self.match(Qasm2Parser.COMMA) 
                self.state = 241
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,12,self._ctx)

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


    class BitTypeContext(ParserRuleContext):
        __slots__ = 'parser'

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


        def getRuleIndex(self):
            return Qasm2Parser.RULE_bitType

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

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




    def bitType(self):

        localctx = Qasm2Parser.BitTypeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 32, self.RULE_bitType)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 244
            _la = self._input.LA(1)
            if not(_la==Qasm2Parser.T__4 or _la==Qasm2Parser.T__5):
                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 SingleDesignatorTypeContext(ParserRuleContext):
        __slots__ = 'parser'

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


        def getRuleIndex(self):
            return Qasm2Parser.RULE_singleDesignatorType

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

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




    def singleDesignatorType(self):

        localctx = Qasm2Parser.SingleDesignatorTypeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 34, self.RULE_singleDesignatorType)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 246
            _la = self._input.LA(1)
            if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << Qasm2Parser.T__6) | (1 << Qasm2Parser.T__7) | (1 << Qasm2Parser.T__8) | (1 << Qasm2Parser.T__9))) != 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 DoubleDesignatorTypeContext(ParserRuleContext):
        __slots__ = 'parser'

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


        def getRuleIndex(self):
            return Qasm2Parser.RULE_doubleDesignatorType

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

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




    def doubleDesignatorType(self):

        localctx = Qasm2Parser.DoubleDesignatorTypeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 36, self.RULE_doubleDesignatorType)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 248
            self.match(Qasm2Parser.T__10)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class NoDesignatorTypeContext(ParserRuleContext):
        __slots__ = 'parser'

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


        def getRuleIndex(self):
            return Qasm2Parser.RULE_noDesignatorType

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

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




    def noDesignatorType(self):

        localctx = Qasm2Parser.NoDesignatorTypeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 38, self.RULE_noDesignatorType)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 250
            self.match(Qasm2Parser.T__11)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ClassicalTypeContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def singleDesignatorType(self):
            return self.getTypedRuleContext(Qasm2Parser.SingleDesignatorTypeContext,0)


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


        def doubleDesignatorType(self):
            return self.getTypedRuleContext(Qasm2Parser.DoubleDesignatorTypeContext,0)


        def doubleDesignator(self):
            return self.getTypedRuleContext(Qasm2Parser.DoubleDesignatorContext,0)


        def noDesignatorType(self):
            return self.getTypedRuleContext(Qasm2Parser.NoDesignatorTypeContext,0)


        def bitType(self):
            return self.getTypedRuleContext(Qasm2Parser.BitTypeContext,0)


        def getRuleIndex(self):
            return Qasm2Parser.RULE_classicalType

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

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




    def classicalType(self):

        localctx = Qasm2Parser.ClassicalTypeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 40, self.RULE_classicalType)
        self._la = 0 # Token type
        try:
            self.state = 263
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [Qasm2Parser.T__6, Qasm2Parser.T__7, Qasm2Parser.T__8, Qasm2Parser.T__9]:
                self.enterOuterAlt(localctx, 1)
                self.state = 252
                self.singleDesignatorType()
                self.state = 253
                self.designator()
                pass
            elif token in [Qasm2Parser.T__10]:
                self.enterOuterAlt(localctx, 2)
                self.state = 255
                self.doubleDesignatorType()
                self.state = 256
                self.doubleDesignator()
                pass
            elif token in [Qasm2Parser.T__11]:
                self.enterOuterAlt(localctx, 3)
                self.state = 258
                self.noDesignatorType()
                pass
            elif token in [Qasm2Parser.T__4, Qasm2Parser.T__5]:
                self.enterOuterAlt(localctx, 4)
                self.state = 259
                self.bitType()
                self.state = 261
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==Qasm2Parser.LBRACKET:
                    self.state = 260
                    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 ConstantDeclarationContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

        def equalsExpression(self):
            return self.getTypedRuleContext(Qasm2Parser.EqualsExpressionContext,0)


        def getRuleIndex(self):
            return Qasm2Parser.RULE_constantDeclaration

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

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




    def constantDeclaration(self):

        localctx = Qasm2Parser.ConstantDeclarationContext(self, self._ctx, self.state)
        self.enterRule(localctx, 42, self.RULE_constantDeclaration)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 265
            self.match(Qasm2Parser.T__12)
            self.state = 266
            self.match(Qasm2Parser.Identifier)
            self.state = 268
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==Qasm2Parser.EQUALS:
                self.state = 267
                self.equalsExpression()


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


    class SingleDesignatorDeclarationContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def singleDesignatorType(self):
            return self.getTypedRuleContext(Qasm2Parser.SingleDesignatorTypeContext,0)


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


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

        def equalsExpression(self):
            return self.getTypedRuleContext(Qasm2Parser.EqualsExpressionContext,0)


        def getRuleIndex(self):
            return Qasm2Parser.RULE_singleDesignatorDeclaration

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

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




    def singleDesignatorDeclaration(self):

        localctx = Qasm2Parser.SingleDesignatorDeclarationContext(self, self._ctx, self.state)
        self.enterRule(localctx, 44, self.RULE_singleDesignatorDeclaration)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 270
            self.singleDesignatorType()
            self.state = 271
            self.designator()
            self.state = 272
            self.match(Qasm2Parser.Identifier)
            self.state = 274
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==Qasm2Parser.EQUALS:
                self.state = 273
                self.equalsExpression()


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


    class DoubleDesignatorDeclarationContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def doubleDesignatorType(self):
            return self.getTypedRuleContext(Qasm2Parser.DoubleDesignatorTypeContext,0)


        def doubleDesignator(self):
            return self.getTypedRuleContext(Qasm2Parser.DoubleDesignatorContext,0)


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

        def equalsExpression(self):
            return self.getTypedRuleContext(Qasm2Parser.EqualsExpressionContext,0)


        def getRuleIndex(self):
            return Qasm2Parser.RULE_doubleDesignatorDeclaration

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

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




    def doubleDesignatorDeclaration(self):

        localctx = Qasm2Parser.DoubleDesignatorDeclarationContext(self, self._ctx, self.state)
        self.enterRule(localctx, 46, self.RULE_doubleDesignatorDeclaration)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 276
            self.doubleDesignatorType()
            self.state = 277
            self.doubleDesignator()
            self.state = 278
            self.match(Qasm2Parser.Identifier)
            self.state = 280
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==Qasm2Parser.EQUALS:
                self.state = 279
                self.equalsExpression()


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


    class NoDesignatorDeclarationContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def noDesignatorType(self):
            return self.getTypedRuleContext(Qasm2Parser.NoDesignatorTypeContext,0)


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

        def equalsExpression(self):
            return self.getTypedRuleContext(Qasm2Parser.EqualsExpressionContext,0)


        def getRuleIndex(self):
            return Qasm2Parser.RULE_noDesignatorDeclaration

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

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




    def noDesignatorDeclaration(self):

        localctx = Qasm2Parser.NoDesignatorDeclarationContext(self, self._ctx, self.state)
        self.enterRule(localctx, 48, self.RULE_noDesignatorDeclaration)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 282
            self.noDesignatorType()
            self.state = 283
            self.match(Qasm2Parser.Identifier)
            self.state = 285
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==Qasm2Parser.EQUALS:
                self.state = 284
                self.equalsExpression()


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


    class BitDeclarationContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

        def equalsExpression(self):
            return self.getTypedRuleContext(Qasm2Parser.EqualsExpressionContext,0)


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


        def getRuleIndex(self):
            return Qasm2Parser.RULE_bitDeclaration

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

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




    def bitDeclaration(self):

        localctx = Qasm2Parser.BitDeclarationContext(self, self._ctx, self.state)
        self.enterRule(localctx, 50, self.RULE_bitDeclaration)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 297
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [Qasm2Parser.T__5]:
                self.state = 287
                self.match(Qasm2Parser.T__5)
                self.state = 288
                self.match(Qasm2Parser.Identifier)
                self.state = 290
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==Qasm2Parser.LBRACKET:
                    self.state = 289
                    self.designator()


                pass
            elif token in [Qasm2Parser.T__4]:
                self.state = 292
                self.match(Qasm2Parser.T__4)
                self.state = 294
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==Qasm2Parser.LBRACKET:
                    self.state = 293
                    self.designator()


                self.state = 296
                self.match(Qasm2Parser.Identifier)
                pass
            else:
                raise NoViableAltException(self)

            self.state = 300
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==Qasm2Parser.EQUALS:
                self.state = 299
                self.equalsExpression()


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


    class ClassicalDeclarationContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def singleDesignatorDeclaration(self):
            return self.getTypedRuleContext(Qasm2Parser.SingleDesignatorDeclarationContext,0)


        def doubleDesignatorDeclaration(self):
            return self.getTypedRuleContext(Qasm2Parser.DoubleDesignatorDeclarationContext,0)


        def noDesignatorDeclaration(self):
            return self.getTypedRuleContext(Qasm2Parser.NoDesignatorDeclarationContext,0)


        def bitDeclaration(self):
            return self.getTypedRuleContext(Qasm2Parser.BitDeclarationContext,0)


        def getRuleIndex(self):
            return Qasm2Parser.RULE_classicalDeclaration

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

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




    def classicalDeclaration(self):

        localctx = Qasm2Parser.ClassicalDeclarationContext(self, self._ctx, self.state)
        self.enterRule(localctx, 52, self.RULE_classicalDeclaration)
        try:
            self.state = 306
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [Qasm2Parser.T__6, Qasm2Parser.T__7, Qasm2Parser.T__8, Qasm2Parser.T__9]:
                self.enterOuterAlt(localctx, 1)
                self.state = 302
                self.singleDesignatorDeclaration()
                pass
            elif token in [Qasm2Parser.T__10]:
                self.enterOuterAlt(localctx, 2)
                self.state = 303
                self.doubleDesignatorDeclaration()
                pass
            elif token in [Qasm2Parser.T__11]:
                self.enterOuterAlt(localctx, 3)
                self.state = 304
                self.noDesignatorDeclaration()
                pass
            elif token in [Qasm2Parser.T__4, Qasm2Parser.T__5]:
                self.enterOuterAlt(localctx, 4)
                self.state = 305
                self.bitDeclaration()
                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 ClassicalTypeListContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def classicalType(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(Qasm2Parser.ClassicalTypeContext)
            else:
                return self.getTypedRuleContext(Qasm2Parser.ClassicalTypeContext,i)


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

        def getRuleIndex(self):
            return Qasm2Parser.RULE_classicalTypeList

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

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




    def classicalTypeList(self):

        localctx = Qasm2Parser.ClassicalTypeListContext(self, self._ctx, self.state)
        self.enterRule(localctx, 54, self.RULE_classicalTypeList)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 313
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,24,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 308
                    self.classicalType()
                    self.state = 309
                    self.match(Qasm2Parser.COMMA) 
                self.state = 315
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,24,self._ctx)

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


    class ClassicalArgumentContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

        def singleDesignatorType(self):
            return self.getTypedRuleContext(Qasm2Parser.SingleDesignatorTypeContext,0)


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


        def doubleDesignatorType(self):
            return self.getTypedRuleContext(Qasm2Parser.DoubleDesignatorTypeContext,0)


        def doubleDesignator(self):
            return self.getTypedRuleContext(Qasm2Parser.DoubleDesignatorContext,0)


        def noDesignatorType(self):
            return self.getTypedRuleContext(Qasm2Parser.NoDesignatorTypeContext,0)


        def getRuleIndex(self):
            return Qasm2Parser.RULE_classicalArgument

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

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




    def classicalArgument(self):

        localctx = Qasm2Parser.ClassicalArgumentContext(self, self._ctx, self.state)
        self.enterRule(localctx, 56, self.RULE_classicalArgument)
        self._la = 0 # Token type
        try:
            self.state = 339
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [Qasm2Parser.T__6, Qasm2Parser.T__7, Qasm2Parser.T__8, Qasm2Parser.T__9, Qasm2Parser.T__10, Qasm2Parser.T__11]:
                self.enterOuterAlt(localctx, 1)
                self.state = 325
                self._errHandler.sync(self)
                token = self._input.LA(1)
                if token in [Qasm2Parser.T__6, Qasm2Parser.T__7, Qasm2Parser.T__8, Qasm2Parser.T__9]:
                    self.state = 318
                    self.singleDesignatorType()
                    self.state = 319
                    self.designator()
                    pass
                elif token in [Qasm2Parser.T__10]:
                    self.state = 321
                    self.doubleDesignatorType()
                    self.state = 322
                    self.doubleDesignator()
                    pass
                elif token in [Qasm2Parser.T__11]:
                    self.state = 324
                    self.noDesignatorType()
                    pass
                else:
                    raise NoViableAltException(self)

                self.state = 327
                self.match(Qasm2Parser.Identifier)
                pass
            elif token in [Qasm2Parser.T__5]:
                self.enterOuterAlt(localctx, 2)
                self.state = 329
                self.match(Qasm2Parser.T__5)
                self.state = 330
                self.match(Qasm2Parser.Identifier)
                self.state = 332
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==Qasm2Parser.LBRACKET:
                    self.state = 331
                    self.designator()


                pass
            elif token in [Qasm2Parser.T__4]:
                self.enterOuterAlt(localctx, 3)
                self.state = 334
                self.match(Qasm2Parser.T__4)
                self.state = 336
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==Qasm2Parser.LBRACKET:
                    self.state = 335
                    self.designator()


                self.state = 338
                self.match(Qasm2Parser.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 ClassicalArgumentListContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def classicalArgument(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(Qasm2Parser.ClassicalArgumentContext)
            else:
                return self.getTypedRuleContext(Qasm2Parser.ClassicalArgumentContext,i)


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

        def getRuleIndex(self):
            return Qasm2Parser.RULE_classicalArgumentList

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

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




    def classicalArgumentList(self):

        localctx = Qasm2Parser.ClassicalArgumentListContext(self, self._ctx, self.state)
        self.enterRule(localctx, 58, self.RULE_classicalArgumentList)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 346
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,29,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 341
                    self.classicalArgument()
                    self.state = 342
                    self.match(Qasm2Parser.COMMA) 
                self.state = 348
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,29,self._ctx)

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


    class IndexIdentifierContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

        def rangeDefinition(self):
            return self.getTypedRuleContext(Qasm2Parser.RangeDefinitionContext,0)


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

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


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

        def indexIdentifier(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(Qasm2Parser.IndexIdentifierContext)
            else:
                return self.getTypedRuleContext(Qasm2Parser.IndexIdentifierContext,i)


        def getRuleIndex(self):
            return Qasm2Parser.RULE_indexIdentifier

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

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



    def indexIdentifier(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = Qasm2Parser.IndexIdentifierContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 60
        self.enterRecursionRule(localctx, 60, self.RULE_indexIdentifier, _p)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 361
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,31,self._ctx)
            if la_ == 1:
                self.state = 352
                self.match(Qasm2Parser.Identifier)
                self.state = 353
                self.rangeDefinition()
                pass

            elif la_ == 2:
                self.state = 354
                self.match(Qasm2Parser.Identifier)
                self.state = 359
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,30,self._ctx)
                if la_ == 1:
                    self.state = 355
                    self.match(Qasm2Parser.LBRACKET)
                    self.state = 356
                    self.expressionList()
                    self.state = 357
                    self.match(Qasm2Parser.RBRACKET)


                pass


            self._ctx.stop = self._input.LT(-1)
            self.state = 368
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,32,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    localctx = Qasm2Parser.IndexIdentifierContext(self, _parentctx, _parentState)
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_indexIdentifier)
                    self.state = 363
                    if not self.precpred(self._ctx, 1):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 1)")
                    self.state = 364
                    self.match(Qasm2Parser.T__13)
                    self.state = 365
                    self.indexIdentifier(2) 
                self.state = 370
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,32,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 IndexIdentifierListContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def indexIdentifier(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(Qasm2Parser.IndexIdentifierContext)
            else:
                return self.getTypedRuleContext(Qasm2Parser.IndexIdentifierContext,i)


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

        def getRuleIndex(self):
            return Qasm2Parser.RULE_indexIdentifierList

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

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




    def indexIdentifierList(self):

        localctx = Qasm2Parser.IndexIdentifierListContext(self, self._ctx, self.state)
        self.enterRule(localctx, 62, self.RULE_indexIdentifierList)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 376
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,33,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 371
                    self.indexIdentifier(0)
                    self.state = 372
                    self.match(Qasm2Parser.COMMA) 
                self.state = 378
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,33,self._ctx)

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


    class RangeDefinitionContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

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

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

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


        def getRuleIndex(self):
            return Qasm2Parser.RULE_rangeDefinition

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

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




    def rangeDefinition(self):

        localctx = Qasm2Parser.RangeDefinitionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 64, self.RULE_rangeDefinition)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 381
            self.match(Qasm2Parser.LBRACKET)
            self.state = 383
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << Qasm2Parser.T__29) | (1 << Qasm2Parser.T__30) | (1 << Qasm2Parser.T__43) | (1 << Qasm2Parser.T__44))) != 0) or ((((_la - 74)) & ~0x3f) == 0 and ((1 << (_la - 74)) & ((1 << (Qasm2Parser.LPAREN - 74)) | (1 << (Qasm2Parser.MINUS - 74)) | (1 << (Qasm2Parser.Constant - 74)) | (1 << (Qasm2Parser.Integer - 74)) | (1 << (Qasm2Parser.Identifier - 74)) | (1 << (Qasm2Parser.RealNumber - 74)) | (1 << (Qasm2Parser.StringLiteral - 74)))) != 0):
                self.state = 382
                self.expression(0)


            self.state = 385
            self.match(Qasm2Parser.COLON)
            self.state = 387
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << Qasm2Parser.T__29) | (1 << Qasm2Parser.T__30) | (1 << Qasm2Parser.T__43) | (1 << Qasm2Parser.T__44))) != 0) or ((((_la - 74)) & ~0x3f) == 0 and ((1 << (_la - 74)) & ((1 << (Qasm2Parser.LPAREN - 74)) | (1 << (Qasm2Parser.MINUS - 74)) | (1 << (Qasm2Parser.Constant - 74)) | (1 << (Qasm2Parser.Integer - 74)) | (1 << (Qasm2Parser.Identifier - 74)) | (1 << (Qasm2Parser.RealNumber - 74)) | (1 << (Qasm2Parser.StringLiteral - 74)))) != 0):
                self.state = 386
                self.expression(0)


            self.state = 391
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==Qasm2Parser.COLON:
                self.state = 389
                self.match(Qasm2Parser.COLON)
                self.state = 390
                self.expression(0)


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


    class QuantumGateDefinitionContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def quantumGateSignature(self):
            return self.getTypedRuleContext(Qasm2Parser.QuantumGateSignatureContext,0)


        def quantumBlock(self):
            return self.getTypedRuleContext(Qasm2Parser.QuantumBlockContext,0)


        def getRuleIndex(self):
            return Qasm2Parser.RULE_quantumGateDefinition

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

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




    def quantumGateDefinition(self):

        localctx = Qasm2Parser.QuantumGateDefinitionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 66, self.RULE_quantumGateDefinition)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 395
            self.match(Qasm2Parser.T__14)
            self.state = 396
            self.quantumGateSignature()
            self.state = 397
            self.quantumBlock()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class QuantumGateSignatureContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

        def identifierList(self):
            return self.getTypedRuleContext(Qasm2Parser.IdentifierListContext,0)


        def quantumGateParameter(self):
            return self.getTypedRuleContext(Qasm2Parser.QuantumGateParameterContext,0)


        def getRuleIndex(self):
            return Qasm2Parser.RULE_quantumGateSignature

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

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




    def quantumGateSignature(self):

        localctx = Qasm2Parser.QuantumGateSignatureContext(self, self._ctx, self.state)
        self.enterRule(localctx, 68, self.RULE_quantumGateSignature)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 399
            self.match(Qasm2Parser.Identifier)
            self.state = 401
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==Qasm2Parser.LPAREN:
                self.state = 400
                self.quantumGateParameter()


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


    class QuantumGateParameterContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

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

        def identifierList(self):
            return self.getTypedRuleContext(Qasm2Parser.IdentifierListContext,0)


        def getRuleIndex(self):
            return Qasm2Parser.RULE_quantumGateParameter

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

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




    def quantumGateParameter(self):

        localctx = Qasm2Parser.QuantumGateParameterContext(self, self._ctx, self.state)
        self.enterRule(localctx, 70, self.RULE_quantumGateParameter)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 405
            self.match(Qasm2Parser.LPAREN)
            self.state = 407
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==Qasm2Parser.Identifier:
                self.state = 406
                self.identifierList()


            self.state = 409
            self.match(Qasm2Parser.RPAREN)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class QuantumGateNameContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

        def getRuleIndex(self):
            return Qasm2Parser.RULE_quantumGateName

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

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




    def quantumGateName(self):

        localctx = Qasm2Parser.QuantumGateNameContext(self, self._ctx, self.state)
        self.enterRule(localctx, 72, self.RULE_quantumGateName)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 411
            _la = self._input.LA(1)
            if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << Qasm2Parser.T__15) | (1 << Qasm2Parser.T__16) | (1 << Qasm2Parser.T__17) | (1 << Qasm2Parser.T__18) | (1 << Qasm2Parser.T__19) | (1 << Qasm2Parser.T__20) | (1 << Qasm2Parser.T__21) | (1 << Qasm2Parser.T__22) | (1 << Qasm2Parser.T__23) | (1 << Qasm2Parser.T__24) | (1 << Qasm2Parser.T__25) | (1 << Qasm2Parser.T__26))) != 0) or _la==Qasm2Parser.Identifier):
                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 QuantumBlockContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

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

        def quantumStatement(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(Qasm2Parser.QuantumStatementContext)
            else:
                return self.getTypedRuleContext(Qasm2Parser.QuantumStatementContext,i)


        def getRuleIndex(self):
            return Qasm2Parser.RULE_quantumBlock

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

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




    def quantumBlock(self):

        localctx = Qasm2Parser.QuantumBlockContext(self, self._ctx, self.state)
        self.enterRule(localctx, 74, self.RULE_quantumBlock)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 413
            self.match(Qasm2Parser.LBRACE)
            self.state = 417
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << Qasm2Parser.T__15) | (1 << Qasm2Parser.T__16) | (1 << Qasm2Parser.T__17) | (1 << Qasm2Parser.T__18) | (1 << Qasm2Parser.T__19) | (1 << Qasm2Parser.T__20) | (1 << Qasm2Parser.T__21) | (1 << Qasm2Parser.T__22) | (1 << Qasm2Parser.T__23) | (1 << Qasm2Parser.T__24) | (1 << Qasm2Parser.T__25) | (1 << Qasm2Parser.T__26) | (1 << Qasm2Parser.T__27) | (1 << Qasm2Parser.T__28))) != 0) or _la==Qasm2Parser.Identifier:
                self.state = 414
                self.quantumStatement()
                self.state = 419
                self._errHandler.sync(self)
                _la = self._input.LA(1)

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


    class QuantumLoopBlockContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def quantumStatement(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(Qasm2Parser.QuantumStatementContext)
            else:
                return self.getTypedRuleContext(Qasm2Parser.QuantumStatementContext,i)


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

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

        def getRuleIndex(self):
            return Qasm2Parser.RULE_quantumLoopBlock

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

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




    def quantumLoopBlock(self):

        localctx = Qasm2Parser.QuantumLoopBlockContext(self, self._ctx, self.state)
        self.enterRule(localctx, 76, self.RULE_quantumLoopBlock)
        self._la = 0 # Token type
        try:
            self.state = 431
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [Qasm2Parser.T__15, Qasm2Parser.T__16, Qasm2Parser.T__17, Qasm2Parser.T__18, Qasm2Parser.T__19, Qasm2Parser.T__20, Qasm2Parser.T__21, Qasm2Parser.T__22, Qasm2Parser.T__23, Qasm2Parser.T__24, Qasm2Parser.T__25, Qasm2Parser.T__26, Qasm2Parser.T__27, Qasm2Parser.T__28, Qasm2Parser.Identifier]:
                self.enterOuterAlt(localctx, 1)
                self.state = 422
                self.quantumStatement()
                pass
            elif token in [Qasm2Parser.LBRACE]:
                self.enterOuterAlt(localctx, 2)
                self.state = 423
                self.match(Qasm2Parser.LBRACE)
                self.state = 427
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << Qasm2Parser.T__15) | (1 << Qasm2Parser.T__16) | (1 << Qasm2Parser.T__17) | (1 << Qasm2Parser.T__18) | (1 << Qasm2Parser.T__19) | (1 << Qasm2Parser.T__20) | (1 << Qasm2Parser.T__21) | (1 << Qasm2Parser.T__22) | (1 << Qasm2Parser.T__23) | (1 << Qasm2Parser.T__24) | (1 << Qasm2Parser.T__25) | (1 << Qasm2Parser.T__26) | (1 << Qasm2Parser.T__27) | (1 << Qasm2Parser.T__28))) != 0) or _la==Qasm2Parser.Identifier:
                    self.state = 424
                    self.quantumStatement()
                    self.state = 429
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

                self.state = 430
                self.match(Qasm2Parser.RBRACE)
                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 QuantumStatementContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def quantumInstruction(self):
            return self.getTypedRuleContext(Qasm2Parser.QuantumInstructionContext,0)


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

        def getRuleIndex(self):
            return Qasm2Parser.RULE_quantumStatement

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

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




    def quantumStatement(self):

        localctx = Qasm2Parser.QuantumStatementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 78, self.RULE_quantumStatement)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 433
            self.quantumInstruction()
            self.state = 434
            self.match(Qasm2Parser.SEMICOLON)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class QuantumInstructionContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def quantumGateCall(self):
            return self.getTypedRuleContext(Qasm2Parser.QuantumGateCallContext,0)


        def quantumMeasurement(self):
            return self.getTypedRuleContext(Qasm2Parser.QuantumMeasurementContext,0)


        def quantumBarrier(self):
            return self.getTypedRuleContext(Qasm2Parser.QuantumBarrierContext,0)


        def getRuleIndex(self):
            return Qasm2Parser.RULE_quantumInstruction

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

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




    def quantumInstruction(self):

        localctx = Qasm2Parser.QuantumInstructionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 80, self.RULE_quantumInstruction)
        try:
            self.state = 439
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [Qasm2Parser.T__15, Qasm2Parser.T__16, Qasm2Parser.T__17, Qasm2Parser.T__18, Qasm2Parser.T__19, Qasm2Parser.T__20, Qasm2Parser.T__21, Qasm2Parser.T__22, Qasm2Parser.T__23, Qasm2Parser.T__24, Qasm2Parser.T__25, Qasm2Parser.T__26, Qasm2Parser.Identifier]:
                self.enterOuterAlt(localctx, 1)
                self.state = 436
                self.quantumGateCall()
                pass
            elif token in [Qasm2Parser.T__27]:
                self.enterOuterAlt(localctx, 2)
                self.state = 437
                self.quantumMeasurement()
                pass
            elif token in [Qasm2Parser.T__28]:
                self.enterOuterAlt(localctx, 3)
                self.state = 438
                self.quantumBarrier()
                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 QuantumMeasurementContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def indexIdentifierList(self):
            return self.getTypedRuleContext(Qasm2Parser.IndexIdentifierListContext,0)


        def getRuleIndex(self):
            return Qasm2Parser.RULE_quantumMeasurement

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

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




    def quantumMeasurement(self):

        localctx = Qasm2Parser.QuantumMeasurementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 82, self.RULE_quantumMeasurement)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 441
            self.match(Qasm2Parser.T__27)
            self.state = 442
            self.indexIdentifierList()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class QuantumMeasurementAssignmentContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def quantumMeasurement(self):
            return self.getTypedRuleContext(Qasm2Parser.QuantumMeasurementContext,0)


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

        def indexIdentifierList(self):
            return self.getTypedRuleContext(Qasm2Parser.IndexIdentifierListContext,0)


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

        def getRuleIndex(self):
            return Qasm2Parser.RULE_quantumMeasurementAssignment

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

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




    def quantumMeasurementAssignment(self):

        localctx = Qasm2Parser.QuantumMeasurementAssignmentContext(self, self._ctx, self.state)
        self.enterRule(localctx, 84, self.RULE_quantumMeasurementAssignment)
        self._la = 0 # Token type
        try:
            self.state = 453
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [Qasm2Parser.T__27]:
                self.enterOuterAlt(localctx, 1)
                self.state = 444
                self.quantumMeasurement()
                self.state = 447
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==Qasm2Parser.ARROW:
                    self.state = 445
                    self.match(Qasm2Parser.ARROW)
                    self.state = 446
                    self.indexIdentifierList()


                pass
            elif token in [Qasm2Parser.Identifier]:
                self.enterOuterAlt(localctx, 2)
                self.state = 449
                self.indexIdentifierList()
                self.state = 450
                self.match(Qasm2Parser.EQUALS)
                self.state = 451
                self.quantumMeasurement()
                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 QuantumBarrierContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def indexIdentifierList(self):
            return self.getTypedRuleContext(Qasm2Parser.IndexIdentifierListContext,0)


        def getRuleIndex(self):
            return Qasm2Parser.RULE_quantumBarrier

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

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




    def quantumBarrier(self):

        localctx = Qasm2Parser.QuantumBarrierContext(self, self._ctx, self.state)
        self.enterRule(localctx, 86, self.RULE_quantumBarrier)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 455
            self.match(Qasm2Parser.T__28)
            self.state = 456
            self.indexIdentifierList()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class QuantumGateCallContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def quantumGateName(self):
            return self.getTypedRuleContext(Qasm2Parser.QuantumGateNameContext,0)


        def indexIdentifierList(self):
            return self.getTypedRuleContext(Qasm2Parser.IndexIdentifierListContext,0)


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

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

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


        def getRuleIndex(self):
            return Qasm2Parser.RULE_quantumGateCall

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

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




    def quantumGateCall(self):

        localctx = Qasm2Parser.QuantumGateCallContext(self, self._ctx, self.state)
        self.enterRule(localctx, 88, self.RULE_quantumGateCall)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 458
            self.quantumGateName()
            self.state = 464
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==Qasm2Parser.LPAREN:
                self.state = 459
                self.match(Qasm2Parser.LPAREN)
                self.state = 461
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << Qasm2Parser.T__29) | (1 << Qasm2Parser.T__30) | (1 << Qasm2Parser.T__43) | (1 << Qasm2Parser.T__44))) != 0) or ((((_la - 74)) & ~0x3f) == 0 and ((1 << (_la - 74)) & ((1 << (Qasm2Parser.LPAREN - 74)) | (1 << (Qasm2Parser.MINUS - 74)) | (1 << (Qasm2Parser.Constant - 74)) | (1 << (Qasm2Parser.Integer - 74)) | (1 << (Qasm2Parser.Identifier - 74)) | (1 << (Qasm2Parser.RealNumber - 74)) | (1 << (Qasm2Parser.StringLiteral - 74)))) != 0):
                    self.state = 460
                    self.expressionList()


                self.state = 463
                self.match(Qasm2Parser.RPAREN)


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


    class UnaryOperatorContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def MINUS(self):
            return self.getToken(Qasm2Parser.MINUS, 0)

        def getRuleIndex(self):
            return Qasm2Parser.RULE_unaryOperator

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

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




    def unaryOperator(self):

        localctx = Qasm2Parser.UnaryOperatorContext(self, self._ctx, self.state)
        self.enterRule(localctx, 90, self.RULE_unaryOperator)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 468
            _la = self._input.LA(1)
            if not(((((_la - 30)) & ~0x3f) == 0 and ((1 << (_la - 30)) & ((1 << (Qasm2Parser.T__29 - 30)) | (1 << (Qasm2Parser.T__30 - 30)) | (1 << (Qasm2Parser.MINUS - 30)))) != 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 ComparisonOperatorContext(ParserRuleContext):
        __slots__ = 'parser'

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


        def getRuleIndex(self):
            return Qasm2Parser.RULE_comparisonOperator

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

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




    def comparisonOperator(self):

        localctx = Qasm2Parser.ComparisonOperatorContext(self, self._ctx, self.state)
        self.enterRule(localctx, 92, self.RULE_comparisonOperator)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 470
            _la = self._input.LA(1)
            if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << Qasm2Parser.T__31) | (1 << Qasm2Parser.T__32) | (1 << Qasm2Parser.T__33) | (1 << Qasm2Parser.T__34))) != 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 EqualityOperatorContext(ParserRuleContext):
        __slots__ = 'parser'

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


        def getRuleIndex(self):
            return Qasm2Parser.RULE_equalityOperator

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

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




    def equalityOperator(self):

        localctx = Qasm2Parser.EqualityOperatorContext(self, self._ctx, self.state)
        self.enterRule(localctx, 94, self.RULE_equalityOperator)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 472
            _la = self._input.LA(1)
            if not(_la==Qasm2Parser.T__35 or _la==Qasm2Parser.T__36):
                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 LogicalOperatorContext(ParserRuleContext):
        __slots__ = 'parser'

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


        def getRuleIndex(self):
            return Qasm2Parser.RULE_logicalOperator

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

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




    def logicalOperator(self):

        localctx = Qasm2Parser.LogicalOperatorContext(self, self._ctx, self.state)
        self.enterRule(localctx, 96, self.RULE_logicalOperator)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 474
            _la = self._input.LA(1)
            if not(_la==Qasm2Parser.T__13 or _la==Qasm2Parser.T__37):
                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 ExpressionStatementContext(ParserRuleContext):
        __slots__ = 'parser'

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

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


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

        def getRuleIndex(self):
            return Qasm2Parser.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 expressionStatement(self):

        localctx = Qasm2Parser.ExpressionStatementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 98, self.RULE_expressionStatement)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 476
            self.expression(0)
            self.state = 477
            self.match(Qasm2Parser.SEMICOLON)
        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):
        __slots__ = 'parser'

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

        def expressionTerminator(self):
            return self.getTypedRuleContext(Qasm2Parser.ExpressionTerminatorContext,0)


        def unaryExpression(self):
            return self.getTypedRuleContext(Qasm2Parser.UnaryExpressionContext,0)


        def logicalAndExpression(self):
            return self.getTypedRuleContext(Qasm2Parser.LogicalAndExpressionContext,0)


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


        def getRuleIndex(self):
            return Qasm2Parser.RULE_expression

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

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



    def expression(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = Qasm2Parser.ExpressionContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 100
        self.enterRecursionRule(localctx, 100, self.RULE_expression, _p)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 483
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,47,self._ctx)
            if la_ == 1:
                self.state = 480
                self.expressionTerminator(0)
                pass

            elif la_ == 2:
                self.state = 481
                self.unaryExpression()
                pass

            elif la_ == 3:
                self.state = 482
                self.logicalAndExpression(0)
                pass


            self._ctx.stop = self._input.LT(-1)
            self.state = 490
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,48,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    localctx = Qasm2Parser.ExpressionContext(self, _parentctx, _parentState)
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_expression)
                    self.state = 485
                    if not self.precpred(self._ctx, 1):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 1)")
                    self.state = 486
                    self.match(Qasm2Parser.T__13)
                    self.state = 487
                    self.logicalAndExpression(0) 
                self.state = 492
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,48,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 LogicalAndExpressionContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def bitOrExpression(self):
            return self.getTypedRuleContext(Qasm2Parser.BitOrExpressionContext,0)


        def logicalAndExpression(self):
            return self.getTypedRuleContext(Qasm2Parser.LogicalAndExpressionContext,0)


        def getRuleIndex(self):
            return Qasm2Parser.RULE_logicalAndExpression

        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 logicalAndExpression(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = Qasm2Parser.LogicalAndExpressionContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 102
        self.enterRecursionRule(localctx, 102, self.RULE_logicalAndExpression, _p)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 494
            self.bitOrExpression(0)
            self._ctx.stop = self._input.LT(-1)
            self.state = 501
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,49,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    localctx = Qasm2Parser.LogicalAndExpressionContext(self, _parentctx, _parentState)
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_logicalAndExpression)
                    self.state = 496
                    if not self.precpred(self._ctx, 1):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 1)")
                    self.state = 497
                    self.match(Qasm2Parser.T__37)
                    self.state = 498
                    self.bitOrExpression(0) 
                self.state = 503
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,49,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 BitOrExpressionContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def xOrExpression(self):
            return self.getTypedRuleContext(Qasm2Parser.XOrExpressionContext,0)


        def bitOrExpression(self):
            return self.getTypedRuleContext(Qasm2Parser.BitOrExpressionContext,0)


        def getRuleIndex(self):
            return Qasm2Parser.RULE_bitOrExpression

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

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



    def bitOrExpression(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = Qasm2Parser.BitOrExpressionContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 104
        self.enterRecursionRule(localctx, 104, self.RULE_bitOrExpression, _p)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 505
            self.xOrExpression(0)
            self._ctx.stop = self._input.LT(-1)
            self.state = 512
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,50,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    localctx = Qasm2Parser.BitOrExpressionContext(self, _parentctx, _parentState)
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_bitOrExpression)
                    self.state = 507
                    if not self.precpred(self._ctx, 1):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 1)")
                    self.state = 508
                    self.match(Qasm2Parser.T__38)
                    self.state = 509
                    self.xOrExpression(0) 
                self.state = 514
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,50,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 XOrExpressionContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def bitAndExpression(self):
            return self.getTypedRuleContext(Qasm2Parser.BitAndExpressionContext,0)


        def xOrExpression(self):
            return self.getTypedRuleContext(Qasm2Parser.XOrExpressionContext,0)


        def getRuleIndex(self):
            return Qasm2Parser.RULE_xOrExpression

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

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



    def xOrExpression(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = Qasm2Parser.XOrExpressionContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 106
        self.enterRecursionRule(localctx, 106, self.RULE_xOrExpression, _p)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 516
            self.bitAndExpression(0)
            self._ctx.stop = self._input.LT(-1)
            self.state = 523
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,51,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    localctx = Qasm2Parser.XOrExpressionContext(self, _parentctx, _parentState)
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_xOrExpression)
                    self.state = 518
                    if not self.precpred(self._ctx, 1):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 1)")
                    self.state = 519
                    self.match(Qasm2Parser.T__39)
                    self.state = 520
                    self.bitAndExpression(0) 
                self.state = 525
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,51,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 BitAndExpressionContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def equalityExpression(self):
            return self.getTypedRuleContext(Qasm2Parser.EqualityExpressionContext,0)


        def bitAndExpression(self):
            return self.getTypedRuleContext(Qasm2Parser.BitAndExpressionContext,0)


        def getRuleIndex(self):
            return Qasm2Parser.RULE_bitAndExpression

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

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



    def bitAndExpression(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = Qasm2Parser.BitAndExpressionContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 108
        self.enterRecursionRule(localctx, 108, self.RULE_bitAndExpression, _p)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 527
            self.equalityExpression(0)
            self._ctx.stop = self._input.LT(-1)
            self.state = 534
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,52,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    localctx = Qasm2Parser.BitAndExpressionContext(self, _parentctx, _parentState)
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_bitAndExpression)
                    self.state = 529
                    if not self.precpred(self._ctx, 1):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 1)")
                    self.state = 530
                    self.match(Qasm2Parser.T__40)
                    self.state = 531
                    self.equalityExpression(0) 
                self.state = 536
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,52,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 EqualityExpressionContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def comparisonExpression(self):
            return self.getTypedRuleContext(Qasm2Parser.ComparisonExpressionContext,0)


        def equalityExpression(self):
            return self.getTypedRuleContext(Qasm2Parser.EqualityExpressionContext,0)


        def equalityOperator(self):
            return self.getTypedRuleContext(Qasm2Parser.EqualityOperatorContext,0)


        def getRuleIndex(self):
            return Qasm2Parser.RULE_equalityExpression

        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 equalityExpression(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = Qasm2Parser.EqualityExpressionContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 110
        self.enterRecursionRule(localctx, 110, self.RULE_equalityExpression, _p)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 538
            self.comparisonExpression(0)
            self._ctx.stop = self._input.LT(-1)
            self.state = 546
            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:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    localctx = Qasm2Parser.EqualityExpressionContext(self, _parentctx, _parentState)
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_equalityExpression)
                    self.state = 540
                    if not self.precpred(self._ctx, 1):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 1)")
                    self.state = 541
                    self.equalityOperator()
                    self.state = 542
                    self.comparisonExpression(0) 
                self.state = 548
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,53,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 ComparisonExpressionContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def bitShiftExpression(self):
            return self.getTypedRuleContext(Qasm2Parser.BitShiftExpressionContext,0)


        def comparisonExpression(self):
            return self.getTypedRuleContext(Qasm2Parser.ComparisonExpressionContext,0)


        def comparisonOperator(self):
            return self.getTypedRuleContext(Qasm2Parser.ComparisonOperatorContext,0)


        def getRuleIndex(self):
            return Qasm2Parser.RULE_comparisonExpression

        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 comparisonExpression(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = Qasm2Parser.ComparisonExpressionContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 112
        self.enterRecursionRule(localctx, 112, self.RULE_comparisonExpression, _p)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 550
            self.bitShiftExpression(0)
            self._ctx.stop = self._input.LT(-1)
            self.state = 558
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,54,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    localctx = Qasm2Parser.ComparisonExpressionContext(self, _parentctx, _parentState)
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_comparisonExpression)
                    self.state = 552
                    if not self.precpred(self._ctx, 1):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 1)")
                    self.state = 553
                    self.comparisonOperator()
                    self.state = 554
                    self.bitShiftExpression(0) 
                self.state = 560
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,54,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 BitShiftExpressionContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def additiveExpression(self):
            return self.getTypedRuleContext(Qasm2Parser.AdditiveExpressionContext,0)


        def bitShiftExpression(self):
            return self.getTypedRuleContext(Qasm2Parser.BitShiftExpressionContext,0)


        def getRuleIndex(self):
            return Qasm2Parser.RULE_bitShiftExpression

        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 bitShiftExpression(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = Qasm2Parser.BitShiftExpressionContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 114
        self.enterRecursionRule(localctx, 114, self.RULE_bitShiftExpression, _p)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 562
            self.additiveExpression(0)
            self._ctx.stop = self._input.LT(-1)
            self.state = 569
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,55,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    localctx = Qasm2Parser.BitShiftExpressionContext(self, _parentctx, _parentState)
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_bitShiftExpression)
                    self.state = 564
                    if not self.precpred(self._ctx, 1):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 1)")
                    self.state = 565
                    _la = self._input.LA(1)
                    if not(_la==Qasm2Parser.T__41 or _la==Qasm2Parser.T__42):
                        self._errHandler.recoverInline(self)
                    else:
                        self._errHandler.reportMatch(self)
                        self.consume()
                    self.state = 566
                    self.additiveExpression(0) 
                self.state = 571
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,55,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 AdditiveExpressionContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def multiplicativeExpression(self):
            return self.getTypedRuleContext(Qasm2Parser.MultiplicativeExpressionContext,0)


        def additiveExpression(self):
            return self.getTypedRuleContext(Qasm2Parser.AdditiveExpressionContext,0)


        def PLUS(self):
            return self.getToken(Qasm2Parser.PLUS, 0)

        def MINUS(self):
            return self.getToken(Qasm2Parser.MINUS, 0)

        def getRuleIndex(self):
            return Qasm2Parser.RULE_additiveExpression

        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 additiveExpression(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = Qasm2Parser.AdditiveExpressionContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 116
        self.enterRecursionRule(localctx, 116, self.RULE_additiveExpression, _p)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 573
            self.multiplicativeExpression(0)
            self._ctx.stop = self._input.LT(-1)
            self.state = 580
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,56,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    localctx = Qasm2Parser.AdditiveExpressionContext(self, _parentctx, _parentState)
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_additiveExpression)
                    self.state = 575
                    if not self.precpred(self._ctx, 1):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 1)")
                    self.state = 576
                    _la = self._input.LA(1)
                    if not(_la==Qasm2Parser.PLUS or _la==Qasm2Parser.MINUS):
                        self._errHandler.recoverInline(self)
                    else:
                        self._errHandler.reportMatch(self)
                        self.consume()
                    self.state = 577
                    self.multiplicativeExpression(0) 
                self.state = 582
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,56,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 MultiplicativeExpressionContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def expressionTerminator(self):
            return self.getTypedRuleContext(Qasm2Parser.ExpressionTerminatorContext,0)


        def unaryExpression(self):
            return self.getTypedRuleContext(Qasm2Parser.UnaryExpressionContext,0)


        def multiplicativeExpression(self):
            return self.getTypedRuleContext(Qasm2Parser.MultiplicativeExpressionContext,0)


        def MUL(self):
            return self.getToken(Qasm2Parser.MUL, 0)

        def DIV(self):
            return self.getToken(Qasm2Parser.DIV, 0)

        def MOD(self):
            return self.getToken(Qasm2Parser.MOD, 0)

        def getRuleIndex(self):
            return Qasm2Parser.RULE_multiplicativeExpression

        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 multiplicativeExpression(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = Qasm2Parser.MultiplicativeExpressionContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 118
        self.enterRecursionRule(localctx, 118, self.RULE_multiplicativeExpression, _p)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 586
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [Qasm2Parser.T__43, Qasm2Parser.T__44, Qasm2Parser.LPAREN, Qasm2Parser.Constant, Qasm2Parser.Integer, Qasm2Parser.Identifier, Qasm2Parser.RealNumber, Qasm2Parser.StringLiteral]:
                self.state = 584
                self.expressionTerminator(0)
                pass
            elif token in [Qasm2Parser.T__29, Qasm2Parser.T__30, Qasm2Parser.MINUS]:
                self.state = 585
                self.unaryExpression()
                pass
            else:
                raise NoViableAltException(self)

            self._ctx.stop = self._input.LT(-1)
            self.state = 596
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,59,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    localctx = Qasm2Parser.MultiplicativeExpressionContext(self, _parentctx, _parentState)
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_multiplicativeExpression)
                    self.state = 588
                    if not self.precpred(self._ctx, 1):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 1)")
                    self.state = 589
                    _la = self._input.LA(1)
                    if not(((((_la - 84)) & ~0x3f) == 0 and ((1 << (_la - 84)) & ((1 << (Qasm2Parser.MUL - 84)) | (1 << (Qasm2Parser.DIV - 84)) | (1 << (Qasm2Parser.MOD - 84)))) != 0)):
                        self._errHandler.recoverInline(self)
                    else:
                        self._errHandler.reportMatch(self)
                        self.consume()
                    self.state = 592
                    self._errHandler.sync(self)
                    token = self._input.LA(1)
                    if token in [Qasm2Parser.T__43, Qasm2Parser.T__44, Qasm2Parser.LPAREN, Qasm2Parser.Constant, Qasm2Parser.Integer, Qasm2Parser.Identifier, Qasm2Parser.RealNumber, Qasm2Parser.StringLiteral]:
                        self.state = 590
                        self.expressionTerminator(0)
                        pass
                    elif token in [Qasm2Parser.T__29, Qasm2Parser.T__30, Qasm2Parser.MINUS]:
                        self.state = 591
                        self.unaryExpression()
                        pass
                    else:
                        raise NoViableAltException(self)
             
                self.state = 598
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,59,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 UnaryExpressionContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def unaryOperator(self):
            return self.getTypedRuleContext(Qasm2Parser.UnaryOperatorContext,0)


        def expressionTerminator(self):
            return self.getTypedRuleContext(Qasm2Parser.ExpressionTerminatorContext,0)


        def getRuleIndex(self):
            return Qasm2Parser.RULE_unaryExpression

        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 unaryExpression(self):

        localctx = Qasm2Parser.UnaryExpressionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 120, self.RULE_unaryExpression)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 599
            self.unaryOperator()
            self.state = 600
            self.expressionTerminator(0)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ExpressionTerminatorContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def Constant(self):
            return self.getToken(Qasm2Parser.Constant, 0)

        def Integer(self):
            return self.getToken(Qasm2Parser.Integer, 0)

        def RealNumber(self):
            return self.getToken(Qasm2Parser.RealNumber, 0)

        def booleanLiteral(self):
            return self.getTypedRuleContext(Qasm2Parser.BooleanLiteralContext,0)


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

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

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

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


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

        def expressionTerminator(self):
            return self.getTypedRuleContext(Qasm2Parser.ExpressionTerminatorContext,0)


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

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

        def incrementor(self):
            return self.getTypedRuleContext(Qasm2Parser.IncrementorContext,0)


        def getRuleIndex(self):
            return Qasm2Parser.RULE_expressionTerminator

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

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



    def expressionTerminator(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = Qasm2Parser.ExpressionTerminatorContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 122
        self.enterRecursionRule(localctx, 122, self.RULE_expressionTerminator, _p)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 613
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [Qasm2Parser.Constant]:
                self.state = 603
                self.match(Qasm2Parser.Constant)
                pass
            elif token in [Qasm2Parser.Integer]:
                self.state = 604
                self.match(Qasm2Parser.Integer)
                pass
            elif token in [Qasm2Parser.RealNumber]:
                self.state = 605
                self.match(Qasm2Parser.RealNumber)
                pass
            elif token in [Qasm2Parser.T__43, Qasm2Parser.T__44]:
                self.state = 606
                self.booleanLiteral()
                pass
            elif token in [Qasm2Parser.Identifier]:
                self.state = 607
                self.match(Qasm2Parser.Identifier)
                pass
            elif token in [Qasm2Parser.StringLiteral]:
                self.state = 608
                self.match(Qasm2Parser.StringLiteral)
                pass
            elif token in [Qasm2Parser.LPAREN]:
                self.state = 609
                self.match(Qasm2Parser.LPAREN)
                self.state = 610
                self.expression(0)
                self.state = 611
                self.match(Qasm2Parser.RPAREN)
                pass
            else:
                raise NoViableAltException(self)

            self._ctx.stop = self._input.LT(-1)
            self.state = 624
            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:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    self.state = 622
                    self._errHandler.sync(self)
                    la_ = self._interp.adaptivePredict(self._input,61,self._ctx)
                    if la_ == 1:
                        localctx = Qasm2Parser.ExpressionTerminatorContext(self, _parentctx, _parentState)
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expressionTerminator)
                        self.state = 615
                        if not self.precpred(self._ctx, 2):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                        self.state = 616
                        self.match(Qasm2Parser.LBRACKET)
                        self.state = 617
                        self.expression(0)
                        self.state = 618
                        self.match(Qasm2Parser.RBRACKET)
                        pass

                    elif la_ == 2:
                        localctx = Qasm2Parser.ExpressionTerminatorContext(self, _parentctx, _parentState)
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expressionTerminator)
                        self.state = 620
                        if not self.precpred(self._ctx, 1):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 1)")
                        self.state = 621
                        self.incrementor()
                        pass

             
                self.state = 626
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,62,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 BooleanLiteralContext(ParserRuleContext):
        __slots__ = 'parser'

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


        def getRuleIndex(self):
            return Qasm2Parser.RULE_booleanLiteral

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

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




    def booleanLiteral(self):

        localctx = Qasm2Parser.BooleanLiteralContext(self, self._ctx, self.state)
        self.enterRule(localctx, 124, self.RULE_booleanLiteral)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 627
            _la = self._input.LA(1)
            if not(_la==Qasm2Parser.T__43 or _la==Qasm2Parser.T__44):
                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 IncrementorContext(ParserRuleContext):
        __slots__ = 'parser'

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


        def getRuleIndex(self):
            return Qasm2Parser.RULE_incrementor

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

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




    def incrementor(self):

        localctx = Qasm2Parser.IncrementorContext(self, self._ctx, self.state)
        self.enterRule(localctx, 126, self.RULE_incrementor)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 629
            _la = self._input.LA(1)
            if not(_la==Qasm2Parser.T__45 or _la==Qasm2Parser.T__46):
                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 BuiltInCallContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

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


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

        def builtInMath(self):
            return self.getTypedRuleContext(Qasm2Parser.BuiltInMathContext,0)


        def castOperator(self):
            return self.getTypedRuleContext(Qasm2Parser.CastOperatorContext,0)


        def getRuleIndex(self):
            return Qasm2Parser.RULE_builtInCall

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

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




    def builtInCall(self):

        localctx = Qasm2Parser.BuiltInCallContext(self, self._ctx, self.state)
        self.enterRule(localctx, 128, self.RULE_builtInCall)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 633
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [Qasm2Parser.T__47, Qasm2Parser.T__48, Qasm2Parser.T__49, Qasm2Parser.T__50, Qasm2Parser.T__51, Qasm2Parser.T__52, Qasm2Parser.T__53, Qasm2Parser.T__54, Qasm2Parser.T__55, Qasm2Parser.T__56]:
                self.state = 631
                self.builtInMath()
                pass
            elif token in [Qasm2Parser.T__4, Qasm2Parser.T__5, Qasm2Parser.T__6, Qasm2Parser.T__7, Qasm2Parser.T__8, Qasm2Parser.T__9, Qasm2Parser.T__10, Qasm2Parser.T__11]:
                self.state = 632
                self.castOperator()
                pass
            else:
                raise NoViableAltException(self)

            self.state = 635
            self.match(Qasm2Parser.LPAREN)
            self.state = 636
            self.expressionList()
            self.state = 637
            self.match(Qasm2Parser.RPAREN)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class BuiltInMathContext(ParserRuleContext):
        __slots__ = 'parser'

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


        def getRuleIndex(self):
            return Qasm2Parser.RULE_builtInMath

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

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




    def builtInMath(self):

        localctx = Qasm2Parser.BuiltInMathContext(self, self._ctx, self.state)
        self.enterRule(localctx, 130, self.RULE_builtInMath)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 639
            _la = self._input.LA(1)
            if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << Qasm2Parser.T__47) | (1 << Qasm2Parser.T__48) | (1 << Qasm2Parser.T__49) | (1 << Qasm2Parser.T__50) | (1 << Qasm2Parser.T__51) | (1 << Qasm2Parser.T__52) | (1 << Qasm2Parser.T__53) | (1 << Qasm2Parser.T__54) | (1 << Qasm2Parser.T__55) | (1 << Qasm2Parser.T__56))) != 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 CastOperatorContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def classicalType(self):
            return self.getTypedRuleContext(Qasm2Parser.ClassicalTypeContext,0)


        def getRuleIndex(self):
            return Qasm2Parser.RULE_castOperator

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

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




    def castOperator(self):

        localctx = Qasm2Parser.CastOperatorContext(self, self._ctx, self.state)
        self.enterRule(localctx, 132, self.RULE_castOperator)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 641
            self.classicalType()
        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):
        __slots__ = 'parser'

        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(Qasm2Parser.ExpressionContext)
            else:
                return self.getTypedRuleContext(Qasm2Parser.ExpressionContext,i)


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

        def getRuleIndex(self):
            return Qasm2Parser.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 expressionList(self):

        localctx = Qasm2Parser.ExpressionListContext(self, self._ctx, self.state)
        self.enterRule(localctx, 134, self.RULE_expressionList)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 648
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,64,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 643
                    self.expression(0)
                    self.state = 644
                    self.match(Qasm2Parser.COMMA) 
                self.state = 650
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,64,self._ctx)

            self.state = 651
            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 EqualsExpressionContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

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


        def getRuleIndex(self):
            return Qasm2Parser.RULE_equalsExpression

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

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




    def equalsExpression(self):

        localctx = Qasm2Parser.EqualsExpressionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 136, self.RULE_equalsExpression)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 653
            self.match(Qasm2Parser.EQUALS)
            self.state = 654
            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 AssignmentOperatorContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

        def getRuleIndex(self):
            return Qasm2Parser.RULE_assignmentOperator

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

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




    def assignmentOperator(self):

        localctx = Qasm2Parser.AssignmentOperatorContext(self, self._ctx, self.state)
        self.enterRule(localctx, 138, self.RULE_assignmentOperator)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 656
            _la = self._input.LA(1)
            if not(((((_la - 58)) & ~0x3f) == 0 and ((1 << (_la - 58)) & ((1 << (Qasm2Parser.T__57 - 58)) | (1 << (Qasm2Parser.T__58 - 58)) | (1 << (Qasm2Parser.T__59 - 58)) | (1 << (Qasm2Parser.T__60 - 58)) | (1 << (Qasm2Parser.T__61 - 58)) | (1 << (Qasm2Parser.T__62 - 58)) | (1 << (Qasm2Parser.T__63 - 58)) | (1 << (Qasm2Parser.T__64 - 58)) | (1 << (Qasm2Parser.T__65 - 58)) | (1 << (Qasm2Parser.T__66 - 58)) | (1 << (Qasm2Parser.EQUALS - 58)))) != 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 SetDeclarationContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

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


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

        def rangeDefinition(self):
            return self.getTypedRuleContext(Qasm2Parser.RangeDefinitionContext,0)


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

        def getRuleIndex(self):
            return Qasm2Parser.RULE_setDeclaration

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

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




    def setDeclaration(self):

        localctx = Qasm2Parser.SetDeclarationContext(self, self._ctx, self.state)
        self.enterRule(localctx, 140, self.RULE_setDeclaration)
        try:
            self.state = 664
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [Qasm2Parser.LBRACE]:
                self.enterOuterAlt(localctx, 1)
                self.state = 658
                self.match(Qasm2Parser.LBRACE)
                self.state = 659
                self.expressionList()
                self.state = 660
                self.match(Qasm2Parser.RBRACE)
                pass
            elif token in [Qasm2Parser.LBRACKET]:
                self.enterOuterAlt(localctx, 2)
                self.state = 662
                self.rangeDefinition()
                pass
            elif token in [Qasm2Parser.Identifier]:
                self.enterOuterAlt(localctx, 3)
                self.state = 663
                self.match(Qasm2Parser.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 ProgramBlockContext(ParserRuleContext):
        __slots__ = 'parser'

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

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


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

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

        def getRuleIndex(self):
            return Qasm2Parser.RULE_programBlock

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

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




    def programBlock(self):

        localctx = Qasm2Parser.ProgramBlockContext(self, self._ctx, self.state)
        self.enterRule(localctx, 142, self.RULE_programBlock)
        self._la = 0 # Token type
        try:
            self.state = 675
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [Qasm2Parser.T__15, Qasm2Parser.T__16, Qasm2Parser.T__17, Qasm2Parser.T__18, Qasm2Parser.T__19, Qasm2Parser.T__20, Qasm2Parser.T__21, Qasm2Parser.T__22, Qasm2Parser.T__23, Qasm2Parser.T__24, Qasm2Parser.T__25, Qasm2Parser.T__26, Qasm2Parser.T__27, Qasm2Parser.T__28, Qasm2Parser.T__67, Qasm2Parser.Identifier]:
                self.enterOuterAlt(localctx, 1)
                self.state = 666
                self.statement()
                pass
            elif token in [Qasm2Parser.LBRACE]:
                self.enterOuterAlt(localctx, 2)
                self.state = 667
                self.match(Qasm2Parser.LBRACE)
                self.state = 671
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << Qasm2Parser.T__15) | (1 << Qasm2Parser.T__16) | (1 << Qasm2Parser.T__17) | (1 << Qasm2Parser.T__18) | (1 << Qasm2Parser.T__19) | (1 << Qasm2Parser.T__20) | (1 << Qasm2Parser.T__21) | (1 << Qasm2Parser.T__22) | (1 << Qasm2Parser.T__23) | (1 << Qasm2Parser.T__24) | (1 << Qasm2Parser.T__25) | (1 << Qasm2Parser.T__26) | (1 << Qasm2Parser.T__27) | (1 << Qasm2Parser.T__28))) != 0) or _la==Qasm2Parser.T__67 or _la==Qasm2Parser.Identifier:
                    self.state = 668
                    self.statement()
                    self.state = 673
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

                self.state = 674
                self.match(Qasm2Parser.RBRACE)
                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 BranchingStatementContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

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


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

        def programBlock(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(Qasm2Parser.ProgramBlockContext)
            else:
                return self.getTypedRuleContext(Qasm2Parser.ProgramBlockContext,i)


        def getRuleIndex(self):
            return Qasm2Parser.RULE_branchingStatement

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

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




    def branchingStatement(self):

        localctx = Qasm2Parser.BranchingStatementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 144, self.RULE_branchingStatement)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 677
            self.match(Qasm2Parser.T__67)
            self.state = 678
            self.match(Qasm2Parser.LPAREN)
            self.state = 679
            self.expression(0)
            self.state = 680
            self.match(Qasm2Parser.RPAREN)
            self.state = 681
            self.programBlock()
            self.state = 684
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,68,self._ctx)
            if la_ == 1:
                self.state = 682
                self.match(Qasm2Parser.T__68)
                self.state = 683
                self.programBlock()


        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[30] = self.indexIdentifier_sempred
        self._predicates[50] = self.expression_sempred
        self._predicates[51] = self.logicalAndExpression_sempred
        self._predicates[52] = self.bitOrExpression_sempred
        self._predicates[53] = self.xOrExpression_sempred
        self._predicates[54] = self.bitAndExpression_sempred
        self._predicates[55] = self.equalityExpression_sempred
        self._predicates[56] = self.comparisonExpression_sempred
        self._predicates[57] = self.bitShiftExpression_sempred
        self._predicates[58] = self.additiveExpression_sempred
        self._predicates[59] = self.multiplicativeExpression_sempred
        self._predicates[61] = self.expressionTerminator_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 indexIdentifier_sempred(self, localctx:IndexIdentifierContext, predIndex:int):
            if predIndex == 0:
                return self.precpred(self._ctx, 1)
         

    def expression_sempred(self, localctx:ExpressionContext, predIndex:int):
            if predIndex == 1:
                return self.precpred(self._ctx, 1)
         

    def logicalAndExpression_sempred(self, localctx:LogicalAndExpressionContext, predIndex:int):
            if predIndex == 2:
                return self.precpred(self._ctx, 1)
         

    def bitOrExpression_sempred(self, localctx:BitOrExpressionContext, predIndex:int):
            if predIndex == 3:
                return self.precpred(self._ctx, 1)
         

    def xOrExpression_sempred(self, localctx:XOrExpressionContext, predIndex:int):
            if predIndex == 4:
                return self.precpred(self._ctx, 1)
         

    def bitAndExpression_sempred(self, localctx:BitAndExpressionContext, predIndex:int):
            if predIndex == 5:
                return self.precpred(self._ctx, 1)
         

    def equalityExpression_sempred(self, localctx:EqualityExpressionContext, predIndex:int):
            if predIndex == 6:
                return self.precpred(self._ctx, 1)
         

    def comparisonExpression_sempred(self, localctx:ComparisonExpressionContext, predIndex:int):
            if predIndex == 7:
                return self.precpred(self._ctx, 1)
         

    def bitShiftExpression_sempred(self, localctx:BitShiftExpressionContext, predIndex:int):
            if predIndex == 8:
                return self.precpred(self._ctx, 1)
         

    def additiveExpression_sempred(self, localctx:AdditiveExpressionContext, predIndex:int):
            if predIndex == 9:
                return self.precpred(self._ctx, 1)
         

    def multiplicativeExpression_sempred(self, localctx:MultiplicativeExpressionContext, predIndex:int):
            if predIndex == 10:
                return self.precpred(self._ctx, 1)
         

    def expressionTerminator_sempred(self, localctx:ExpressionTerminatorContext, predIndex:int):
            if predIndex == 11:
                return self.precpred(self._ctx, 2)
         

            if predIndex == 12:
                return self.precpred(self._ctx, 1)
         





# Copyright 2021 SpinQ Technology Co., Ltd. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # #     http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # Generated from Qasm2.g4 by ANTLR 4.9.2 # encoding: utf-8 #\t#\4$\t$\4%\t%\4&\t") #\3#\3#\3#\3$\3$\5$\u0194") #\2\u00b1") #\3\2") # Token type # Token type # Token type # Token type # Token type # Token type # Token type # Token type # Token type # Token type # Token type # Token type # Token type # Token type # Token type # Token type # Token type # Token type # Token type # Token type # Token type # Token type # Token type # Token type # Token type # Token type # Token type # Token type # Token type # Token type # Token type # Token type # Token type # Token type