<gh_stars>10-100
# Generated from Sygus.g4 by ANTLR 4.7.1
# encoding: utf-8
from antlr4 import *
from io import StringIO
from typing.io import TextIO
import sys

def serializedATN():
    with StringIO() as buf:
        buf.write("\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3%")
        buf.write("\u01ca\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\3\2\3\2\5\2o\n\2\3\3\3\3\3\3\3\3")
        buf.write("\5\3u\n\3\3\4\3\4\3\5\3\5\3\5\3\5\3\5\3\6\3\6\3\6\3\7")
        buf.write("\3\7\3\7\3\7\5\7\u0085\n\7\3\b\3\b\3\b\3\b\3\b\3\b\3\b")
        buf.write("\3\b\3\b\3\b\3\b\5\b\u0092\n\b\3\t\3\t\3\t\3\t\3\t\3\t")
        buf.write("\3\n\3\n\3\n\3\n\3\n\3\n\3\13\3\13\3\13\3\13\3\13\3\13")
        buf.write("\3\13\3\13\3\13\3\13\3\13\3\13\3\13\3\13\3\13\3\13\3\13")
        buf.write("\3\13\3\13\3\13\5\13\u00b4\n\13\3\f\3\f\3\r\3\r\3\16\3")
        buf.write("\16\3\17\3\17\3\17\3\17\3\20\3\20\3\21\3\21\3\21\3\21")
        buf.write("\3\22\3\22\3\22\3\23\3\23\3\23\3\23\5\23\u00cd\n\23\3")
        buf.write("\24\3\24\3\24\3\24\3\24\3\25\3\25\3\25\3\25\3\26\3\26")
        buf.write("\3\26\3\27\3\27\3\27\3\27\5\27\u00df\n\27\3\30\3\30\3")
        buf.write("\30\3\30\3\30\3\31\3\31\3\31\3\31\3\31\3\31\3\31\3\31")
        buf.write("\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\33\3\33")
        buf.write("\3\33\3\33\5\33\u00fb\n\33\3\34\3\34\3\34\3\34\3\35\3")
        buf.write("\35\3\35\3\35\5\35\u0105\n\35\3\36\3\36\3\36\3\36\3\36")
        buf.write("\3\37\3\37\3\37\3\37\3\37\3\37\3\37\3\37\5\37\u0114\n")
        buf.write("\37\3 \3 \3 \3 \3 \3 \3 \3 \3!\3!\3!\3\"\3\"\3\"\3\"\5")
        buf.write("\"\u0125\n\"\3#\3#\3#\3#\3#\3#\3$\3$\3$\3$\5$\u0131\n")
        buf.write("$\3%\3%\3%\3%\3%\5%\u0138\n%\3&\3&\3&\3\'\3\'\3\'\3\'")
        buf.write("\5\'\u0141\n\'\3(\3(\3(\3(\3(\3(\3(\3(\3)\3)\3)\3*\3*")
        buf.write("\3*\3*\5*\u0152\n*\3+\3+\3+\3+\3,\3,\3,\3,\3,\3-\3-\3")
        buf.write("-\3-\3-\3-\3-\3-\3-\3-\3-\3-\3-\3-\3-\3-\3-\5-\u016e\n")
        buf.write("-\3.\3.\3.\3.\3.\3.\3.\3.\3.\3.\3.\3.\3.\3.\3.\3.\3.\3")
        buf.write(".\3.\3.\3.\3.\3.\3.\3.\3.\3.\3.\5.\u018c\n.\3/\3/\3/\3")
        buf.write("/\3/\3/\3/\3/\3\60\3\60\3\60\3\61\3\61\3\61\3\61\5\61")
        buf.write("\u019d\n\61\3\62\3\62\3\62\3\62\3\62\3\62\3\63\3\63\3")
        buf.write("\63\3\63\5\63\u01a9\n\63\3\64\3\64\3\64\3\64\3\64\3\64")
        buf.write("\3\64\3\64\3\64\3\64\3\64\3\64\3\64\3\64\3\64\5\64\u01ba")
        buf.write("\n\64\3\65\3\65\3\65\3\65\3\65\3\65\3\66\3\66\3\66\3\66")
        buf.write("\3\66\3\66\3\66\3\66\3\66\2\2\67\2\4\6\b\n\f\16\20\22")
        buf.write("\24\26\30\32\34\36 \"$&(*,.\60\62\64\668:<>@BDFHJLNPR")
        buf.write("TVXZ\\^`bdfhj\2\3\3\2\16\17\2\u01c1\2n\3\2\2\2\4t\3\2")
        buf.write("\2\2\6v\3\2\2\2\bx\3\2\2\2\n}\3\2\2\2\f\u0084\3\2\2\2")
        buf.write("\16\u0091\3\2\2\2\20\u0093\3\2\2\2\22\u0099\3\2\2\2\24")
        buf.write("\u00b3\3\2\2\2\26\u00b5\3\2\2\2\30\u00b7\3\2\2\2\32\u00b9")
        buf.write("\3\2\2\2\34\u00bb\3\2\2\2\36\u00bf\3\2\2\2 \u00c1\3\2")
        buf.write("\2\2\"\u00c5\3\2\2\2$\u00cc\3\2\2\2&\u00ce\3\2\2\2(\u00d3")
        buf.write("\3\2\2\2*\u00d7\3\2\2\2,\u00de\3\2\2\2.\u00e0\3\2\2\2")
        buf.write("\60\u00e5\3\2\2\2\62\u00ed\3\2\2\2\64\u00fa\3\2\2\2\66")
        buf.write("\u00fc\3\2\2\28\u0104\3\2\2\2:\u0106\3\2\2\2<\u0113\3")
        buf.write("\2\2\2>\u0115\3\2\2\2@\u011d\3\2\2\2B\u0124\3\2\2\2D\u0126")
        buf.write("\3\2\2\2F\u0130\3\2\2\2H\u0137\3\2\2\2J\u0139\3\2\2\2")
        buf.write("L\u0140\3\2\2\2N\u0142\3\2\2\2P\u014a\3\2\2\2R\u0151\3")
        buf.write("\2\2\2T\u0153\3\2\2\2V\u0157\3\2\2\2X\u016d\3\2\2\2Z\u018b")
        buf.write("\3\2\2\2\\\u018d\3\2\2\2^\u0195\3\2\2\2`\u019c\3\2\2\2")
        buf.write("b\u019e\3\2\2\2d\u01a8\3\2\2\2f\u01b9\3\2\2\2h\u01bb\3")
        buf.write("\2\2\2j\u01c1\3\2\2\2lo\5\4\3\2mo\3\2\2\2nl\3\2\2\2nm")
        buf.write("\3\2\2\2o\3\3\2\2\2pq\5\b\5\2qr\5\n\6\2ru\3\2\2\2su\5")
        buf.write("\n\6\2tp\3\2\2\2ts\3\2\2\2u\5\3\2\2\2vw\7%\2\2w\7\3\2")
        buf.write("\2\2xy\7\3\2\2yz\7\4\2\2z{\5\6\4\2{|\7\5\2\2|\t\3\2\2")
        buf.write("\2}~\5\16\b\2~\177\5\f\7\2\177\13\3\2\2\2\u0080\u0081")
        buf.write("\5\16\b\2\u0081\u0082\5\f\7\2\u0082\u0085\3\2\2\2\u0083")
        buf.write("\u0085\3\2\2\2\u0084\u0080\3\2\2\2\u0084\u0083\3\2\2\2")
        buf.write("\u0085\r\3\2\2\2\u0086\u0092\5\60\31\2\u0087\u0092\5\62")
        buf.write("\32\2\u0088\u0092\5X-\2\u0089\u0092\5T+\2\u008a\u0092")
        buf.write("\5V,\2\u008b\u0092\5\22\n\2\u008c\u0092\5&\24\2\u008d")
        buf.write("\u0092\5\20\t\2\u008e\u0092\5f\64\2\u008f\u0092\5h\65")
        buf.write("\2\u0090\u0092\5j\66\2\u0091\u0086\3\2\2\2\u0091\u0087")
        buf.write("\3\2\2\2\u0091\u0088\3\2\2\2\u0091\u0089\3\2\2\2\u0091")
        buf.write("\u008a\3\2\2\2\u0091\u008b\3\2\2\2\u0091\u008c\3\2\2\2")
        buf.write("\u0091\u008d\3\2\2\2\u0091\u008e\3\2\2\2\u0091\u008f\3")
        buf.write("\2\2\2\u0091\u0090\3\2\2\2\u0092\17\3\2\2\2\u0093\u0094")
        buf.write("\7\3\2\2\u0094\u0095\7\6\2\2\u0095\u0096\5\6\4\2\u0096")
        buf.write("\u0097\5\24\13\2\u0097\u0098\7\5\2\2\u0098\21\3\2\2\2")
        buf.write("\u0099\u009a\7\3\2\2\u009a\u009b\7\7\2\2\u009b\u009c\5")
        buf.write("\6\4\2\u009c\u009d\5\24\13\2\u009d\u009e\7\5\2\2\u009e")
        buf.write("\23\3\2\2\2\u009f\u00a0\7\3\2\2\u00a0\u00a1\7\b\2\2\u00a1")
        buf.write("\u00a2\5\26\f\2\u00a2\u00a3\7\5\2\2\u00a3\u00b4\3\2\2")
        buf.write("\2\u00a4\u00b4\7\t\2\2\u00a5\u00b4\7\n\2\2\u00a6\u00b4")
        buf.write("\7\13\2\2\u00a7\u00a8\7\3\2\2\u00a8\u00a9\7\f\2\2\u00a9")
        buf.write("\u00aa\5 \21\2\u00aa\u00ab\7\5\2\2\u00ab\u00b4\3\2\2\2")
        buf.write("\u00ac\u00ad\7\3\2\2\u00ad\u00ae\7\r\2\2\u00ae\u00af\5")
        buf.write("\24\13\2\u00af\u00b0\5\24\13\2\u00b0\u00b1\7\5\2\2\u00b1")
        buf.write("\u00b4\3\2\2\2\u00b2\u00b4\5\6\4\2\u00b3\u009f\3\2\2\2")
        buf.write("\u00b3\u00a4\3\2\2\2\u00b3\u00a5\3\2\2\2\u00b3\u00a6\3")
        buf.write("\2\2\2\u00b3\u00a7\3\2\2\2\u00b3\u00ac\3\2\2\2\u00b3\u00b2")
        buf.write("\3\2\2\2\u00b4\25\3\2\2\2\u00b5\u00b6\7!\2\2\u00b6\27")
        buf.write("\3\2\2\2\u00b7\u00b8\t\2\2\2\u00b8\31\3\2\2\2\u00b9\u00ba")
        buf.write("\7\"\2\2\u00ba\33\3\2\2\2\u00bb\u00bc\5\6\4\2\u00bc\u00bd")
        buf.write("\7\20\2\2\u00bd\u00be\5\6\4\2\u00be\35\3\2\2\2\u00bf\u00c0")
        buf.write("\7#\2\2\u00c0\37\3\2\2\2\u00c1\u00c2\7\3\2\2\u00c2\u00c3")
        buf.write("\5\"\22\2\u00c3\u00c4\7\5\2\2\u00c4!\3\2\2\2\u00c5\u00c6")
        buf.write("\5\6\4\2\u00c6\u00c7\5$\23\2\u00c7#\3\2\2\2\u00c8\u00c9")
        buf.write("\5\6\4\2\u00c9\u00ca\5$\23\2\u00ca\u00cd\3\2\2\2\u00cb")
        buf.write("\u00cd\3\2\2\2\u00cc\u00c8\3\2\2\2\u00cc\u00cb\3\2\2\2")
        buf.write("\u00cd%\3\2\2\2\u00ce\u00cf\7\3\2\2\u00cf\u00d0\7\21\2")
        buf.write("\2\u00d0\u00d1\5(\25\2\u00d1\u00d2\7\5\2\2\u00d2\'\3\2")
        buf.write("\2\2\u00d3\u00d4\7\3\2\2\u00d4\u00d5\5*\26\2\u00d5\u00d6")
        buf.write("\7\5\2\2\u00d6)\3\2\2\2\u00d7\u00d8\5.\30\2\u00d8\u00d9")
        buf.write("\5,\27\2\u00d9+\3\2\2\2\u00da\u00db\5.\30\2\u00db\u00dc")
        buf.write("\5,\27\2\u00dc\u00df\3\2\2\2\u00dd\u00df\3\2\2\2\u00de")
        buf.write("\u00da\3\2\2\2\u00de\u00dd\3\2\2\2\u00df-\3\2\2\2\u00e0")
        buf.write("\u00e1\7\3\2\2\u00e1\u00e2\5\6\4\2\u00e2\u00e3\7$\2\2")
        buf.write("\u00e3\u00e4\7\5\2\2\u00e4/\3\2\2\2\u00e5\u00e6\7\3\2")
        buf.write("\2\u00e6\u00e7\7\22\2\2\u00e7\u00e8\5\6\4\2\u00e8\u00e9")
        buf.write("\5\66\34\2\u00e9\u00ea\5\24\13\2\u00ea\u00eb\5<\37\2\u00eb")
        buf.write("\u00ec\7\5\2\2\u00ec\61\3\2\2\2\u00ed\u00ee\7\3\2\2\u00ee")
        buf.write("\u00ef\7\23\2\2\u00ef\u00f0\5\6\4\2\u00f0\u00f1\7\3\2")
        buf.write("\2\u00f1\u00f2\5\64\33\2\u00f2\u00f3\7\5\2\2\u00f3\u00f4")
        buf.write("\5\24\13\2\u00f4\u00f5\7\5\2\2\u00f5\63\3\2\2\2\u00f6")
        buf.write("\u00f7\5\24\13\2\u00f7\u00f8\5\64\33\2\u00f8\u00fb\3\2")
        buf.write("\2\2\u00f9\u00fb\3\2\2\2\u00fa\u00f6\3\2\2\2\u00fa\u00f9")
        buf.write("\3\2\2\2\u00fb\65\3\2\2\2\u00fc\u00fd\7\3\2\2\u00fd\u00fe")
        buf.write("\58\35\2\u00fe\u00ff\7\5\2\2\u00ff\67\3\2\2\2\u0100\u0101")
        buf.write("\5:\36\2\u0101\u0102\58\35\2\u0102\u0105\3\2\2\2\u0103")
        buf.write("\u0105\3\2\2\2\u0104\u0100\3\2\2\2\u0104\u0103\3\2\2\2")
        buf.write("\u01059\3\2\2\2\u0106\u0107\7\3\2\2\u0107\u0108\5\6\4")
        buf.write("\2\u0108\u0109\5\24\13\2\u0109\u010a\7\5\2\2\u010a;\3")
        buf.write("\2\2\2\u010b\u010c\7\3\2\2\u010c\u010d\5\6\4\2\u010d\u010e")
        buf.write("\5F$\2\u010e\u010f\7\5\2\2\u010f\u0114\3\2\2\2\u0110\u0114")
        buf.write("\5H%\2\u0111\u0114\5\6\4\2\u0112\u0114\5> \2\u0113\u010b")
        buf.write("\3\2\2\2\u0113\u0110\3\2\2\2\u0113\u0111\3\2\2\2\u0113")
        buf.write("\u0112\3\2\2\2\u0114=\3\2\2\2\u0115\u0116\7\3\2\2\u0116")
        buf.write("\u0117\7\24\2\2\u0117\u0118\7\3\2\2\u0118\u0119\5@!\2")
        buf.write("\u0119\u011a\7\5\2\2\u011a\u011b\5<\37\2\u011b\u011c\7")
        buf.write("\5\2\2\u011c?\3\2\2\2\u011d\u011e\5D#\2\u011e\u011f\5")
        buf.write("B\"\2\u011fA\3\2\2\2\u0120\u0121\5D#\2\u0121\u0122\5B")
        buf.write("\"\2\u0122\u0125\3\2\2\2\u0123\u0125\3\2\2\2\u0124\u0120")
        buf.write("\3\2\2\2\u0124\u0123\3\2\2\2\u0125C\3\2\2\2\u0126\u0127")
        buf.write("\7\3\2\2\u0127\u0128\5\6\4\2\u0128\u0129\5\24\13\2\u0129")
        buf.write("\u012a\5<\37\2\u012a\u012b\7\5\2\2\u012bE\3\2\2\2\u012c")
        buf.write("\u012d\5<\37\2\u012d\u012e\5F$\2\u012e\u0131\3\2\2\2\u012f")
        buf.write("\u0131\3\2\2\2\u0130\u012c\3\2\2\2\u0130\u012f\3\2\2\2")
        buf.write("\u0131G\3\2\2\2\u0132\u0138\5\26\f\2\u0133\u0138\5\30")
        buf.write("\r\2\u0134\u0138\5\32\16\2\u0135\u0138\5\34\17\2\u0136")
        buf.write("\u0138\5\36\20\2\u0137\u0132\3\2\2\2\u0137\u0133\3\2\2")
        buf.write("\2\u0137\u0134\3\2\2\2\u0137\u0135\3\2\2\2\u0137\u0136")
        buf.write("\3\2\2\2\u0138I\3\2\2\2\u0139\u013a\5N(\2\u013a\u013b")
        buf.write("\5L\'\2\u013bK\3\2\2\2\u013c\u013d\5N(\2\u013d\u013e\5")
        buf.write("L\'\2\u013e\u0141\3\2\2\2\u013f\u0141\3\2\2\2\u0140\u013c")
        buf.write("\3\2\2\2\u0140\u013f\3\2\2\2\u0141M\3\2\2\2\u0142\u0143")
        buf.write("\7\3\2\2\u0143\u0144\5\6\4\2\u0144\u0145\5\24\13\2\u0145")
        buf.write("\u0146\7\3\2\2\u0146\u0147\5P)\2\u0147\u0148\7\5\2\2\u0148")
        buf.write("\u0149\7\5\2\2\u0149O\3\2\2\2\u014a\u014b\5Z.\2\u014b")
        buf.write("\u014c\5R*\2\u014cQ\3\2\2\2\u014d\u014e\5Z.\2\u014e\u014f")
        buf.write("\5R*\2\u014f\u0152\3\2\2\2\u0150\u0152\3\2\2\2\u0151\u014d")
        buf.write("\3\2\2\2\u0151\u0150\3\2\2\2\u0152S\3\2\2\2\u0153\u0154")
        buf.write("\7\3\2\2\u0154\u0155\7\25\2\2\u0155\u0156\7\5\2\2\u0156")
        buf.write("U\3\2\2\2\u0157\u0158\7\3\2\2\u0158\u0159\7\26\2\2\u0159")
        buf.write("\u015a\5<\37\2\u015a\u015b\7\5\2\2\u015bW\3\2\2\2\u015c")
        buf.write("\u015d\7\3\2\2\u015d\u015e\7\27\2\2\u015e\u015f\5\6\4")
        buf.write("\2\u015f\u0160\5\66\34\2\u0160\u0161\5\24\13\2\u0161\u0162")
        buf.write("\7\3\2\2\u0162\u0163\5J&\2\u0163\u0164\7\5\2\2\u0164\u0165")
        buf.write("\7\5\2\2\u0165\u016e\3\2\2\2\u0166\u0167\7\3\2\2\u0167")
        buf.write("\u0168\7\27\2\2\u0168\u0169\5\6\4\2\u0169\u016a\5\66\34")
        buf.write("\2\u016a\u016b\5\24\13\2\u016b\u016c\7\5\2\2\u016c\u016e")
        buf.write("\3\2\2\2\u016d\u015c\3\2\2\2\u016d\u0166\3\2\2\2\u016e")
        buf.write("Y\3\2\2\2\u016f\u018c\5\6\4\2\u0170\u018c\5H%\2\u0171")
        buf.write("\u0172\7\3\2\2\u0172\u0173\5\6\4\2\u0173\u0174\5d\63\2")
        buf.write("\u0174\u0175\7\5\2\2\u0175\u018c\3\2\2\2\u0176\u0177\7")
        buf.write("\3\2\2\u0177\u0178\7\30\2\2\u0178\u0179\5\24\13\2\u0179")
        buf.write("\u017a\7\5\2\2\u017a\u018c\3\2\2\2\u017b\u017c\7\3\2\2")
        buf.write("\u017c\u017d\7\31\2\2\u017d\u017e\5\24\13\2\u017e\u017f")
        buf.write("\7\5\2\2\u017f\u018c\3\2\2\2\u0180\u0181\7\3\2\2\u0181")
        buf.write("\u0182\7\32\2\2\u0182\u0183\5\24\13\2\u0183\u0184\7\5")
        buf.write("\2\2\u0184\u018c\3\2\2\2\u0185\u0186\7\3\2\2\u0186\u0187")
        buf.write("\7\33\2\2\u0187\u0188\5\24\13\2\u0188\u0189\7\5\2\2\u0189")
        buf.write("\u018c\3\2\2\2\u018a\u018c\5\\/\2\u018b\u016f\3\2\2\2")
        buf.write("\u018b\u0170\3\2\2\2\u018b\u0171\3\2\2\2\u018b\u0176\3")
        buf.write("\2\2\2\u018b\u017b\3\2\2\2\u018b\u0180\3\2\2\2\u018b\u0185")
        buf.write("\3\2\2\2\u018b\u018a\3\2\2\2\u018c[\3\2\2\2\u018d\u018e")
        buf.write("\7\3\2\2\u018e\u018f\7\24\2\2\u018f\u0190\7\3\2\2\u0190")
        buf.write("\u0191\5^\60\2\u0191\u0192\7\5\2\2\u0192\u0193\5Z.\2\u0193")
        buf.write("\u0194\7\5\2\2\u0194]\3\2\2\2\u0195\u0196\5b\62\2\u0196")
        buf.write("\u0197\5`\61\2\u0197_\3\2\2\2\u0198\u0199\5b\62\2\u0199")
        buf.write("\u019a\5`\61\2\u019a\u019d\3\2\2\2\u019b\u019d\3\2\2\2")
        buf.write("\u019c\u0198\3\2\2\2\u019c\u019b\3\2\2\2\u019da\3\2\2")
        buf.write("\2\u019e\u019f\7\3\2\2\u019f\u01a0\5\6\4\2\u01a0\u01a1")
        buf.write("\5\24\13\2\u01a1\u01a2\5Z.\2\u01a2\u01a3\7\5\2\2\u01a3")
        buf.write("c\3\2\2\2\u01a4\u01a5\5Z.\2\u01a5\u01a6\5d\63\2\u01a6")
        buf.write("\u01a9\3\2\2\2\u01a7\u01a9\3\2\2\2\u01a8\u01a4\3\2\2\2")
        buf.write("\u01a8\u01a7\3\2\2\2\u01a9e\3\2\2\2\u01aa\u01ab\7\3\2")
        buf.write("\2\u01ab\u01ac\7\34\2\2\u01ac\u01ad\5\6\4\2\u01ad\u01ae")
        buf.write("\5\66\34\2\u01ae\u01af\7\3\2\2\u01af\u01b0\5J&\2\u01b0")
        buf.write("\u01b1\7\5\2\2\u01b1\u01b2\7\5\2\2\u01b2\u01ba\3\2\2\2")
        buf.write("\u01b3\u01b4\7\3\2\2\u01b4\u01b5\7\34\2\2\u01b5\u01b6")
        buf.write("\5\6\4\2\u01b6\u01b7\5\66\34\2\u01b7\u01b8\7\5\2\2\u01b8")
        buf.write("\u01ba\3\2\2\2\u01b9\u01aa\3\2\2\2\u01b9\u01b3\3\2\2\2")
        buf.write("\u01bag\3\2\2\2\u01bb\u01bc\7\3\2\2\u01bc\u01bd\7\35\2")
        buf.write("\2\u01bd\u01be\5\6\4\2\u01be\u01bf\5\24\13\2\u01bf\u01c0")
        buf.write("\7\5\2\2\u01c0i\3\2\2\2\u01c1\u01c2\7\3\2\2\u01c2\u01c3")
        buf.write("\7\36\2\2\u01c3\u01c4\5\6\4\2\u01c4\u01c5\5\6\4\2\u01c5")
        buf.write("\u01c6\5\6\4\2\u01c6\u01c7\5\6\4\2\u01c7\u01c8\7\5\2\2")
        buf.write("\u01c8k\3\2\2\2\26nt\u0084\u0091\u00b3\u00cc\u00de\u00fa")
        buf.write("\u0104\u0113\u0124\u0130\u0137\u0140\u0151\u016d\u018b")
        buf.write("\u019c\u01a8\u01b9")
        return buf.getvalue()


class SygusParser ( Parser ):

    grammarFileName = "Sygus.g4"

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

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

    sharedContextCache = PredictionContextCache()

    literalNames = [ "<INVALID>", "'('", "'set-logic'", "')'", "'declare-var'", 
                     "'define-sort'", "'BitVec'", "'Int'", "'Bool'", "'Real'", 
                     "'Enum'", "'Array'", "'true'", "'false'", "'::'", "'set-options'", 
                     "'define-fun'", "'declare-fun'", "'let'", "'check-synth'", 
                     "'constraint'", "'synth-fun'", "'Constant'", "'Variable'", 
                     "'InputVariable'", "'LocalVariable'", "'synth-inv'", 
                     "'declare-primed-var'", "'inv-constraint'" ]

    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>", "WS", "COMMENT", "INTEGER", "BVCONST", 
                      "REALCONST", "QUOTEDLIT", "SYMBOL" ]

    RULE_start = 0
    RULE_prog = 1
    RULE_symbol = 2
    RULE_setLogicCmd = 3
    RULE_cmdPlus = 4
    RULE_cmdPlusTail = 5
    RULE_cmd = 6
    RULE_varDeclCmd = 7
    RULE_sortDefCmd = 8
    RULE_sortExpr = 9
    RULE_intConst = 10
    RULE_boolConst = 11
    RULE_bVConst = 12
    RULE_enumConst = 13
    RULE_realConst = 14
    RULE_eCList = 15
    RULE_symbolPlus = 16
    RULE_symbolPlusTail = 17
    RULE_setOptsCmd = 18
    RULE_optList = 19
    RULE_symbolPairPlus = 20
    RULE_symbolPairPlusTail = 21
    RULE_symbolPair = 22
    RULE_funDefCmd = 23
    RULE_funDeclCmd = 24
    RULE_sortStar = 25
    RULE_argList = 26
    RULE_symbolSortPairStar = 27
    RULE_symbolSortPair = 28
    RULE_term = 29
    RULE_letTerm = 30
    RULE_letBindingTermPlus = 31
    RULE_letBindingTermPlusTail = 32
    RULE_letBindingTerm = 33
    RULE_termStar = 34
    RULE_literal = 35
    RULE_nTDefPlus = 36
    RULE_nTDefPlusTail = 37
    RULE_nTDef = 38
    RULE_gTermPlus = 39
    RULE_gTermPlusTail = 40
    RULE_checkSynthCmd = 41
    RULE_constraintCmd = 42
    RULE_synthFunCmd = 43
    RULE_gTerm = 44
    RULE_letGTerm = 45
    RULE_letBindingGTermPlus = 46
    RULE_letBindingGTermPlusTail = 47
    RULE_letBindingGTerm = 48
    RULE_gTermStar = 49
    RULE_synthInvCmd = 50
    RULE_declarePrimedVar = 51
    RULE_invConstraintCmd = 52

    ruleNames =  [ "start", "prog", "symbol", "setLogicCmd", "cmdPlus", 
                   "cmdPlusTail", "cmd", "varDeclCmd", "sortDefCmd", "sortExpr", 
                   "intConst", "boolConst", "bVConst", "enumConst", "realConst", 
                   "eCList", "symbolPlus", "symbolPlusTail", "setOptsCmd", 
                   "optList", "symbolPairPlus", "symbolPairPlusTail", "symbolPair", 
                   "funDefCmd", "funDeclCmd", "sortStar", "argList", "symbolSortPairStar", 
                   "symbolSortPair", "term", "letTerm", "letBindingTermPlus", 
                   "letBindingTermPlusTail", "letBindingTerm", "termStar", 
                   "literal", "nTDefPlus", "nTDefPlusTail", "nTDef", "gTermPlus", 
                   "gTermPlusTail", "checkSynthCmd", "constraintCmd", "synthFunCmd", 
                   "gTerm", "letGTerm", "letBindingGTermPlus", "letBindingGTermPlusTail", 
                   "letBindingGTerm", "gTermStar", "synthInvCmd", "declarePrimedVar", 
                   "invConstraintCmd" ]

    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
    WS=29
    COMMENT=30
    INTEGER=31
    BVCONST=32
    REALCONST=33
    QUOTEDLIT=34
    SYMBOL=35

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



    class StartContext(ParserRuleContext):

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

        def prog(self):
            return self.getTypedRuleContext(SygusParser.ProgContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_start

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

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

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




    def start(self):

        localctx = SygusParser.StartContext(self, self._ctx, self.state)
        self.enterRule(localctx, 0, self.RULE_start)
        try:
            self.state = 108
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [SygusParser.T__0]:
                self.enterOuterAlt(localctx, 1)
                self.state = 106
                self.prog()
                pass
            elif token in [SygusParser.EOF]:
                self.enterOuterAlt(localctx, 2)

                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 ProgContext(ParserRuleContext):

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

        def setLogicCmd(self):
            return self.getTypedRuleContext(SygusParser.SetLogicCmdContext,0)


        def cmdPlus(self):
            return self.getTypedRuleContext(SygusParser.CmdPlusContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_prog

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

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

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




    def prog(self):

        localctx = SygusParser.ProgContext(self, self._ctx, self.state)
        self.enterRule(localctx, 2, self.RULE_prog)
        try:
            self.state = 114
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,1,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 110
                self.setLogicCmd()
                self.state = 111
                self.cmdPlus()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 113
                self.cmdPlus()
                pass


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

    class SymbolContext(ParserRuleContext):

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

        def SYMBOL(self):
            return self.getToken(SygusParser.SYMBOL, 0)

        def getRuleIndex(self):
            return SygusParser.RULE_symbol

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

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

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




    def symbol(self):

        localctx = SygusParser.SymbolContext(self, self._ctx, self.state)
        self.enterRule(localctx, 4, self.RULE_symbol)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 116
            self.match(SygusParser.SYMBOL)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class SetLogicCmdContext(ParserRuleContext):

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

        def symbol(self):
            return self.getTypedRuleContext(SygusParser.SymbolContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_setLogicCmd

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

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

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




    def setLogicCmd(self):

        localctx = SygusParser.SetLogicCmdContext(self, self._ctx, self.state)
        self.enterRule(localctx, 6, self.RULE_setLogicCmd)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 118
            self.match(SygusParser.T__0)
            self.state = 119
            self.match(SygusParser.T__1)
            self.state = 120
            self.symbol()
            self.state = 121
            self.match(SygusParser.T__2)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class CmdPlusContext(ParserRuleContext):

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

        def cmd(self):
            return self.getTypedRuleContext(SygusParser.CmdContext,0)


        def cmdPlusTail(self):
            return self.getTypedRuleContext(SygusParser.CmdPlusTailContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_cmdPlus

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

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

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




    def cmdPlus(self):

        localctx = SygusParser.CmdPlusContext(self, self._ctx, self.state)
        self.enterRule(localctx, 8, self.RULE_cmdPlus)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 123
            self.cmd()
            self.state = 124
            self.cmdPlusTail()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class CmdPlusTailContext(ParserRuleContext):

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

        def cmd(self):
            return self.getTypedRuleContext(SygusParser.CmdContext,0)


        def cmdPlusTail(self):
            return self.getTypedRuleContext(SygusParser.CmdPlusTailContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_cmdPlusTail

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

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

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




    def cmdPlusTail(self):

        localctx = SygusParser.CmdPlusTailContext(self, self._ctx, self.state)
        self.enterRule(localctx, 10, self.RULE_cmdPlusTail)
        try:
            self.state = 130
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [SygusParser.T__0]:
                self.enterOuterAlt(localctx, 1)
                self.state = 126
                self.cmd()
                self.state = 127
                self.cmdPlusTail()
                pass
            elif token in [SygusParser.EOF]:
                self.enterOuterAlt(localctx, 2)

                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 CmdContext(ParserRuleContext):

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

        def funDefCmd(self):
            return self.getTypedRuleContext(SygusParser.FunDefCmdContext,0)


        def funDeclCmd(self):
            return self.getTypedRuleContext(SygusParser.FunDeclCmdContext,0)


        def synthFunCmd(self):
            return self.getTypedRuleContext(SygusParser.SynthFunCmdContext,0)


        def checkSynthCmd(self):
            return self.getTypedRuleContext(SygusParser.CheckSynthCmdContext,0)


        def constraintCmd(self):
            return self.getTypedRuleContext(SygusParser.ConstraintCmdContext,0)


        def sortDefCmd(self):
            return self.getTypedRuleContext(SygusParser.SortDefCmdContext,0)


        def setOptsCmd(self):
            return self.getTypedRuleContext(SygusParser.SetOptsCmdContext,0)


        def varDeclCmd(self):
            return self.getTypedRuleContext(SygusParser.VarDeclCmdContext,0)


        def synthInvCmd(self):
            return self.getTypedRuleContext(SygusParser.SynthInvCmdContext,0)


        def declarePrimedVar(self):
            return self.getTypedRuleContext(SygusParser.DeclarePrimedVarContext,0)


        def invConstraintCmd(self):
            return self.getTypedRuleContext(SygusParser.InvConstraintCmdContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_cmd

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

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

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




    def cmd(self):

        localctx = SygusParser.CmdContext(self, self._ctx, self.state)
        self.enterRule(localctx, 12, self.RULE_cmd)
        try:
            self.state = 143
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,3,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 132
                self.funDefCmd()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 133
                self.funDeclCmd()
                pass

            elif la_ == 3:
                self.enterOuterAlt(localctx, 3)
                self.state = 134
                self.synthFunCmd()
                pass

            elif la_ == 4:
                self.enterOuterAlt(localctx, 4)
                self.state = 135
                self.checkSynthCmd()
                pass

            elif la_ == 5:
                self.enterOuterAlt(localctx, 5)
                self.state = 136
                self.constraintCmd()
                pass

            elif la_ == 6:
                self.enterOuterAlt(localctx, 6)
                self.state = 137
                self.sortDefCmd()
                pass

            elif la_ == 7:
                self.enterOuterAlt(localctx, 7)
                self.state = 138
                self.setOptsCmd()
                pass

            elif la_ == 8:
                self.enterOuterAlt(localctx, 8)
                self.state = 139
                self.varDeclCmd()
                pass

            elif la_ == 9:
                self.enterOuterAlt(localctx, 9)
                self.state = 140
                self.synthInvCmd()
                pass

            elif la_ == 10:
                self.enterOuterAlt(localctx, 10)
                self.state = 141
                self.declarePrimedVar()
                pass

            elif la_ == 11:
                self.enterOuterAlt(localctx, 11)
                self.state = 142
                self.invConstraintCmd()
                pass


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

    class VarDeclCmdContext(ParserRuleContext):

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

        def symbol(self):
            return self.getTypedRuleContext(SygusParser.SymbolContext,0)


        def sortExpr(self):
            return self.getTypedRuleContext(SygusParser.SortExprContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_varDeclCmd

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

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

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




    def varDeclCmd(self):

        localctx = SygusParser.VarDeclCmdContext(self, self._ctx, self.state)
        self.enterRule(localctx, 14, self.RULE_varDeclCmd)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 145
            self.match(SygusParser.T__0)
            self.state = 146
            self.match(SygusParser.T__3)
            self.state = 147
            self.symbol()
            self.state = 148
            self.sortExpr()
            self.state = 149
            self.match(SygusParser.T__2)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class SortDefCmdContext(ParserRuleContext):

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

        def symbol(self):
            return self.getTypedRuleContext(SygusParser.SymbolContext,0)


        def sortExpr(self):
            return self.getTypedRuleContext(SygusParser.SortExprContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_sortDefCmd

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

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

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




    def sortDefCmd(self):

        localctx = SygusParser.SortDefCmdContext(self, self._ctx, self.state)
        self.enterRule(localctx, 16, self.RULE_sortDefCmd)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 151
            self.match(SygusParser.T__0)
            self.state = 152
            self.match(SygusParser.T__4)
            self.state = 153
            self.symbol()
            self.state = 154
            self.sortExpr()
            self.state = 155
            self.match(SygusParser.T__2)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class SortExprContext(ParserRuleContext):

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

        def intConst(self):
            return self.getTypedRuleContext(SygusParser.IntConstContext,0)


        def eCList(self):
            return self.getTypedRuleContext(SygusParser.ECListContext,0)


        def sortExpr(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(SygusParser.SortExprContext)
            else:
                return self.getTypedRuleContext(SygusParser.SortExprContext,i)


        def symbol(self):
            return self.getTypedRuleContext(SygusParser.SymbolContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_sortExpr

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

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

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




    def sortExpr(self):

        localctx = SygusParser.SortExprContext(self, self._ctx, self.state)
        self.enterRule(localctx, 18, self.RULE_sortExpr)
        try:
            self.state = 177
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,4,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 157
                self.match(SygusParser.T__0)
                self.state = 158
                self.match(SygusParser.T__5)
                self.state = 159
                self.intConst()
                self.state = 160
                self.match(SygusParser.T__2)
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 162
                self.match(SygusParser.T__6)
                pass

            elif la_ == 3:
                self.enterOuterAlt(localctx, 3)
                self.state = 163
                self.match(SygusParser.T__7)
                pass

            elif la_ == 4:
                self.enterOuterAlt(localctx, 4)
                self.state = 164
                self.match(SygusParser.T__8)
                pass

            elif la_ == 5:
                self.enterOuterAlt(localctx, 5)
                self.state = 165
                self.match(SygusParser.T__0)
                self.state = 166
                self.match(SygusParser.T__9)
                self.state = 167
                self.eCList()
                self.state = 168
                self.match(SygusParser.T__2)
                pass

            elif la_ == 6:
                self.enterOuterAlt(localctx, 6)
                self.state = 170
                self.match(SygusParser.T__0)
                self.state = 171
                self.match(SygusParser.T__10)
                self.state = 172
                self.sortExpr()
                self.state = 173
                self.sortExpr()
                self.state = 174
                self.match(SygusParser.T__2)
                pass

            elif la_ == 7:
                self.enterOuterAlt(localctx, 7)
                self.state = 176
                self.symbol()
                pass


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

    class IntConstContext(ParserRuleContext):

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

        def INTEGER(self):
            return self.getToken(SygusParser.INTEGER, 0)

        def getRuleIndex(self):
            return SygusParser.RULE_intConst

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

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

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




    def intConst(self):

        localctx = SygusParser.IntConstContext(self, self._ctx, self.state)
        self.enterRule(localctx, 20, self.RULE_intConst)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 179
            self.match(SygusParser.INTEGER)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class BoolConstContext(ParserRuleContext):

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


        def getRuleIndex(self):
            return SygusParser.RULE_boolConst

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

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

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




    def boolConst(self):

        localctx = SygusParser.BoolConstContext(self, self._ctx, self.state)
        self.enterRule(localctx, 22, self.RULE_boolConst)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 181
            _la = self._input.LA(1)
            if not(_la==SygusParser.T__11 or _la==SygusParser.T__12):
                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 BVConstContext(ParserRuleContext):

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

        def BVCONST(self):
            return self.getToken(SygusParser.BVCONST, 0)

        def getRuleIndex(self):
            return SygusParser.RULE_bVConst

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

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

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




    def bVConst(self):

        localctx = SygusParser.BVConstContext(self, self._ctx, self.state)
        self.enterRule(localctx, 24, self.RULE_bVConst)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 183
            self.match(SygusParser.BVCONST)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class EnumConstContext(ParserRuleContext):

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

        def symbol(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(SygusParser.SymbolContext)
            else:
                return self.getTypedRuleContext(SygusParser.SymbolContext,i)


        def getRuleIndex(self):
            return SygusParser.RULE_enumConst

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

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

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




    def enumConst(self):

        localctx = SygusParser.EnumConstContext(self, self._ctx, self.state)
        self.enterRule(localctx, 26, self.RULE_enumConst)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 185
            self.symbol()
            self.state = 186
            self.match(SygusParser.T__13)
            self.state = 187
            self.symbol()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class RealConstContext(ParserRuleContext):

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

        def REALCONST(self):
            return self.getToken(SygusParser.REALCONST, 0)

        def getRuleIndex(self):
            return SygusParser.RULE_realConst

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

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

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




    def realConst(self):

        localctx = SygusParser.RealConstContext(self, self._ctx, self.state)
        self.enterRule(localctx, 28, self.RULE_realConst)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 189
            self.match(SygusParser.REALCONST)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class ECListContext(ParserRuleContext):

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

        def symbolPlus(self):
            return self.getTypedRuleContext(SygusParser.SymbolPlusContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_eCList

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

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

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




    def eCList(self):

        localctx = SygusParser.ECListContext(self, self._ctx, self.state)
        self.enterRule(localctx, 30, self.RULE_eCList)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 191
            self.match(SygusParser.T__0)
            self.state = 192
            self.symbolPlus()
            self.state = 193
            self.match(SygusParser.T__2)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class SymbolPlusContext(ParserRuleContext):

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

        def symbol(self):
            return self.getTypedRuleContext(SygusParser.SymbolContext,0)


        def symbolPlusTail(self):
            return self.getTypedRuleContext(SygusParser.SymbolPlusTailContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_symbolPlus

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

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

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




    def symbolPlus(self):

        localctx = SygusParser.SymbolPlusContext(self, self._ctx, self.state)
        self.enterRule(localctx, 32, self.RULE_symbolPlus)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 195
            self.symbol()
            self.state = 196
            self.symbolPlusTail()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class SymbolPlusTailContext(ParserRuleContext):

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

        def symbol(self):
            return self.getTypedRuleContext(SygusParser.SymbolContext,0)


        def symbolPlusTail(self):
            return self.getTypedRuleContext(SygusParser.SymbolPlusTailContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_symbolPlusTail

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

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

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




    def symbolPlusTail(self):

        localctx = SygusParser.SymbolPlusTailContext(self, self._ctx, self.state)
        self.enterRule(localctx, 34, self.RULE_symbolPlusTail)
        try:
            self.state = 202
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [SygusParser.SYMBOL]:
                self.enterOuterAlt(localctx, 1)
                self.state = 198
                self.symbol()
                self.state = 199
                self.symbolPlusTail()
                pass
            elif token in [SygusParser.T__2]:
                self.enterOuterAlt(localctx, 2)

                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 SetOptsCmdContext(ParserRuleContext):

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

        def optList(self):
            return self.getTypedRuleContext(SygusParser.OptListContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_setOptsCmd

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

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

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




    def setOptsCmd(self):

        localctx = SygusParser.SetOptsCmdContext(self, self._ctx, self.state)
        self.enterRule(localctx, 36, self.RULE_setOptsCmd)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 204
            self.match(SygusParser.T__0)
            self.state = 205
            self.match(SygusParser.T__14)
            self.state = 206
            self.optList()
            self.state = 207
            self.match(SygusParser.T__2)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class OptListContext(ParserRuleContext):

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

        def symbolPairPlus(self):
            return self.getTypedRuleContext(SygusParser.SymbolPairPlusContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_optList

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

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

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




    def optList(self):

        localctx = SygusParser.OptListContext(self, self._ctx, self.state)
        self.enterRule(localctx, 38, self.RULE_optList)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 209
            self.match(SygusParser.T__0)
            self.state = 210
            self.symbolPairPlus()
            self.state = 211
            self.match(SygusParser.T__2)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class SymbolPairPlusContext(ParserRuleContext):

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

        def symbolPair(self):
            return self.getTypedRuleContext(SygusParser.SymbolPairContext,0)


        def symbolPairPlusTail(self):
            return self.getTypedRuleContext(SygusParser.SymbolPairPlusTailContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_symbolPairPlus

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

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

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




    def symbolPairPlus(self):

        localctx = SygusParser.SymbolPairPlusContext(self, self._ctx, self.state)
        self.enterRule(localctx, 40, self.RULE_symbolPairPlus)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 213
            self.symbolPair()
            self.state = 214
            self.symbolPairPlusTail()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class SymbolPairPlusTailContext(ParserRuleContext):

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

        def symbolPair(self):
            return self.getTypedRuleContext(SygusParser.SymbolPairContext,0)


        def symbolPairPlusTail(self):
            return self.getTypedRuleContext(SygusParser.SymbolPairPlusTailContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_symbolPairPlusTail

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

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

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




    def symbolPairPlusTail(self):

        localctx = SygusParser.SymbolPairPlusTailContext(self, self._ctx, self.state)
        self.enterRule(localctx, 42, self.RULE_symbolPairPlusTail)
        try:
            self.state = 220
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [SygusParser.T__0]:
                self.enterOuterAlt(localctx, 1)
                self.state = 216
                self.symbolPair()
                self.state = 217
                self.symbolPairPlusTail()
                pass
            elif token in [SygusParser.T__2]:
                self.enterOuterAlt(localctx, 2)

                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 SymbolPairContext(ParserRuleContext):

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

        def symbol(self):
            return self.getTypedRuleContext(SygusParser.SymbolContext,0)


        def QUOTEDLIT(self):
            return self.getToken(SygusParser.QUOTEDLIT, 0)

        def getRuleIndex(self):
            return SygusParser.RULE_symbolPair

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

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

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




    def symbolPair(self):

        localctx = SygusParser.SymbolPairContext(self, self._ctx, self.state)
        self.enterRule(localctx, 44, self.RULE_symbolPair)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 222
            self.match(SygusParser.T__0)
            self.state = 223
            self.symbol()
            self.state = 224
            self.match(SygusParser.QUOTEDLIT)
            self.state = 225
            self.match(SygusParser.T__2)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class FunDefCmdContext(ParserRuleContext):

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

        def symbol(self):
            return self.getTypedRuleContext(SygusParser.SymbolContext,0)


        def argList(self):
            return self.getTypedRuleContext(SygusParser.ArgListContext,0)


        def sortExpr(self):
            return self.getTypedRuleContext(SygusParser.SortExprContext,0)


        def term(self):
            return self.getTypedRuleContext(SygusParser.TermContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_funDefCmd

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

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

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




    def funDefCmd(self):

        localctx = SygusParser.FunDefCmdContext(self, self._ctx, self.state)
        self.enterRule(localctx, 46, self.RULE_funDefCmd)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 227
            self.match(SygusParser.T__0)
            self.state = 228
            self.match(SygusParser.T__15)
            self.state = 229
            self.symbol()
            self.state = 230
            self.argList()
            self.state = 231
            self.sortExpr()
            self.state = 232
            self.term()
            self.state = 233
            self.match(SygusParser.T__2)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class FunDeclCmdContext(ParserRuleContext):

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

        def symbol(self):
            return self.getTypedRuleContext(SygusParser.SymbolContext,0)


        def sortStar(self):
            return self.getTypedRuleContext(SygusParser.SortStarContext,0)


        def sortExpr(self):
            return self.getTypedRuleContext(SygusParser.SortExprContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_funDeclCmd

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

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

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




    def funDeclCmd(self):

        localctx = SygusParser.FunDeclCmdContext(self, self._ctx, self.state)
        self.enterRule(localctx, 48, self.RULE_funDeclCmd)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 235
            self.match(SygusParser.T__0)
            self.state = 236
            self.match(SygusParser.T__16)
            self.state = 237
            self.symbol()
            self.state = 238
            self.match(SygusParser.T__0)
            self.state = 239
            self.sortStar()
            self.state = 240
            self.match(SygusParser.T__2)
            self.state = 241
            self.sortExpr()
            self.state = 242
            self.match(SygusParser.T__2)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class SortStarContext(ParserRuleContext):

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

        def sortExpr(self):
            return self.getTypedRuleContext(SygusParser.SortExprContext,0)


        def sortStar(self):
            return self.getTypedRuleContext(SygusParser.SortStarContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_sortStar

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

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

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




    def sortStar(self):

        localctx = SygusParser.SortStarContext(self, self._ctx, self.state)
        self.enterRule(localctx, 50, self.RULE_sortStar)
        try:
            self.state = 248
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [SygusParser.T__0, SygusParser.T__6, SygusParser.T__7, SygusParser.T__8, SygusParser.SYMBOL]:
                self.enterOuterAlt(localctx, 1)
                self.state = 244
                self.sortExpr()
                self.state = 245
                self.sortStar()
                pass
            elif token in [SygusParser.T__2]:
                self.enterOuterAlt(localctx, 2)

                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 ArgListContext(ParserRuleContext):

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

        def symbolSortPairStar(self):
            return self.getTypedRuleContext(SygusParser.SymbolSortPairStarContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_argList

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

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

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




    def argList(self):

        localctx = SygusParser.ArgListContext(self, self._ctx, self.state)
        self.enterRule(localctx, 52, self.RULE_argList)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 250
            self.match(SygusParser.T__0)
            self.state = 251
            self.symbolSortPairStar()
            self.state = 252
            self.match(SygusParser.T__2)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class SymbolSortPairStarContext(ParserRuleContext):

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

        def symbolSortPair(self):
            return self.getTypedRuleContext(SygusParser.SymbolSortPairContext,0)


        def symbolSortPairStar(self):
            return self.getTypedRuleContext(SygusParser.SymbolSortPairStarContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_symbolSortPairStar

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

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

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




    def symbolSortPairStar(self):

        localctx = SygusParser.SymbolSortPairStarContext(self, self._ctx, self.state)
        self.enterRule(localctx, 54, self.RULE_symbolSortPairStar)
        try:
            self.state = 258
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [SygusParser.T__0]:
                self.enterOuterAlt(localctx, 1)
                self.state = 254
                self.symbolSortPair()
                self.state = 255
                self.symbolSortPairStar()
                pass
            elif token in [SygusParser.T__2]:
                self.enterOuterAlt(localctx, 2)

                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 SymbolSortPairContext(ParserRuleContext):

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

        def symbol(self):
            return self.getTypedRuleContext(SygusParser.SymbolContext,0)


        def sortExpr(self):
            return self.getTypedRuleContext(SygusParser.SortExprContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_symbolSortPair

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

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

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




    def symbolSortPair(self):

        localctx = SygusParser.SymbolSortPairContext(self, self._ctx, self.state)
        self.enterRule(localctx, 56, self.RULE_symbolSortPair)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 260
            self.match(SygusParser.T__0)
            self.state = 261
            self.symbol()
            self.state = 262
            self.sortExpr()
            self.state = 263
            self.match(SygusParser.T__2)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class TermContext(ParserRuleContext):

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

        def symbol(self):
            return self.getTypedRuleContext(SygusParser.SymbolContext,0)


        def termStar(self):
            return self.getTypedRuleContext(SygusParser.TermStarContext,0)


        def literal(self):
            return self.getTypedRuleContext(SygusParser.LiteralContext,0)


        def letTerm(self):
            return self.getTypedRuleContext(SygusParser.LetTermContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_term

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

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

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




    def term(self):

        localctx = SygusParser.TermContext(self, self._ctx, self.state)
        self.enterRule(localctx, 58, self.RULE_term)
        try:
            self.state = 273
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,9,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 265
                self.match(SygusParser.T__0)
                self.state = 266
                self.symbol()
                self.state = 267
                self.termStar()
                self.state = 268
                self.match(SygusParser.T__2)
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 270
                self.literal()
                pass

            elif la_ == 3:
                self.enterOuterAlt(localctx, 3)
                self.state = 271
                self.symbol()
                pass

            elif la_ == 4:
                self.enterOuterAlt(localctx, 4)
                self.state = 272
                self.letTerm()
                pass


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

    class LetTermContext(ParserRuleContext):

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

        def letBindingTermPlus(self):
            return self.getTypedRuleContext(SygusParser.LetBindingTermPlusContext,0)


        def term(self):
            return self.getTypedRuleContext(SygusParser.TermContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_letTerm

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

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

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




    def letTerm(self):

        localctx = SygusParser.LetTermContext(self, self._ctx, self.state)
        self.enterRule(localctx, 60, self.RULE_letTerm)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 275
            self.match(SygusParser.T__0)
            self.state = 276
            self.match(SygusParser.T__17)
            self.state = 277
            self.match(SygusParser.T__0)
            self.state = 278
            self.letBindingTermPlus()
            self.state = 279
            self.match(SygusParser.T__2)
            self.state = 280
            self.term()
            self.state = 281
            self.match(SygusParser.T__2)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class LetBindingTermPlusContext(ParserRuleContext):

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

        def letBindingTerm(self):
            return self.getTypedRuleContext(SygusParser.LetBindingTermContext,0)


        def letBindingTermPlusTail(self):
            return self.getTypedRuleContext(SygusParser.LetBindingTermPlusTailContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_letBindingTermPlus

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

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

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




    def letBindingTermPlus(self):

        localctx = SygusParser.LetBindingTermPlusContext(self, self._ctx, self.state)
        self.enterRule(localctx, 62, self.RULE_letBindingTermPlus)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 283
            self.letBindingTerm()
            self.state = 284
            self.letBindingTermPlusTail()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class LetBindingTermPlusTailContext(ParserRuleContext):

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

        def letBindingTerm(self):
            return self.getTypedRuleContext(SygusParser.LetBindingTermContext,0)


        def letBindingTermPlusTail(self):
            return self.getTypedRuleContext(SygusParser.LetBindingTermPlusTailContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_letBindingTermPlusTail

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

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

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




    def letBindingTermPlusTail(self):

        localctx = SygusParser.LetBindingTermPlusTailContext(self, self._ctx, self.state)
        self.enterRule(localctx, 64, self.RULE_letBindingTermPlusTail)
        try:
            self.state = 290
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [SygusParser.T__0]:
                self.enterOuterAlt(localctx, 1)
                self.state = 286
                self.letBindingTerm()
                self.state = 287
                self.letBindingTermPlusTail()
                pass
            elif token in [SygusParser.T__2]:
                self.enterOuterAlt(localctx, 2)

                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 LetBindingTermContext(ParserRuleContext):

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

        def symbol(self):
            return self.getTypedRuleContext(SygusParser.SymbolContext,0)


        def sortExpr(self):
            return self.getTypedRuleContext(SygusParser.SortExprContext,0)


        def term(self):
            return self.getTypedRuleContext(SygusParser.TermContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_letBindingTerm

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

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

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




    def letBindingTerm(self):

        localctx = SygusParser.LetBindingTermContext(self, self._ctx, self.state)
        self.enterRule(localctx, 66, self.RULE_letBindingTerm)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 292
            self.match(SygusParser.T__0)
            self.state = 293
            self.symbol()
            self.state = 294
            self.sortExpr()
            self.state = 295
            self.term()
            self.state = 296
            self.match(SygusParser.T__2)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class TermStarContext(ParserRuleContext):

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

        def term(self):
            return self.getTypedRuleContext(SygusParser.TermContext,0)


        def termStar(self):
            return self.getTypedRuleContext(SygusParser.TermStarContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_termStar

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

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

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




    def termStar(self):

        localctx = SygusParser.TermStarContext(self, self._ctx, self.state)
        self.enterRule(localctx, 68, self.RULE_termStar)
        try:
            self.state = 302
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [SygusParser.T__0, SygusParser.T__11, SygusParser.T__12, SygusParser.INTEGER, SygusParser.BVCONST, SygusParser.REALCONST, SygusParser.SYMBOL]:
                self.enterOuterAlt(localctx, 1)
                self.state = 298
                self.term()
                self.state = 299
                self.termStar()
                pass
            elif token in [SygusParser.T__2]:
                self.enterOuterAlt(localctx, 2)

                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 LiteralContext(ParserRuleContext):

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

        def intConst(self):
            return self.getTypedRuleContext(SygusParser.IntConstContext,0)


        def boolConst(self):
            return self.getTypedRuleContext(SygusParser.BoolConstContext,0)


        def bVConst(self):
            return self.getTypedRuleContext(SygusParser.BVConstContext,0)


        def enumConst(self):
            return self.getTypedRuleContext(SygusParser.EnumConstContext,0)


        def realConst(self):
            return self.getTypedRuleContext(SygusParser.RealConstContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_literal

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

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

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




    def literal(self):

        localctx = SygusParser.LiteralContext(self, self._ctx, self.state)
        self.enterRule(localctx, 70, self.RULE_literal)
        try:
            self.state = 309
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [SygusParser.INTEGER]:
                self.enterOuterAlt(localctx, 1)
                self.state = 304
                self.intConst()
                pass
            elif token in [SygusParser.T__11, SygusParser.T__12]:
                self.enterOuterAlt(localctx, 2)
                self.state = 305
                self.boolConst()
                pass
            elif token in [SygusParser.BVCONST]:
                self.enterOuterAlt(localctx, 3)
                self.state = 306
                self.bVConst()
                pass
            elif token in [SygusParser.SYMBOL]:
                self.enterOuterAlt(localctx, 4)
                self.state = 307
                self.enumConst()
                pass
            elif token in [SygusParser.REALCONST]:
                self.enterOuterAlt(localctx, 5)
                self.state = 308
                self.realConst()
                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 NTDefPlusContext(ParserRuleContext):

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

        def nTDef(self):
            return self.getTypedRuleContext(SygusParser.NTDefContext,0)


        def nTDefPlusTail(self):
            return self.getTypedRuleContext(SygusParser.NTDefPlusTailContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_nTDefPlus

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

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

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




    def nTDefPlus(self):

        localctx = SygusParser.NTDefPlusContext(self, self._ctx, self.state)
        self.enterRule(localctx, 72, self.RULE_nTDefPlus)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 311
            self.nTDef()
            self.state = 312
            self.nTDefPlusTail()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class NTDefPlusTailContext(ParserRuleContext):

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

        def nTDef(self):
            return self.getTypedRuleContext(SygusParser.NTDefContext,0)


        def nTDefPlusTail(self):
            return self.getTypedRuleContext(SygusParser.NTDefPlusTailContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_nTDefPlusTail

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

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

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




    def nTDefPlusTail(self):

        localctx = SygusParser.NTDefPlusTailContext(self, self._ctx, self.state)
        self.enterRule(localctx, 74, self.RULE_nTDefPlusTail)
        try:
            self.state = 318
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [SygusParser.T__0]:
                self.enterOuterAlt(localctx, 1)
                self.state = 314
                self.nTDef()
                self.state = 315
                self.nTDefPlusTail()
                pass
            elif token in [SygusParser.T__2]:
                self.enterOuterAlt(localctx, 2)

                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 NTDefContext(ParserRuleContext):

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

        def symbol(self):
            return self.getTypedRuleContext(SygusParser.SymbolContext,0)


        def sortExpr(self):
            return self.getTypedRuleContext(SygusParser.SortExprContext,0)


        def gTermPlus(self):
            return self.getTypedRuleContext(SygusParser.GTermPlusContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_nTDef

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

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

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




    def nTDef(self):

        localctx = SygusParser.NTDefContext(self, self._ctx, self.state)
        self.enterRule(localctx, 76, self.RULE_nTDef)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 320
            self.match(SygusParser.T__0)
            self.state = 321
            self.symbol()
            self.state = 322
            self.sortExpr()
            self.state = 323
            self.match(SygusParser.T__0)
            self.state = 324
            self.gTermPlus()
            self.state = 325
            self.match(SygusParser.T__2)
            self.state = 326
            self.match(SygusParser.T__2)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class GTermPlusContext(ParserRuleContext):

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

        def gTerm(self):
            return self.getTypedRuleContext(SygusParser.GTermContext,0)


        def gTermPlusTail(self):
            return self.getTypedRuleContext(SygusParser.GTermPlusTailContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_gTermPlus

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

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

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




    def gTermPlus(self):

        localctx = SygusParser.GTermPlusContext(self, self._ctx, self.state)
        self.enterRule(localctx, 78, self.RULE_gTermPlus)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 328
            self.gTerm()
            self.state = 329
            self.gTermPlusTail()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class GTermPlusTailContext(ParserRuleContext):

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

        def gTerm(self):
            return self.getTypedRuleContext(SygusParser.GTermContext,0)


        def gTermPlusTail(self):
            return self.getTypedRuleContext(SygusParser.GTermPlusTailContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_gTermPlusTail

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

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

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




    def gTermPlusTail(self):

        localctx = SygusParser.GTermPlusTailContext(self, self._ctx, self.state)
        self.enterRule(localctx, 80, self.RULE_gTermPlusTail)
        try:
            self.state = 335
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [SygusParser.T__0, SygusParser.T__11, SygusParser.T__12, SygusParser.INTEGER, SygusParser.BVCONST, SygusParser.REALCONST, SygusParser.SYMBOL]:
                self.enterOuterAlt(localctx, 1)
                self.state = 331
                self.gTerm()
                self.state = 332
                self.gTermPlusTail()
                pass
            elif token in [SygusParser.T__2]:
                self.enterOuterAlt(localctx, 2)

                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 CheckSynthCmdContext(ParserRuleContext):

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


        def getRuleIndex(self):
            return SygusParser.RULE_checkSynthCmd

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

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

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




    def checkSynthCmd(self):

        localctx = SygusParser.CheckSynthCmdContext(self, self._ctx, self.state)
        self.enterRule(localctx, 82, self.RULE_checkSynthCmd)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 337
            self.match(SygusParser.T__0)
            self.state = 338
            self.match(SygusParser.T__18)
            self.state = 339
            self.match(SygusParser.T__2)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class ConstraintCmdContext(ParserRuleContext):

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

        def term(self):
            return self.getTypedRuleContext(SygusParser.TermContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_constraintCmd

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

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

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




    def constraintCmd(self):

        localctx = SygusParser.ConstraintCmdContext(self, self._ctx, self.state)
        self.enterRule(localctx, 84, self.RULE_constraintCmd)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 341
            self.match(SygusParser.T__0)
            self.state = 342
            self.match(SygusParser.T__19)
            self.state = 343
            self.term()
            self.state = 344
            self.match(SygusParser.T__2)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class SynthFunCmdContext(ParserRuleContext):

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

        def symbol(self):
            return self.getTypedRuleContext(SygusParser.SymbolContext,0)


        def argList(self):
            return self.getTypedRuleContext(SygusParser.ArgListContext,0)


        def sortExpr(self):
            return self.getTypedRuleContext(SygusParser.SortExprContext,0)


        def nTDefPlus(self):
            return self.getTypedRuleContext(SygusParser.NTDefPlusContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_synthFunCmd

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

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

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




    def synthFunCmd(self):

        localctx = SygusParser.SynthFunCmdContext(self, self._ctx, self.state)
        self.enterRule(localctx, 86, self.RULE_synthFunCmd)
        try:
            self.state = 363
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,15,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 346
                self.match(SygusParser.T__0)
                self.state = 347
                self.match(SygusParser.T__20)
                self.state = 348
                self.symbol()
                self.state = 349
                self.argList()
                self.state = 350
                self.sortExpr()
                self.state = 351
                self.match(SygusParser.T__0)
                self.state = 352
                self.nTDefPlus()
                self.state = 353
                self.match(SygusParser.T__2)
                self.state = 354
                self.match(SygusParser.T__2)
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 356
                self.match(SygusParser.T__0)
                self.state = 357
                self.match(SygusParser.T__20)
                self.state = 358
                self.symbol()
                self.state = 359
                self.argList()
                self.state = 360
                self.sortExpr()
                self.state = 361
                self.match(SygusParser.T__2)
                pass


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

    class GTermContext(ParserRuleContext):

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

        def symbol(self):
            return self.getTypedRuleContext(SygusParser.SymbolContext,0)


        def literal(self):
            return self.getTypedRuleContext(SygusParser.LiteralContext,0)


        def gTermStar(self):
            return self.getTypedRuleContext(SygusParser.GTermStarContext,0)


        def sortExpr(self):
            return self.getTypedRuleContext(SygusParser.SortExprContext,0)


        def letGTerm(self):
            return self.getTypedRuleContext(SygusParser.LetGTermContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_gTerm

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

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

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




    def gTerm(self):

        localctx = SygusParser.GTermContext(self, self._ctx, self.state)
        self.enterRule(localctx, 88, self.RULE_gTerm)
        try:
            self.state = 393
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,16,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 365
                self.symbol()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 366
                self.literal()
                pass

            elif la_ == 3:
                self.enterOuterAlt(localctx, 3)
                self.state = 367
                self.match(SygusParser.T__0)
                self.state = 368
                self.symbol()
                self.state = 369
                self.gTermStar()
                self.state = 370
                self.match(SygusParser.T__2)
                pass

            elif la_ == 4:
                self.enterOuterAlt(localctx, 4)
                self.state = 372
                self.match(SygusParser.T__0)
                self.state = 373
                self.match(SygusParser.T__21)
                self.state = 374
                self.sortExpr()
                self.state = 375
                self.match(SygusParser.T__2)
                pass

            elif la_ == 5:
                self.enterOuterAlt(localctx, 5)
                self.state = 377
                self.match(SygusParser.T__0)
                self.state = 378
                self.match(SygusParser.T__22)
                self.state = 379
                self.sortExpr()
                self.state = 380
                self.match(SygusParser.T__2)
                pass

            elif la_ == 6:
                self.enterOuterAlt(localctx, 6)
                self.state = 382
                self.match(SygusParser.T__0)
                self.state = 383
                self.match(SygusParser.T__23)
                self.state = 384
                self.sortExpr()
                self.state = 385
                self.match(SygusParser.T__2)
                pass

            elif la_ == 7:
                self.enterOuterAlt(localctx, 7)
                self.state = 387
                self.match(SygusParser.T__0)
                self.state = 388
                self.match(SygusParser.T__24)
                self.state = 389
                self.sortExpr()
                self.state = 390
                self.match(SygusParser.T__2)
                pass

            elif la_ == 8:
                self.enterOuterAlt(localctx, 8)
                self.state = 392
                self.letGTerm()
                pass


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

    class LetGTermContext(ParserRuleContext):

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

        def letBindingGTermPlus(self):
            return self.getTypedRuleContext(SygusParser.LetBindingGTermPlusContext,0)


        def gTerm(self):
            return self.getTypedRuleContext(SygusParser.GTermContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_letGTerm

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

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

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




    def letGTerm(self):

        localctx = SygusParser.LetGTermContext(self, self._ctx, self.state)
        self.enterRule(localctx, 90, self.RULE_letGTerm)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 395
            self.match(SygusParser.T__0)
            self.state = 396
            self.match(SygusParser.T__17)
            self.state = 397
            self.match(SygusParser.T__0)
            self.state = 398
            self.letBindingGTermPlus()
            self.state = 399
            self.match(SygusParser.T__2)
            self.state = 400
            self.gTerm()
            self.state = 401
            self.match(SygusParser.T__2)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class LetBindingGTermPlusContext(ParserRuleContext):

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

        def letBindingGTerm(self):
            return self.getTypedRuleContext(SygusParser.LetBindingGTermContext,0)


        def letBindingGTermPlusTail(self):
            return self.getTypedRuleContext(SygusParser.LetBindingGTermPlusTailContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_letBindingGTermPlus

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

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

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




    def letBindingGTermPlus(self):

        localctx = SygusParser.LetBindingGTermPlusContext(self, self._ctx, self.state)
        self.enterRule(localctx, 92, self.RULE_letBindingGTermPlus)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 403
            self.letBindingGTerm()
            self.state = 404
            self.letBindingGTermPlusTail()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class LetBindingGTermPlusTailContext(ParserRuleContext):

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

        def letBindingGTerm(self):
            return self.getTypedRuleContext(SygusParser.LetBindingGTermContext,0)


        def letBindingGTermPlusTail(self):
            return self.getTypedRuleContext(SygusParser.LetBindingGTermPlusTailContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_letBindingGTermPlusTail

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

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

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




    def letBindingGTermPlusTail(self):

        localctx = SygusParser.LetBindingGTermPlusTailContext(self, self._ctx, self.state)
        self.enterRule(localctx, 94, self.RULE_letBindingGTermPlusTail)
        try:
            self.state = 410
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [SygusParser.T__0]:
                self.enterOuterAlt(localctx, 1)
                self.state = 406
                self.letBindingGTerm()
                self.state = 407
                self.letBindingGTermPlusTail()
                pass
            elif token in [SygusParser.T__2]:
                self.enterOuterAlt(localctx, 2)

                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 LetBindingGTermContext(ParserRuleContext):

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

        def symbol(self):
            return self.getTypedRuleContext(SygusParser.SymbolContext,0)


        def sortExpr(self):
            return self.getTypedRuleContext(SygusParser.SortExprContext,0)


        def gTerm(self):
            return self.getTypedRuleContext(SygusParser.GTermContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_letBindingGTerm

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

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

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




    def letBindingGTerm(self):

        localctx = SygusParser.LetBindingGTermContext(self, self._ctx, self.state)
        self.enterRule(localctx, 96, self.RULE_letBindingGTerm)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 412
            self.match(SygusParser.T__0)
            self.state = 413
            self.symbol()
            self.state = 414
            self.sortExpr()
            self.state = 415
            self.gTerm()
            self.state = 416
            self.match(SygusParser.T__2)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class GTermStarContext(ParserRuleContext):

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

        def gTerm(self):
            return self.getTypedRuleContext(SygusParser.GTermContext,0)


        def gTermStar(self):
            return self.getTypedRuleContext(SygusParser.GTermStarContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_gTermStar

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

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

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




    def gTermStar(self):

        localctx = SygusParser.GTermStarContext(self, self._ctx, self.state)
        self.enterRule(localctx, 98, self.RULE_gTermStar)
        try:
            self.state = 422
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [SygusParser.T__0, SygusParser.T__11, SygusParser.T__12, SygusParser.INTEGER, SygusParser.BVCONST, SygusParser.REALCONST, SygusParser.SYMBOL]:
                self.enterOuterAlt(localctx, 1)
                self.state = 418
                self.gTerm()
                self.state = 419
                self.gTermStar()
                pass
            elif token in [SygusParser.T__2]:
                self.enterOuterAlt(localctx, 2)

                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 SynthInvCmdContext(ParserRuleContext):

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

        def symbol(self):
            return self.getTypedRuleContext(SygusParser.SymbolContext,0)


        def argList(self):
            return self.getTypedRuleContext(SygusParser.ArgListContext,0)


        def nTDefPlus(self):
            return self.getTypedRuleContext(SygusParser.NTDefPlusContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_synthInvCmd

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

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

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




    def synthInvCmd(self):

        localctx = SygusParser.SynthInvCmdContext(self, self._ctx, self.state)
        self.enterRule(localctx, 100, self.RULE_synthInvCmd)
        try:
            self.state = 439
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,19,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 424
                self.match(SygusParser.T__0)
                self.state = 425
                self.match(SygusParser.T__25)
                self.state = 426
                self.symbol()
                self.state = 427
                self.argList()
                self.state = 428
                self.match(SygusParser.T__0)
                self.state = 429
                self.nTDefPlus()
                self.state = 430
                self.match(SygusParser.T__2)
                self.state = 431
                self.match(SygusParser.T__2)
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 433
                self.match(SygusParser.T__0)
                self.state = 434
                self.match(SygusParser.T__25)
                self.state = 435
                self.symbol()
                self.state = 436
                self.argList()
                self.state = 437
                self.match(SygusParser.T__2)
                pass


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

    class DeclarePrimedVarContext(ParserRuleContext):

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

        def symbol(self):
            return self.getTypedRuleContext(SygusParser.SymbolContext,0)


        def sortExpr(self):
            return self.getTypedRuleContext(SygusParser.SortExprContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_declarePrimedVar

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

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

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




    def declarePrimedVar(self):

        localctx = SygusParser.DeclarePrimedVarContext(self, self._ctx, self.state)
        self.enterRule(localctx, 102, self.RULE_declarePrimedVar)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 441
            self.match(SygusParser.T__0)
            self.state = 442
            self.match(SygusParser.T__26)
            self.state = 443
            self.symbol()
            self.state = 444
            self.sortExpr()
            self.state = 445
            self.match(SygusParser.T__2)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class InvConstraintCmdContext(ParserRuleContext):

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

        def symbol(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(SygusParser.SymbolContext)
            else:
                return self.getTypedRuleContext(SygusParser.SymbolContext,i)


        def getRuleIndex(self):
            return SygusParser.RULE_invConstraintCmd

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

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

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




    def invConstraintCmd(self):

        localctx = SygusParser.InvConstraintCmdContext(self, self._ctx, self.state)
        self.enterRule(localctx, 104, self.RULE_invConstraintCmd)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 447
            self.match(SygusParser.T__0)
            self.state = 448
            self.match(SygusParser.T__27)
            self.state = 449
            self.symbol()
            self.state = 450
            self.symbol()
            self.state = 451
            self.symbol()
            self.state = 452
            self.symbol()
            self.state = 453
            self.match(SygusParser.T__2)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx






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

def serializedATN():
    with StringIO() as buf:
        buf.write("\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3%")
        buf.write("\u01ca\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\3\2\3\2\5\2o\n\2\3\3\3\3\3\3\3\3")
        buf.write("\5\3u\n\3\3\4\3\4\3\5\3\5\3\5\3\5\3\5\3\6\3\6\3\6\3\7")
        buf.write("\3\7\3\7\3\7\5\7\u0085\n\7\3\b\3\b\3\b\3\b\3\b\3\b\3\b")
        buf.write("\3\b\3\b\3\b\3\b\5\b\u0092\n\b\3\t\3\t\3\t\3\t\3\t\3\t")
        buf.write("\3\n\3\n\3\n\3\n\3\n\3\n\3\13\3\13\3\13\3\13\3\13\3\13")
        buf.write("\3\13\3\13\3\13\3\13\3\13\3\13\3\13\3\13\3\13\3\13\3\13")
        buf.write("\3\13\3\13\3\13\5\13\u00b4\n\13\3\f\3\f\3\r\3\r\3\16\3")
        buf.write("\16\3\17\3\17\3\17\3\17\3\20\3\20\3\21\3\21\3\21\3\21")
        buf.write("\3\22\3\22\3\22\3\23\3\23\3\23\3\23\5\23\u00cd\n\23\3")
        buf.write("\24\3\24\3\24\3\24\3\24\3\25\3\25\3\25\3\25\3\26\3\26")
        buf.write("\3\26\3\27\3\27\3\27\3\27\5\27\u00df\n\27\3\30\3\30\3")
        buf.write("\30\3\30\3\30\3\31\3\31\3\31\3\31\3\31\3\31\3\31\3\31")
        buf.write("\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\33\3\33")
        buf.write("\3\33\3\33\5\33\u00fb\n\33\3\34\3\34\3\34\3\34\3\35\3")
        buf.write("\35\3\35\3\35\5\35\u0105\n\35\3\36\3\36\3\36\3\36\3\36")
        buf.write("\3\37\3\37\3\37\3\37\3\37\3\37\3\37\3\37\5\37\u0114\n")
        buf.write("\37\3 \3 \3 \3 \3 \3 \3 \3 \3!\3!\3!\3\"\3\"\3\"\3\"\5")
        buf.write("\"\u0125\n\"\3#\3#\3#\3#\3#\3#\3$\3$\3$\3$\5$\u0131\n")
        buf.write("$\3%\3%\3%\3%\3%\5%\u0138\n%\3&\3&\3&\3\'\3\'\3\'\3\'")
        buf.write("\5\'\u0141\n\'\3(\3(\3(\3(\3(\3(\3(\3(\3)\3)\3)\3*\3*")
        buf.write("\3*\3*\5*\u0152\n*\3+\3+\3+\3+\3,\3,\3,\3,\3,\3-\3-\3")
        buf.write("-\3-\3-\3-\3-\3-\3-\3-\3-\3-\3-\3-\3-\3-\3-\5-\u016e\n")
        buf.write("-\3.\3.\3.\3.\3.\3.\3.\3.\3.\3.\3.\3.\3.\3.\3.\3.\3.\3")
        buf.write(".\3.\3.\3.\3.\3.\3.\3.\3.\3.\3.\5.\u018c\n.\3/\3/\3/\3")
        buf.write("/\3/\3/\3/\3/\3\60\3\60\3\60\3\61\3\61\3\61\3\61\5\61")
        buf.write("\u019d\n\61\3\62\3\62\3\62\3\62\3\62\3\62\3\63\3\63\3")
        buf.write("\63\3\63\5\63\u01a9\n\63\3\64\3\64\3\64\3\64\3\64\3\64")
        buf.write("\3\64\3\64\3\64\3\64\3\64\3\64\3\64\3\64\3\64\5\64\u01ba")
        buf.write("\n\64\3\65\3\65\3\65\3\65\3\65\3\65\3\66\3\66\3\66\3\66")
        buf.write("\3\66\3\66\3\66\3\66\3\66\2\2\67\2\4\6\b\n\f\16\20\22")
        buf.write("\24\26\30\32\34\36 \"$&(*,.\60\62\64\668:<>@BDFHJLNPR")
        buf.write("TVXZ\\^`bdfhj\2\3\3\2\16\17\2\u01c1\2n\3\2\2\2\4t\3\2")
        buf.write("\2\2\6v\3\2\2\2\bx\3\2\2\2\n}\3\2\2\2\f\u0084\3\2\2\2")
        buf.write("\16\u0091\3\2\2\2\20\u0093\3\2\2\2\22\u0099\3\2\2\2\24")
        buf.write("\u00b3\3\2\2\2\26\u00b5\3\2\2\2\30\u00b7\3\2\2\2\32\u00b9")
        buf.write("\3\2\2\2\34\u00bb\3\2\2\2\36\u00bf\3\2\2\2 \u00c1\3\2")
        buf.write("\2\2\"\u00c5\3\2\2\2$\u00cc\3\2\2\2&\u00ce\3\2\2\2(\u00d3")
        buf.write("\3\2\2\2*\u00d7\3\2\2\2,\u00de\3\2\2\2.\u00e0\3\2\2\2")
        buf.write("\60\u00e5\3\2\2\2\62\u00ed\3\2\2\2\64\u00fa\3\2\2\2\66")
        buf.write("\u00fc\3\2\2\28\u0104\3\2\2\2:\u0106\3\2\2\2<\u0113\3")
        buf.write("\2\2\2>\u0115\3\2\2\2@\u011d\3\2\2\2B\u0124\3\2\2\2D\u0126")
        buf.write("\3\2\2\2F\u0130\3\2\2\2H\u0137\3\2\2\2J\u0139\3\2\2\2")
        buf.write("L\u0140\3\2\2\2N\u0142\3\2\2\2P\u014a\3\2\2\2R\u0151\3")
        buf.write("\2\2\2T\u0153\3\2\2\2V\u0157\3\2\2\2X\u016d\3\2\2\2Z\u018b")
        buf.write("\3\2\2\2\\\u018d\3\2\2\2^\u0195\3\2\2\2`\u019c\3\2\2\2")
        buf.write("b\u019e\3\2\2\2d\u01a8\3\2\2\2f\u01b9\3\2\2\2h\u01bb\3")
        buf.write("\2\2\2j\u01c1\3\2\2\2lo\5\4\3\2mo\3\2\2\2nl\3\2\2\2nm")
        buf.write("\3\2\2\2o\3\3\2\2\2pq\5\b\5\2qr\5\n\6\2ru\3\2\2\2su\5")
        buf.write("\n\6\2tp\3\2\2\2ts\3\2\2\2u\5\3\2\2\2vw\7%\2\2w\7\3\2")
        buf.write("\2\2xy\7\3\2\2yz\7\4\2\2z{\5\6\4\2{|\7\5\2\2|\t\3\2\2")
        buf.write("\2}~\5\16\b\2~\177\5\f\7\2\177\13\3\2\2\2\u0080\u0081")
        buf.write("\5\16\b\2\u0081\u0082\5\f\7\2\u0082\u0085\3\2\2\2\u0083")
        buf.write("\u0085\3\2\2\2\u0084\u0080\3\2\2\2\u0084\u0083\3\2\2\2")
        buf.write("\u0085\r\3\2\2\2\u0086\u0092\5\60\31\2\u0087\u0092\5\62")
        buf.write("\32\2\u0088\u0092\5X-\2\u0089\u0092\5T+\2\u008a\u0092")
        buf.write("\5V,\2\u008b\u0092\5\22\n\2\u008c\u0092\5&\24\2\u008d")
        buf.write("\u0092\5\20\t\2\u008e\u0092\5f\64\2\u008f\u0092\5h\65")
        buf.write("\2\u0090\u0092\5j\66\2\u0091\u0086\3\2\2\2\u0091\u0087")
        buf.write("\3\2\2\2\u0091\u0088\3\2\2\2\u0091\u0089\3\2\2\2\u0091")
        buf.write("\u008a\3\2\2\2\u0091\u008b\3\2\2\2\u0091\u008c\3\2\2\2")
        buf.write("\u0091\u008d\3\2\2\2\u0091\u008e\3\2\2\2\u0091\u008f\3")
        buf.write("\2\2\2\u0091\u0090\3\2\2\2\u0092\17\3\2\2\2\u0093\u0094")
        buf.write("\7\3\2\2\u0094\u0095\7\6\2\2\u0095\u0096\5\6\4\2\u0096")
        buf.write("\u0097\5\24\13\2\u0097\u0098\7\5\2\2\u0098\21\3\2\2\2")
        buf.write("\u0099\u009a\7\3\2\2\u009a\u009b\7\7\2\2\u009b\u009c\5")
        buf.write("\6\4\2\u009c\u009d\5\24\13\2\u009d\u009e\7\5\2\2\u009e")
        buf.write("\23\3\2\2\2\u009f\u00a0\7\3\2\2\u00a0\u00a1\7\b\2\2\u00a1")
        buf.write("\u00a2\5\26\f\2\u00a2\u00a3\7\5\2\2\u00a3\u00b4\3\2\2")
        buf.write("\2\u00a4\u00b4\7\t\2\2\u00a5\u00b4\7\n\2\2\u00a6\u00b4")
        buf.write("\7\13\2\2\u00a7\u00a8\7\3\2\2\u00a8\u00a9\7\f\2\2\u00a9")
        buf.write("\u00aa\5 \21\2\u00aa\u00ab\7\5\2\2\u00ab\u00b4\3\2\2\2")
        buf.write("\u00ac\u00ad\7\3\2\2\u00ad\u00ae\7\r\2\2\u00ae\u00af\5")
        buf.write("\24\13\2\u00af\u00b0\5\24\13\2\u00b0\u00b1\7\5\2\2\u00b1")
        buf.write("\u00b4\3\2\2\2\u00b2\u00b4\5\6\4\2\u00b3\u009f\3\2\2\2")
        buf.write("\u00b3\u00a4\3\2\2\2\u00b3\u00a5\3\2\2\2\u00b3\u00a6\3")
        buf.write("\2\2\2\u00b3\u00a7\3\2\2\2\u00b3\u00ac\3\2\2\2\u00b3\u00b2")
        buf.write("\3\2\2\2\u00b4\25\3\2\2\2\u00b5\u00b6\7!\2\2\u00b6\27")
        buf.write("\3\2\2\2\u00b7\u00b8\t\2\2\2\u00b8\31\3\2\2\2\u00b9\u00ba")
        buf.write("\7\"\2\2\u00ba\33\3\2\2\2\u00bb\u00bc\5\6\4\2\u00bc\u00bd")
        buf.write("\7\20\2\2\u00bd\u00be\5\6\4\2\u00be\35\3\2\2\2\u00bf\u00c0")
        buf.write("\7#\2\2\u00c0\37\3\2\2\2\u00c1\u00c2\7\3\2\2\u00c2\u00c3")
        buf.write("\5\"\22\2\u00c3\u00c4\7\5\2\2\u00c4!\3\2\2\2\u00c5\u00c6")
        buf.write("\5\6\4\2\u00c6\u00c7\5$\23\2\u00c7#\3\2\2\2\u00c8\u00c9")
        buf.write("\5\6\4\2\u00c9\u00ca\5$\23\2\u00ca\u00cd\3\2\2\2\u00cb")
        buf.write("\u00cd\3\2\2\2\u00cc\u00c8\3\2\2\2\u00cc\u00cb\3\2\2\2")
        buf.write("\u00cd%\3\2\2\2\u00ce\u00cf\7\3\2\2\u00cf\u00d0\7\21\2")
        buf.write("\2\u00d0\u00d1\5(\25\2\u00d1\u00d2\7\5\2\2\u00d2\'\3\2")
        buf.write("\2\2\u00d3\u00d4\7\3\2\2\u00d4\u00d5\5*\26\2\u00d5\u00d6")
        buf.write("\7\5\2\2\u00d6)\3\2\2\2\u00d7\u00d8\5.\30\2\u00d8\u00d9")
        buf.write("\5,\27\2\u00d9+\3\2\2\2\u00da\u00db\5.\30\2\u00db\u00dc")
        buf.write("\5,\27\2\u00dc\u00df\3\2\2\2\u00dd\u00df\3\2\2\2\u00de")
        buf.write("\u00da\3\2\2\2\u00de\u00dd\3\2\2\2\u00df-\3\2\2\2\u00e0")
        buf.write("\u00e1\7\3\2\2\u00e1\u00e2\5\6\4\2\u00e2\u00e3\7$\2\2")
        buf.write("\u00e3\u00e4\7\5\2\2\u00e4/\3\2\2\2\u00e5\u00e6\7\3\2")
        buf.write("\2\u00e6\u00e7\7\22\2\2\u00e7\u00e8\5\6\4\2\u00e8\u00e9")
        buf.write("\5\66\34\2\u00e9\u00ea\5\24\13\2\u00ea\u00eb\5<\37\2\u00eb")
        buf.write("\u00ec\7\5\2\2\u00ec\61\3\2\2\2\u00ed\u00ee\7\3\2\2\u00ee")
        buf.write("\u00ef\7\23\2\2\u00ef\u00f0\5\6\4\2\u00f0\u00f1\7\3\2")
        buf.write("\2\u00f1\u00f2\5\64\33\2\u00f2\u00f3\7\5\2\2\u00f3\u00f4")
        buf.write("\5\24\13\2\u00f4\u00f5\7\5\2\2\u00f5\63\3\2\2\2\u00f6")
        buf.write("\u00f7\5\24\13\2\u00f7\u00f8\5\64\33\2\u00f8\u00fb\3\2")
        buf.write("\2\2\u00f9\u00fb\3\2\2\2\u00fa\u00f6\3\2\2\2\u00fa\u00f9")
        buf.write("\3\2\2\2\u00fb\65\3\2\2\2\u00fc\u00fd\7\3\2\2\u00fd\u00fe")
        buf.write("\58\35\2\u00fe\u00ff\7\5\2\2\u00ff\67\3\2\2\2\u0100\u0101")
        buf.write("\5:\36\2\u0101\u0102\58\35\2\u0102\u0105\3\2\2\2\u0103")
        buf.write("\u0105\3\2\2\2\u0104\u0100\3\2\2\2\u0104\u0103\3\2\2\2")
        buf.write("\u01059\3\2\2\2\u0106\u0107\7\3\2\2\u0107\u0108\5\6\4")
        buf.write("\2\u0108\u0109\5\24\13\2\u0109\u010a\7\5\2\2\u010a;\3")
        buf.write("\2\2\2\u010b\u010c\7\3\2\2\u010c\u010d\5\6\4\2\u010d\u010e")
        buf.write("\5F$\2\u010e\u010f\7\5\2\2\u010f\u0114\3\2\2\2\u0110\u0114")
        buf.write("\5H%\2\u0111\u0114\5\6\4\2\u0112\u0114\5> \2\u0113\u010b")
        buf.write("\3\2\2\2\u0113\u0110\3\2\2\2\u0113\u0111\3\2\2\2\u0113")
        buf.write("\u0112\3\2\2\2\u0114=\3\2\2\2\u0115\u0116\7\3\2\2\u0116")
        buf.write("\u0117\7\24\2\2\u0117\u0118\7\3\2\2\u0118\u0119\5@!\2")
        buf.write("\u0119\u011a\7\5\2\2\u011a\u011b\5<\37\2\u011b\u011c\7")
        buf.write("\5\2\2\u011c?\3\2\2\2\u011d\u011e\5D#\2\u011e\u011f\5")
        buf.write("B\"\2\u011fA\3\2\2\2\u0120\u0121\5D#\2\u0121\u0122\5B")
        buf.write("\"\2\u0122\u0125\3\2\2\2\u0123\u0125\3\2\2\2\u0124\u0120")
        buf.write("\3\2\2\2\u0124\u0123\3\2\2\2\u0125C\3\2\2\2\u0126\u0127")
        buf.write("\7\3\2\2\u0127\u0128\5\6\4\2\u0128\u0129\5\24\13\2\u0129")
        buf.write("\u012a\5<\37\2\u012a\u012b\7\5\2\2\u012bE\3\2\2\2\u012c")
        buf.write("\u012d\5<\37\2\u012d\u012e\5F$\2\u012e\u0131\3\2\2\2\u012f")
        buf.write("\u0131\3\2\2\2\u0130\u012c\3\2\2\2\u0130\u012f\3\2\2\2")
        buf.write("\u0131G\3\2\2\2\u0132\u0138\5\26\f\2\u0133\u0138\5\30")
        buf.write("\r\2\u0134\u0138\5\32\16\2\u0135\u0138\5\34\17\2\u0136")
        buf.write("\u0138\5\36\20\2\u0137\u0132\3\2\2\2\u0137\u0133\3\2\2")
        buf.write("\2\u0137\u0134\3\2\2\2\u0137\u0135\3\2\2\2\u0137\u0136")
        buf.write("\3\2\2\2\u0138I\3\2\2\2\u0139\u013a\5N(\2\u013a\u013b")
        buf.write("\5L\'\2\u013bK\3\2\2\2\u013c\u013d\5N(\2\u013d\u013e\5")
        buf.write("L\'\2\u013e\u0141\3\2\2\2\u013f\u0141\3\2\2\2\u0140\u013c")
        buf.write("\3\2\2\2\u0140\u013f\3\2\2\2\u0141M\3\2\2\2\u0142\u0143")
        buf.write("\7\3\2\2\u0143\u0144\5\6\4\2\u0144\u0145\5\24\13\2\u0145")
        buf.write("\u0146\7\3\2\2\u0146\u0147\5P)\2\u0147\u0148\7\5\2\2\u0148")
        buf.write("\u0149\7\5\2\2\u0149O\3\2\2\2\u014a\u014b\5Z.\2\u014b")
        buf.write("\u014c\5R*\2\u014cQ\3\2\2\2\u014d\u014e\5Z.\2\u014e\u014f")
        buf.write("\5R*\2\u014f\u0152\3\2\2\2\u0150\u0152\3\2\2\2\u0151\u014d")
        buf.write("\3\2\2\2\u0151\u0150\3\2\2\2\u0152S\3\2\2\2\u0153\u0154")
        buf.write("\7\3\2\2\u0154\u0155\7\25\2\2\u0155\u0156\7\5\2\2\u0156")
        buf.write("U\3\2\2\2\u0157\u0158\7\3\2\2\u0158\u0159\7\26\2\2\u0159")
        buf.write("\u015a\5<\37\2\u015a\u015b\7\5\2\2\u015bW\3\2\2\2\u015c")
        buf.write("\u015d\7\3\2\2\u015d\u015e\7\27\2\2\u015e\u015f\5\6\4")
        buf.write("\2\u015f\u0160\5\66\34\2\u0160\u0161\5\24\13\2\u0161\u0162")
        buf.write("\7\3\2\2\u0162\u0163\5J&\2\u0163\u0164\7\5\2\2\u0164\u0165")
        buf.write("\7\5\2\2\u0165\u016e\3\2\2\2\u0166\u0167\7\3\2\2\u0167")
        buf.write("\u0168\7\27\2\2\u0168\u0169\5\6\4\2\u0169\u016a\5\66\34")
        buf.write("\2\u016a\u016b\5\24\13\2\u016b\u016c\7\5\2\2\u016c\u016e")
        buf.write("\3\2\2\2\u016d\u015c\3\2\2\2\u016d\u0166\3\2\2\2\u016e")
        buf.write("Y\3\2\2\2\u016f\u018c\5\6\4\2\u0170\u018c\5H%\2\u0171")
        buf.write("\u0172\7\3\2\2\u0172\u0173\5\6\4\2\u0173\u0174\5d\63\2")
        buf.write("\u0174\u0175\7\5\2\2\u0175\u018c\3\2\2\2\u0176\u0177\7")
        buf.write("\3\2\2\u0177\u0178\7\30\2\2\u0178\u0179\5\24\13\2\u0179")
        buf.write("\u017a\7\5\2\2\u017a\u018c\3\2\2\2\u017b\u017c\7\3\2\2")
        buf.write("\u017c\u017d\7\31\2\2\u017d\u017e\5\24\13\2\u017e\u017f")
        buf.write("\7\5\2\2\u017f\u018c\3\2\2\2\u0180\u0181\7\3\2\2\u0181")
        buf.write("\u0182\7\32\2\2\u0182\u0183\5\24\13\2\u0183\u0184\7\5")
        buf.write("\2\2\u0184\u018c\3\2\2\2\u0185\u0186\7\3\2\2\u0186\u0187")
        buf.write("\7\33\2\2\u0187\u0188\5\24\13\2\u0188\u0189\7\5\2\2\u0189")
        buf.write("\u018c\3\2\2\2\u018a\u018c\5\\/\2\u018b\u016f\3\2\2\2")
        buf.write("\u018b\u0170\3\2\2\2\u018b\u0171\3\2\2\2\u018b\u0176\3")
        buf.write("\2\2\2\u018b\u017b\3\2\2\2\u018b\u0180\3\2\2\2\u018b\u0185")
        buf.write("\3\2\2\2\u018b\u018a\3\2\2\2\u018c[\3\2\2\2\u018d\u018e")
        buf.write("\7\3\2\2\u018e\u018f\7\24\2\2\u018f\u0190\7\3\2\2\u0190")
        buf.write("\u0191\5^\60\2\u0191\u0192\7\5\2\2\u0192\u0193\5Z.\2\u0193")
        buf.write("\u0194\7\5\2\2\u0194]\3\2\2\2\u0195\u0196\5b\62\2\u0196")
        buf.write("\u0197\5`\61\2\u0197_\3\2\2\2\u0198\u0199\5b\62\2\u0199")
        buf.write("\u019a\5`\61\2\u019a\u019d\3\2\2\2\u019b\u019d\3\2\2\2")
        buf.write("\u019c\u0198\3\2\2\2\u019c\u019b\3\2\2\2\u019da\3\2\2")
        buf.write("\2\u019e\u019f\7\3\2\2\u019f\u01a0\5\6\4\2\u01a0\u01a1")
        buf.write("\5\24\13\2\u01a1\u01a2\5Z.\2\u01a2\u01a3\7\5\2\2\u01a3")
        buf.write("c\3\2\2\2\u01a4\u01a5\5Z.\2\u01a5\u01a6\5d\63\2\u01a6")
        buf.write("\u01a9\3\2\2\2\u01a7\u01a9\3\2\2\2\u01a8\u01a4\3\2\2\2")
        buf.write("\u01a8\u01a7\3\2\2\2\u01a9e\3\2\2\2\u01aa\u01ab\7\3\2")
        buf.write("\2\u01ab\u01ac\7\34\2\2\u01ac\u01ad\5\6\4\2\u01ad\u01ae")
        buf.write("\5\66\34\2\u01ae\u01af\7\3\2\2\u01af\u01b0\5J&\2\u01b0")
        buf.write("\u01b1\7\5\2\2\u01b1\u01b2\7\5\2\2\u01b2\u01ba\3\2\2\2")
        buf.write("\u01b3\u01b4\7\3\2\2\u01b4\u01b5\7\34\2\2\u01b5\u01b6")
        buf.write("\5\6\4\2\u01b6\u01b7\5\66\34\2\u01b7\u01b8\7\5\2\2\u01b8")
        buf.write("\u01ba\3\2\2\2\u01b9\u01aa\3\2\2\2\u01b9\u01b3\3\2\2\2")
        buf.write("\u01bag\3\2\2\2\u01bb\u01bc\7\3\2\2\u01bc\u01bd\7\35\2")
        buf.write("\2\u01bd\u01be\5\6\4\2\u01be\u01bf\5\24\13\2\u01bf\u01c0")
        buf.write("\7\5\2\2\u01c0i\3\2\2\2\u01c1\u01c2\7\3\2\2\u01c2\u01c3")
        buf.write("\7\36\2\2\u01c3\u01c4\5\6\4\2\u01c4\u01c5\5\6\4\2\u01c5")
        buf.write("\u01c6\5\6\4\2\u01c6\u01c7\5\6\4\2\u01c7\u01c8\7\5\2\2")
        buf.write("\u01c8k\3\2\2\2\26nt\u0084\u0091\u00b3\u00cc\u00de\u00fa")
        buf.write("\u0104\u0113\u0124\u0130\u0137\u0140\u0151\u016d\u018b")
        buf.write("\u019c\u01a8\u01b9")
        return buf.getvalue()


class SygusParser ( Parser ):

    grammarFileName = "Sygus.g4"

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

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

    sharedContextCache = PredictionContextCache()

    literalNames = [ "<INVALID>", "'('", "'set-logic'", "')'", "'declare-var'", 
                     "'define-sort'", "'BitVec'", "'Int'", "'Bool'", "'Real'", 
                     "'Enum'", "'Array'", "'true'", "'false'", "'::'", "'set-options'", 
                     "'define-fun'", "'declare-fun'", "'let'", "'check-synth'", 
                     "'constraint'", "'synth-fun'", "'Constant'", "'Variable'", 
                     "'InputVariable'", "'LocalVariable'", "'synth-inv'", 
                     "'declare-primed-var'", "'inv-constraint'" ]

    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>", "WS", "COMMENT", "INTEGER", "BVCONST", 
                      "REALCONST", "QUOTEDLIT", "SYMBOL" ]

    RULE_start = 0
    RULE_prog = 1
    RULE_symbol = 2
    RULE_setLogicCmd = 3
    RULE_cmdPlus = 4
    RULE_cmdPlusTail = 5
    RULE_cmd = 6
    RULE_varDeclCmd = 7
    RULE_sortDefCmd = 8
    RULE_sortExpr = 9
    RULE_intConst = 10
    RULE_boolConst = 11
    RULE_bVConst = 12
    RULE_enumConst = 13
    RULE_realConst = 14
    RULE_eCList = 15
    RULE_symbolPlus = 16
    RULE_symbolPlusTail = 17
    RULE_setOptsCmd = 18
    RULE_optList = 19
    RULE_symbolPairPlus = 20
    RULE_symbolPairPlusTail = 21
    RULE_symbolPair = 22
    RULE_funDefCmd = 23
    RULE_funDeclCmd = 24
    RULE_sortStar = 25
    RULE_argList = 26
    RULE_symbolSortPairStar = 27
    RULE_symbolSortPair = 28
    RULE_term = 29
    RULE_letTerm = 30
    RULE_letBindingTermPlus = 31
    RULE_letBindingTermPlusTail = 32
    RULE_letBindingTerm = 33
    RULE_termStar = 34
    RULE_literal = 35
    RULE_nTDefPlus = 36
    RULE_nTDefPlusTail = 37
    RULE_nTDef = 38
    RULE_gTermPlus = 39
    RULE_gTermPlusTail = 40
    RULE_checkSynthCmd = 41
    RULE_constraintCmd = 42
    RULE_synthFunCmd = 43
    RULE_gTerm = 44
    RULE_letGTerm = 45
    RULE_letBindingGTermPlus = 46
    RULE_letBindingGTermPlusTail = 47
    RULE_letBindingGTerm = 48
    RULE_gTermStar = 49
    RULE_synthInvCmd = 50
    RULE_declarePrimedVar = 51
    RULE_invConstraintCmd = 52

    ruleNames =  [ "start", "prog", "symbol", "setLogicCmd", "cmdPlus", 
                   "cmdPlusTail", "cmd", "varDeclCmd", "sortDefCmd", "sortExpr", 
                   "intConst", "boolConst", "bVConst", "enumConst", "realConst", 
                   "eCList", "symbolPlus", "symbolPlusTail", "setOptsCmd", 
                   "optList", "symbolPairPlus", "symbolPairPlusTail", "symbolPair", 
                   "funDefCmd", "funDeclCmd", "sortStar", "argList", "symbolSortPairStar", 
                   "symbolSortPair", "term", "letTerm", "letBindingTermPlus", 
                   "letBindingTermPlusTail", "letBindingTerm", "termStar", 
                   "literal", "nTDefPlus", "nTDefPlusTail", "nTDef", "gTermPlus", 
                   "gTermPlusTail", "checkSynthCmd", "constraintCmd", "synthFunCmd", 
                   "gTerm", "letGTerm", "letBindingGTermPlus", "letBindingGTermPlusTail", 
                   "letBindingGTerm", "gTermStar", "synthInvCmd", "declarePrimedVar", 
                   "invConstraintCmd" ]

    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
    WS=29
    COMMENT=30
    INTEGER=31
    BVCONST=32
    REALCONST=33
    QUOTEDLIT=34
    SYMBOL=35

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



    class StartContext(ParserRuleContext):

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

        def prog(self):
            return self.getTypedRuleContext(SygusParser.ProgContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_start

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

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

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




    def start(self):

        localctx = SygusParser.StartContext(self, self._ctx, self.state)
        self.enterRule(localctx, 0, self.RULE_start)
        try:
            self.state = 108
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [SygusParser.T__0]:
                self.enterOuterAlt(localctx, 1)
                self.state = 106
                self.prog()
                pass
            elif token in [SygusParser.EOF]:
                self.enterOuterAlt(localctx, 2)

                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 ProgContext(ParserRuleContext):

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

        def setLogicCmd(self):
            return self.getTypedRuleContext(SygusParser.SetLogicCmdContext,0)


        def cmdPlus(self):
            return self.getTypedRuleContext(SygusParser.CmdPlusContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_prog

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

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

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




    def prog(self):

        localctx = SygusParser.ProgContext(self, self._ctx, self.state)
        self.enterRule(localctx, 2, self.RULE_prog)
        try:
            self.state = 114
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,1,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 110
                self.setLogicCmd()
                self.state = 111
                self.cmdPlus()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 113
                self.cmdPlus()
                pass


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

    class SymbolContext(ParserRuleContext):

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

        def SYMBOL(self):
            return self.getToken(SygusParser.SYMBOL, 0)

        def getRuleIndex(self):
            return SygusParser.RULE_symbol

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

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

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




    def symbol(self):

        localctx = SygusParser.SymbolContext(self, self._ctx, self.state)
        self.enterRule(localctx, 4, self.RULE_symbol)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 116
            self.match(SygusParser.SYMBOL)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class SetLogicCmdContext(ParserRuleContext):

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

        def symbol(self):
            return self.getTypedRuleContext(SygusParser.SymbolContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_setLogicCmd

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

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

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




    def setLogicCmd(self):

        localctx = SygusParser.SetLogicCmdContext(self, self._ctx, self.state)
        self.enterRule(localctx, 6, self.RULE_setLogicCmd)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 118
            self.match(SygusParser.T__0)
            self.state = 119
            self.match(SygusParser.T__1)
            self.state = 120
            self.symbol()
            self.state = 121
            self.match(SygusParser.T__2)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class CmdPlusContext(ParserRuleContext):

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

        def cmd(self):
            return self.getTypedRuleContext(SygusParser.CmdContext,0)


        def cmdPlusTail(self):
            return self.getTypedRuleContext(SygusParser.CmdPlusTailContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_cmdPlus

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

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

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




    def cmdPlus(self):

        localctx = SygusParser.CmdPlusContext(self, self._ctx, self.state)
        self.enterRule(localctx, 8, self.RULE_cmdPlus)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 123
            self.cmd()
            self.state = 124
            self.cmdPlusTail()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class CmdPlusTailContext(ParserRuleContext):

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

        def cmd(self):
            return self.getTypedRuleContext(SygusParser.CmdContext,0)


        def cmdPlusTail(self):
            return self.getTypedRuleContext(SygusParser.CmdPlusTailContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_cmdPlusTail

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

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

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




    def cmdPlusTail(self):

        localctx = SygusParser.CmdPlusTailContext(self, self._ctx, self.state)
        self.enterRule(localctx, 10, self.RULE_cmdPlusTail)
        try:
            self.state = 130
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [SygusParser.T__0]:
                self.enterOuterAlt(localctx, 1)
                self.state = 126
                self.cmd()
                self.state = 127
                self.cmdPlusTail()
                pass
            elif token in [SygusParser.EOF]:
                self.enterOuterAlt(localctx, 2)

                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 CmdContext(ParserRuleContext):

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

        def funDefCmd(self):
            return self.getTypedRuleContext(SygusParser.FunDefCmdContext,0)


        def funDeclCmd(self):
            return self.getTypedRuleContext(SygusParser.FunDeclCmdContext,0)


        def synthFunCmd(self):
            return self.getTypedRuleContext(SygusParser.SynthFunCmdContext,0)


        def checkSynthCmd(self):
            return self.getTypedRuleContext(SygusParser.CheckSynthCmdContext,0)


        def constraintCmd(self):
            return self.getTypedRuleContext(SygusParser.ConstraintCmdContext,0)


        def sortDefCmd(self):
            return self.getTypedRuleContext(SygusParser.SortDefCmdContext,0)


        def setOptsCmd(self):
            return self.getTypedRuleContext(SygusParser.SetOptsCmdContext,0)


        def varDeclCmd(self):
            return self.getTypedRuleContext(SygusParser.VarDeclCmdContext,0)


        def synthInvCmd(self):
            return self.getTypedRuleContext(SygusParser.SynthInvCmdContext,0)


        def declarePrimedVar(self):
            return self.getTypedRuleContext(SygusParser.DeclarePrimedVarContext,0)


        def invConstraintCmd(self):
            return self.getTypedRuleContext(SygusParser.InvConstraintCmdContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_cmd

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

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

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




    def cmd(self):

        localctx = SygusParser.CmdContext(self, self._ctx, self.state)
        self.enterRule(localctx, 12, self.RULE_cmd)
        try:
            self.state = 143
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,3,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 132
                self.funDefCmd()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 133
                self.funDeclCmd()
                pass

            elif la_ == 3:
                self.enterOuterAlt(localctx, 3)
                self.state = 134
                self.synthFunCmd()
                pass

            elif la_ == 4:
                self.enterOuterAlt(localctx, 4)
                self.state = 135
                self.checkSynthCmd()
                pass

            elif la_ == 5:
                self.enterOuterAlt(localctx, 5)
                self.state = 136
                self.constraintCmd()
                pass

            elif la_ == 6:
                self.enterOuterAlt(localctx, 6)
                self.state = 137
                self.sortDefCmd()
                pass

            elif la_ == 7:
                self.enterOuterAlt(localctx, 7)
                self.state = 138
                self.setOptsCmd()
                pass

            elif la_ == 8:
                self.enterOuterAlt(localctx, 8)
                self.state = 139
                self.varDeclCmd()
                pass

            elif la_ == 9:
                self.enterOuterAlt(localctx, 9)
                self.state = 140
                self.synthInvCmd()
                pass

            elif la_ == 10:
                self.enterOuterAlt(localctx, 10)
                self.state = 141
                self.declarePrimedVar()
                pass

            elif la_ == 11:
                self.enterOuterAlt(localctx, 11)
                self.state = 142
                self.invConstraintCmd()
                pass


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

    class VarDeclCmdContext(ParserRuleContext):

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

        def symbol(self):
            return self.getTypedRuleContext(SygusParser.SymbolContext,0)


        def sortExpr(self):
            return self.getTypedRuleContext(SygusParser.SortExprContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_varDeclCmd

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

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

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




    def varDeclCmd(self):

        localctx = SygusParser.VarDeclCmdContext(self, self._ctx, self.state)
        self.enterRule(localctx, 14, self.RULE_varDeclCmd)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 145
            self.match(SygusParser.T__0)
            self.state = 146
            self.match(SygusParser.T__3)
            self.state = 147
            self.symbol()
            self.state = 148
            self.sortExpr()
            self.state = 149
            self.match(SygusParser.T__2)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class SortDefCmdContext(ParserRuleContext):

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

        def symbol(self):
            return self.getTypedRuleContext(SygusParser.SymbolContext,0)


        def sortExpr(self):
            return self.getTypedRuleContext(SygusParser.SortExprContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_sortDefCmd

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

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

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




    def sortDefCmd(self):

        localctx = SygusParser.SortDefCmdContext(self, self._ctx, self.state)
        self.enterRule(localctx, 16, self.RULE_sortDefCmd)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 151
            self.match(SygusParser.T__0)
            self.state = 152
            self.match(SygusParser.T__4)
            self.state = 153
            self.symbol()
            self.state = 154
            self.sortExpr()
            self.state = 155
            self.match(SygusParser.T__2)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class SortExprContext(ParserRuleContext):

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

        def intConst(self):
            return self.getTypedRuleContext(SygusParser.IntConstContext,0)


        def eCList(self):
            return self.getTypedRuleContext(SygusParser.ECListContext,0)


        def sortExpr(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(SygusParser.SortExprContext)
            else:
                return self.getTypedRuleContext(SygusParser.SortExprContext,i)


        def symbol(self):
            return self.getTypedRuleContext(SygusParser.SymbolContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_sortExpr

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

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

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




    def sortExpr(self):

        localctx = SygusParser.SortExprContext(self, self._ctx, self.state)
        self.enterRule(localctx, 18, self.RULE_sortExpr)
        try:
            self.state = 177
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,4,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 157
                self.match(SygusParser.T__0)
                self.state = 158
                self.match(SygusParser.T__5)
                self.state = 159
                self.intConst()
                self.state = 160
                self.match(SygusParser.T__2)
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 162
                self.match(SygusParser.T__6)
                pass

            elif la_ == 3:
                self.enterOuterAlt(localctx, 3)
                self.state = 163
                self.match(SygusParser.T__7)
                pass

            elif la_ == 4:
                self.enterOuterAlt(localctx, 4)
                self.state = 164
                self.match(SygusParser.T__8)
                pass

            elif la_ == 5:
                self.enterOuterAlt(localctx, 5)
                self.state = 165
                self.match(SygusParser.T__0)
                self.state = 166
                self.match(SygusParser.T__9)
                self.state = 167
                self.eCList()
                self.state = 168
                self.match(SygusParser.T__2)
                pass

            elif la_ == 6:
                self.enterOuterAlt(localctx, 6)
                self.state = 170
                self.match(SygusParser.T__0)
                self.state = 171
                self.match(SygusParser.T__10)
                self.state = 172
                self.sortExpr()
                self.state = 173
                self.sortExpr()
                self.state = 174
                self.match(SygusParser.T__2)
                pass

            elif la_ == 7:
                self.enterOuterAlt(localctx, 7)
                self.state = 176
                self.symbol()
                pass


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

    class IntConstContext(ParserRuleContext):

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

        def INTEGER(self):
            return self.getToken(SygusParser.INTEGER, 0)

        def getRuleIndex(self):
            return SygusParser.RULE_intConst

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

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

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




    def intConst(self):

        localctx = SygusParser.IntConstContext(self, self._ctx, self.state)
        self.enterRule(localctx, 20, self.RULE_intConst)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 179
            self.match(SygusParser.INTEGER)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class BoolConstContext(ParserRuleContext):

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


        def getRuleIndex(self):
            return SygusParser.RULE_boolConst

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

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

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




    def boolConst(self):

        localctx = SygusParser.BoolConstContext(self, self._ctx, self.state)
        self.enterRule(localctx, 22, self.RULE_boolConst)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 181
            _la = self._input.LA(1)
            if not(_la==SygusParser.T__11 or _la==SygusParser.T__12):
                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 BVConstContext(ParserRuleContext):

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

        def BVCONST(self):
            return self.getToken(SygusParser.BVCONST, 0)

        def getRuleIndex(self):
            return SygusParser.RULE_bVConst

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

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

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




    def bVConst(self):

        localctx = SygusParser.BVConstContext(self, self._ctx, self.state)
        self.enterRule(localctx, 24, self.RULE_bVConst)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 183
            self.match(SygusParser.BVCONST)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class EnumConstContext(ParserRuleContext):

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

        def symbol(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(SygusParser.SymbolContext)
            else:
                return self.getTypedRuleContext(SygusParser.SymbolContext,i)


        def getRuleIndex(self):
            return SygusParser.RULE_enumConst

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

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

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




    def enumConst(self):

        localctx = SygusParser.EnumConstContext(self, self._ctx, self.state)
        self.enterRule(localctx, 26, self.RULE_enumConst)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 185
            self.symbol()
            self.state = 186
            self.match(SygusParser.T__13)
            self.state = 187
            self.symbol()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class RealConstContext(ParserRuleContext):

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

        def REALCONST(self):
            return self.getToken(SygusParser.REALCONST, 0)

        def getRuleIndex(self):
            return SygusParser.RULE_realConst

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

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

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




    def realConst(self):

        localctx = SygusParser.RealConstContext(self, self._ctx, self.state)
        self.enterRule(localctx, 28, self.RULE_realConst)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 189
            self.match(SygusParser.REALCONST)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class ECListContext(ParserRuleContext):

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

        def symbolPlus(self):
            return self.getTypedRuleContext(SygusParser.SymbolPlusContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_eCList

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

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

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




    def eCList(self):

        localctx = SygusParser.ECListContext(self, self._ctx, self.state)
        self.enterRule(localctx, 30, self.RULE_eCList)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 191
            self.match(SygusParser.T__0)
            self.state = 192
            self.symbolPlus()
            self.state = 193
            self.match(SygusParser.T__2)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class SymbolPlusContext(ParserRuleContext):

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

        def symbol(self):
            return self.getTypedRuleContext(SygusParser.SymbolContext,0)


        def symbolPlusTail(self):
            return self.getTypedRuleContext(SygusParser.SymbolPlusTailContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_symbolPlus

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

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

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




    def symbolPlus(self):

        localctx = SygusParser.SymbolPlusContext(self, self._ctx, self.state)
        self.enterRule(localctx, 32, self.RULE_symbolPlus)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 195
            self.symbol()
            self.state = 196
            self.symbolPlusTail()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class SymbolPlusTailContext(ParserRuleContext):

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

        def symbol(self):
            return self.getTypedRuleContext(SygusParser.SymbolContext,0)


        def symbolPlusTail(self):
            return self.getTypedRuleContext(SygusParser.SymbolPlusTailContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_symbolPlusTail

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

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

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




    def symbolPlusTail(self):

        localctx = SygusParser.SymbolPlusTailContext(self, self._ctx, self.state)
        self.enterRule(localctx, 34, self.RULE_symbolPlusTail)
        try:
            self.state = 202
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [SygusParser.SYMBOL]:
                self.enterOuterAlt(localctx, 1)
                self.state = 198
                self.symbol()
                self.state = 199
                self.symbolPlusTail()
                pass
            elif token in [SygusParser.T__2]:
                self.enterOuterAlt(localctx, 2)

                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 SetOptsCmdContext(ParserRuleContext):

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

        def optList(self):
            return self.getTypedRuleContext(SygusParser.OptListContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_setOptsCmd

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

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

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




    def setOptsCmd(self):

        localctx = SygusParser.SetOptsCmdContext(self, self._ctx, self.state)
        self.enterRule(localctx, 36, self.RULE_setOptsCmd)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 204
            self.match(SygusParser.T__0)
            self.state = 205
            self.match(SygusParser.T__14)
            self.state = 206
            self.optList()
            self.state = 207
            self.match(SygusParser.T__2)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class OptListContext(ParserRuleContext):

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

        def symbolPairPlus(self):
            return self.getTypedRuleContext(SygusParser.SymbolPairPlusContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_optList

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

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

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




    def optList(self):

        localctx = SygusParser.OptListContext(self, self._ctx, self.state)
        self.enterRule(localctx, 38, self.RULE_optList)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 209
            self.match(SygusParser.T__0)
            self.state = 210
            self.symbolPairPlus()
            self.state = 211
            self.match(SygusParser.T__2)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class SymbolPairPlusContext(ParserRuleContext):

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

        def symbolPair(self):
            return self.getTypedRuleContext(SygusParser.SymbolPairContext,0)


        def symbolPairPlusTail(self):
            return self.getTypedRuleContext(SygusParser.SymbolPairPlusTailContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_symbolPairPlus

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

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

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




    def symbolPairPlus(self):

        localctx = SygusParser.SymbolPairPlusContext(self, self._ctx, self.state)
        self.enterRule(localctx, 40, self.RULE_symbolPairPlus)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 213
            self.symbolPair()
            self.state = 214
            self.symbolPairPlusTail()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class SymbolPairPlusTailContext(ParserRuleContext):

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

        def symbolPair(self):
            return self.getTypedRuleContext(SygusParser.SymbolPairContext,0)


        def symbolPairPlusTail(self):
            return self.getTypedRuleContext(SygusParser.SymbolPairPlusTailContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_symbolPairPlusTail

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

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

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




    def symbolPairPlusTail(self):

        localctx = SygusParser.SymbolPairPlusTailContext(self, self._ctx, self.state)
        self.enterRule(localctx, 42, self.RULE_symbolPairPlusTail)
        try:
            self.state = 220
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [SygusParser.T__0]:
                self.enterOuterAlt(localctx, 1)
                self.state = 216
                self.symbolPair()
                self.state = 217
                self.symbolPairPlusTail()
                pass
            elif token in [SygusParser.T__2]:
                self.enterOuterAlt(localctx, 2)

                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 SymbolPairContext(ParserRuleContext):

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

        def symbol(self):
            return self.getTypedRuleContext(SygusParser.SymbolContext,0)


        def QUOTEDLIT(self):
            return self.getToken(SygusParser.QUOTEDLIT, 0)

        def getRuleIndex(self):
            return SygusParser.RULE_symbolPair

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

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

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




    def symbolPair(self):

        localctx = SygusParser.SymbolPairContext(self, self._ctx, self.state)
        self.enterRule(localctx, 44, self.RULE_symbolPair)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 222
            self.match(SygusParser.T__0)
            self.state = 223
            self.symbol()
            self.state = 224
            self.match(SygusParser.QUOTEDLIT)
            self.state = 225
            self.match(SygusParser.T__2)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class FunDefCmdContext(ParserRuleContext):

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

        def symbol(self):
            return self.getTypedRuleContext(SygusParser.SymbolContext,0)


        def argList(self):
            return self.getTypedRuleContext(SygusParser.ArgListContext,0)


        def sortExpr(self):
            return self.getTypedRuleContext(SygusParser.SortExprContext,0)


        def term(self):
            return self.getTypedRuleContext(SygusParser.TermContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_funDefCmd

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

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

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




    def funDefCmd(self):

        localctx = SygusParser.FunDefCmdContext(self, self._ctx, self.state)
        self.enterRule(localctx, 46, self.RULE_funDefCmd)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 227
            self.match(SygusParser.T__0)
            self.state = 228
            self.match(SygusParser.T__15)
            self.state = 229
            self.symbol()
            self.state = 230
            self.argList()
            self.state = 231
            self.sortExpr()
            self.state = 232
            self.term()
            self.state = 233
            self.match(SygusParser.T__2)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class FunDeclCmdContext(ParserRuleContext):

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

        def symbol(self):
            return self.getTypedRuleContext(SygusParser.SymbolContext,0)


        def sortStar(self):
            return self.getTypedRuleContext(SygusParser.SortStarContext,0)


        def sortExpr(self):
            return self.getTypedRuleContext(SygusParser.SortExprContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_funDeclCmd

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

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

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




    def funDeclCmd(self):

        localctx = SygusParser.FunDeclCmdContext(self, self._ctx, self.state)
        self.enterRule(localctx, 48, self.RULE_funDeclCmd)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 235
            self.match(SygusParser.T__0)
            self.state = 236
            self.match(SygusParser.T__16)
            self.state = 237
            self.symbol()
            self.state = 238
            self.match(SygusParser.T__0)
            self.state = 239
            self.sortStar()
            self.state = 240
            self.match(SygusParser.T__2)
            self.state = 241
            self.sortExpr()
            self.state = 242
            self.match(SygusParser.T__2)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class SortStarContext(ParserRuleContext):

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

        def sortExpr(self):
            return self.getTypedRuleContext(SygusParser.SortExprContext,0)


        def sortStar(self):
            return self.getTypedRuleContext(SygusParser.SortStarContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_sortStar

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

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

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




    def sortStar(self):

        localctx = SygusParser.SortStarContext(self, self._ctx, self.state)
        self.enterRule(localctx, 50, self.RULE_sortStar)
        try:
            self.state = 248
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [SygusParser.T__0, SygusParser.T__6, SygusParser.T__7, SygusParser.T__8, SygusParser.SYMBOL]:
                self.enterOuterAlt(localctx, 1)
                self.state = 244
                self.sortExpr()
                self.state = 245
                self.sortStar()
                pass
            elif token in [SygusParser.T__2]:
                self.enterOuterAlt(localctx, 2)

                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 ArgListContext(ParserRuleContext):

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

        def symbolSortPairStar(self):
            return self.getTypedRuleContext(SygusParser.SymbolSortPairStarContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_argList

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

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

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




    def argList(self):

        localctx = SygusParser.ArgListContext(self, self._ctx, self.state)
        self.enterRule(localctx, 52, self.RULE_argList)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 250
            self.match(SygusParser.T__0)
            self.state = 251
            self.symbolSortPairStar()
            self.state = 252
            self.match(SygusParser.T__2)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class SymbolSortPairStarContext(ParserRuleContext):

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

        def symbolSortPair(self):
            return self.getTypedRuleContext(SygusParser.SymbolSortPairContext,0)


        def symbolSortPairStar(self):
            return self.getTypedRuleContext(SygusParser.SymbolSortPairStarContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_symbolSortPairStar

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

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

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




    def symbolSortPairStar(self):

        localctx = SygusParser.SymbolSortPairStarContext(self, self._ctx, self.state)
        self.enterRule(localctx, 54, self.RULE_symbolSortPairStar)
        try:
            self.state = 258
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [SygusParser.T__0]:
                self.enterOuterAlt(localctx, 1)
                self.state = 254
                self.symbolSortPair()
                self.state = 255
                self.symbolSortPairStar()
                pass
            elif token in [SygusParser.T__2]:
                self.enterOuterAlt(localctx, 2)

                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 SymbolSortPairContext(ParserRuleContext):

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

        def symbol(self):
            return self.getTypedRuleContext(SygusParser.SymbolContext,0)


        def sortExpr(self):
            return self.getTypedRuleContext(SygusParser.SortExprContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_symbolSortPair

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

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

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




    def symbolSortPair(self):

        localctx = SygusParser.SymbolSortPairContext(self, self._ctx, self.state)
        self.enterRule(localctx, 56, self.RULE_symbolSortPair)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 260
            self.match(SygusParser.T__0)
            self.state = 261
            self.symbol()
            self.state = 262
            self.sortExpr()
            self.state = 263
            self.match(SygusParser.T__2)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class TermContext(ParserRuleContext):

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

        def symbol(self):
            return self.getTypedRuleContext(SygusParser.SymbolContext,0)


        def termStar(self):
            return self.getTypedRuleContext(SygusParser.TermStarContext,0)


        def literal(self):
            return self.getTypedRuleContext(SygusParser.LiteralContext,0)


        def letTerm(self):
            return self.getTypedRuleContext(SygusParser.LetTermContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_term

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

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

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




    def term(self):

        localctx = SygusParser.TermContext(self, self._ctx, self.state)
        self.enterRule(localctx, 58, self.RULE_term)
        try:
            self.state = 273
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,9,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 265
                self.match(SygusParser.T__0)
                self.state = 266
                self.symbol()
                self.state = 267
                self.termStar()
                self.state = 268
                self.match(SygusParser.T__2)
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 270
                self.literal()
                pass

            elif la_ == 3:
                self.enterOuterAlt(localctx, 3)
                self.state = 271
                self.symbol()
                pass

            elif la_ == 4:
                self.enterOuterAlt(localctx, 4)
                self.state = 272
                self.letTerm()
                pass


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

    class LetTermContext(ParserRuleContext):

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

        def letBindingTermPlus(self):
            return self.getTypedRuleContext(SygusParser.LetBindingTermPlusContext,0)


        def term(self):
            return self.getTypedRuleContext(SygusParser.TermContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_letTerm

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

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

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




    def letTerm(self):

        localctx = SygusParser.LetTermContext(self, self._ctx, self.state)
        self.enterRule(localctx, 60, self.RULE_letTerm)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 275
            self.match(SygusParser.T__0)
            self.state = 276
            self.match(SygusParser.T__17)
            self.state = 277
            self.match(SygusParser.T__0)
            self.state = 278
            self.letBindingTermPlus()
            self.state = 279
            self.match(SygusParser.T__2)
            self.state = 280
            self.term()
            self.state = 281
            self.match(SygusParser.T__2)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class LetBindingTermPlusContext(ParserRuleContext):

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

        def letBindingTerm(self):
            return self.getTypedRuleContext(SygusParser.LetBindingTermContext,0)


        def letBindingTermPlusTail(self):
            return self.getTypedRuleContext(SygusParser.LetBindingTermPlusTailContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_letBindingTermPlus

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

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

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




    def letBindingTermPlus(self):

        localctx = SygusParser.LetBindingTermPlusContext(self, self._ctx, self.state)
        self.enterRule(localctx, 62, self.RULE_letBindingTermPlus)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 283
            self.letBindingTerm()
            self.state = 284
            self.letBindingTermPlusTail()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class LetBindingTermPlusTailContext(ParserRuleContext):

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

        def letBindingTerm(self):
            return self.getTypedRuleContext(SygusParser.LetBindingTermContext,0)


        def letBindingTermPlusTail(self):
            return self.getTypedRuleContext(SygusParser.LetBindingTermPlusTailContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_letBindingTermPlusTail

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

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

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




    def letBindingTermPlusTail(self):

        localctx = SygusParser.LetBindingTermPlusTailContext(self, self._ctx, self.state)
        self.enterRule(localctx, 64, self.RULE_letBindingTermPlusTail)
        try:
            self.state = 290
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [SygusParser.T__0]:
                self.enterOuterAlt(localctx, 1)
                self.state = 286
                self.letBindingTerm()
                self.state = 287
                self.letBindingTermPlusTail()
                pass
            elif token in [SygusParser.T__2]:
                self.enterOuterAlt(localctx, 2)

                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 LetBindingTermContext(ParserRuleContext):

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

        def symbol(self):
            return self.getTypedRuleContext(SygusParser.SymbolContext,0)


        def sortExpr(self):
            return self.getTypedRuleContext(SygusParser.SortExprContext,0)


        def term(self):
            return self.getTypedRuleContext(SygusParser.TermContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_letBindingTerm

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

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

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




    def letBindingTerm(self):

        localctx = SygusParser.LetBindingTermContext(self, self._ctx, self.state)
        self.enterRule(localctx, 66, self.RULE_letBindingTerm)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 292
            self.match(SygusParser.T__0)
            self.state = 293
            self.symbol()
            self.state = 294
            self.sortExpr()
            self.state = 295
            self.term()
            self.state = 296
            self.match(SygusParser.T__2)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class TermStarContext(ParserRuleContext):

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

        def term(self):
            return self.getTypedRuleContext(SygusParser.TermContext,0)


        def termStar(self):
            return self.getTypedRuleContext(SygusParser.TermStarContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_termStar

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

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

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




    def termStar(self):

        localctx = SygusParser.TermStarContext(self, self._ctx, self.state)
        self.enterRule(localctx, 68, self.RULE_termStar)
        try:
            self.state = 302
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [SygusParser.T__0, SygusParser.T__11, SygusParser.T__12, SygusParser.INTEGER, SygusParser.BVCONST, SygusParser.REALCONST, SygusParser.SYMBOL]:
                self.enterOuterAlt(localctx, 1)
                self.state = 298
                self.term()
                self.state = 299
                self.termStar()
                pass
            elif token in [SygusParser.T__2]:
                self.enterOuterAlt(localctx, 2)

                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 LiteralContext(ParserRuleContext):

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

        def intConst(self):
            return self.getTypedRuleContext(SygusParser.IntConstContext,0)


        def boolConst(self):
            return self.getTypedRuleContext(SygusParser.BoolConstContext,0)


        def bVConst(self):
            return self.getTypedRuleContext(SygusParser.BVConstContext,0)


        def enumConst(self):
            return self.getTypedRuleContext(SygusParser.EnumConstContext,0)


        def realConst(self):
            return self.getTypedRuleContext(SygusParser.RealConstContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_literal

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

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

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




    def literal(self):

        localctx = SygusParser.LiteralContext(self, self._ctx, self.state)
        self.enterRule(localctx, 70, self.RULE_literal)
        try:
            self.state = 309
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [SygusParser.INTEGER]:
                self.enterOuterAlt(localctx, 1)
                self.state = 304
                self.intConst()
                pass
            elif token in [SygusParser.T__11, SygusParser.T__12]:
                self.enterOuterAlt(localctx, 2)
                self.state = 305
                self.boolConst()
                pass
            elif token in [SygusParser.BVCONST]:
                self.enterOuterAlt(localctx, 3)
                self.state = 306
                self.bVConst()
                pass
            elif token in [SygusParser.SYMBOL]:
                self.enterOuterAlt(localctx, 4)
                self.state = 307
                self.enumConst()
                pass
            elif token in [SygusParser.REALCONST]:
                self.enterOuterAlt(localctx, 5)
                self.state = 308
                self.realConst()
                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 NTDefPlusContext(ParserRuleContext):

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

        def nTDef(self):
            return self.getTypedRuleContext(SygusParser.NTDefContext,0)


        def nTDefPlusTail(self):
            return self.getTypedRuleContext(SygusParser.NTDefPlusTailContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_nTDefPlus

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

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

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




    def nTDefPlus(self):

        localctx = SygusParser.NTDefPlusContext(self, self._ctx, self.state)
        self.enterRule(localctx, 72, self.RULE_nTDefPlus)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 311
            self.nTDef()
            self.state = 312
            self.nTDefPlusTail()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class NTDefPlusTailContext(ParserRuleContext):

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

        def nTDef(self):
            return self.getTypedRuleContext(SygusParser.NTDefContext,0)


        def nTDefPlusTail(self):
            return self.getTypedRuleContext(SygusParser.NTDefPlusTailContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_nTDefPlusTail

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

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

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




    def nTDefPlusTail(self):

        localctx = SygusParser.NTDefPlusTailContext(self, self._ctx, self.state)
        self.enterRule(localctx, 74, self.RULE_nTDefPlusTail)
        try:
            self.state = 318
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [SygusParser.T__0]:
                self.enterOuterAlt(localctx, 1)
                self.state = 314
                self.nTDef()
                self.state = 315
                self.nTDefPlusTail()
                pass
            elif token in [SygusParser.T__2]:
                self.enterOuterAlt(localctx, 2)

                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 NTDefContext(ParserRuleContext):

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

        def symbol(self):
            return self.getTypedRuleContext(SygusParser.SymbolContext,0)


        def sortExpr(self):
            return self.getTypedRuleContext(SygusParser.SortExprContext,0)


        def gTermPlus(self):
            return self.getTypedRuleContext(SygusParser.GTermPlusContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_nTDef

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

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

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




    def nTDef(self):

        localctx = SygusParser.NTDefContext(self, self._ctx, self.state)
        self.enterRule(localctx, 76, self.RULE_nTDef)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 320
            self.match(SygusParser.T__0)
            self.state = 321
            self.symbol()
            self.state = 322
            self.sortExpr()
            self.state = 323
            self.match(SygusParser.T__0)
            self.state = 324
            self.gTermPlus()
            self.state = 325
            self.match(SygusParser.T__2)
            self.state = 326
            self.match(SygusParser.T__2)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class GTermPlusContext(ParserRuleContext):

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

        def gTerm(self):
            return self.getTypedRuleContext(SygusParser.GTermContext,0)


        def gTermPlusTail(self):
            return self.getTypedRuleContext(SygusParser.GTermPlusTailContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_gTermPlus

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

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

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




    def gTermPlus(self):

        localctx = SygusParser.GTermPlusContext(self, self._ctx, self.state)
        self.enterRule(localctx, 78, self.RULE_gTermPlus)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 328
            self.gTerm()
            self.state = 329
            self.gTermPlusTail()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class GTermPlusTailContext(ParserRuleContext):

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

        def gTerm(self):
            return self.getTypedRuleContext(SygusParser.GTermContext,0)


        def gTermPlusTail(self):
            return self.getTypedRuleContext(SygusParser.GTermPlusTailContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_gTermPlusTail

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

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

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




    def gTermPlusTail(self):

        localctx = SygusParser.GTermPlusTailContext(self, self._ctx, self.state)
        self.enterRule(localctx, 80, self.RULE_gTermPlusTail)
        try:
            self.state = 335
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [SygusParser.T__0, SygusParser.T__11, SygusParser.T__12, SygusParser.INTEGER, SygusParser.BVCONST, SygusParser.REALCONST, SygusParser.SYMBOL]:
                self.enterOuterAlt(localctx, 1)
                self.state = 331
                self.gTerm()
                self.state = 332
                self.gTermPlusTail()
                pass
            elif token in [SygusParser.T__2]:
                self.enterOuterAlt(localctx, 2)

                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 CheckSynthCmdContext(ParserRuleContext):

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


        def getRuleIndex(self):
            return SygusParser.RULE_checkSynthCmd

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

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

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




    def checkSynthCmd(self):

        localctx = SygusParser.CheckSynthCmdContext(self, self._ctx, self.state)
        self.enterRule(localctx, 82, self.RULE_checkSynthCmd)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 337
            self.match(SygusParser.T__0)
            self.state = 338
            self.match(SygusParser.T__18)
            self.state = 339
            self.match(SygusParser.T__2)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class ConstraintCmdContext(ParserRuleContext):

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

        def term(self):
            return self.getTypedRuleContext(SygusParser.TermContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_constraintCmd

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

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

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




    def constraintCmd(self):

        localctx = SygusParser.ConstraintCmdContext(self, self._ctx, self.state)
        self.enterRule(localctx, 84, self.RULE_constraintCmd)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 341
            self.match(SygusParser.T__0)
            self.state = 342
            self.match(SygusParser.T__19)
            self.state = 343
            self.term()
            self.state = 344
            self.match(SygusParser.T__2)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class SynthFunCmdContext(ParserRuleContext):

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

        def symbol(self):
            return self.getTypedRuleContext(SygusParser.SymbolContext,0)


        def argList(self):
            return self.getTypedRuleContext(SygusParser.ArgListContext,0)


        def sortExpr(self):
            return self.getTypedRuleContext(SygusParser.SortExprContext,0)


        def nTDefPlus(self):
            return self.getTypedRuleContext(SygusParser.NTDefPlusContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_synthFunCmd

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

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

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




    def synthFunCmd(self):

        localctx = SygusParser.SynthFunCmdContext(self, self._ctx, self.state)
        self.enterRule(localctx, 86, self.RULE_synthFunCmd)
        try:
            self.state = 363
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,15,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 346
                self.match(SygusParser.T__0)
                self.state = 347
                self.match(SygusParser.T__20)
                self.state = 348
                self.symbol()
                self.state = 349
                self.argList()
                self.state = 350
                self.sortExpr()
                self.state = 351
                self.match(SygusParser.T__0)
                self.state = 352
                self.nTDefPlus()
                self.state = 353
                self.match(SygusParser.T__2)
                self.state = 354
                self.match(SygusParser.T__2)
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 356
                self.match(SygusParser.T__0)
                self.state = 357
                self.match(SygusParser.T__20)
                self.state = 358
                self.symbol()
                self.state = 359
                self.argList()
                self.state = 360
                self.sortExpr()
                self.state = 361
                self.match(SygusParser.T__2)
                pass


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

    class GTermContext(ParserRuleContext):

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

        def symbol(self):
            return self.getTypedRuleContext(SygusParser.SymbolContext,0)


        def literal(self):
            return self.getTypedRuleContext(SygusParser.LiteralContext,0)


        def gTermStar(self):
            return self.getTypedRuleContext(SygusParser.GTermStarContext,0)


        def sortExpr(self):
            return self.getTypedRuleContext(SygusParser.SortExprContext,0)


        def letGTerm(self):
            return self.getTypedRuleContext(SygusParser.LetGTermContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_gTerm

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

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

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




    def gTerm(self):

        localctx = SygusParser.GTermContext(self, self._ctx, self.state)
        self.enterRule(localctx, 88, self.RULE_gTerm)
        try:
            self.state = 393
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,16,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 365
                self.symbol()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 366
                self.literal()
                pass

            elif la_ == 3:
                self.enterOuterAlt(localctx, 3)
                self.state = 367
                self.match(SygusParser.T__0)
                self.state = 368
                self.symbol()
                self.state = 369
                self.gTermStar()
                self.state = 370
                self.match(SygusParser.T__2)
                pass

            elif la_ == 4:
                self.enterOuterAlt(localctx, 4)
                self.state = 372
                self.match(SygusParser.T__0)
                self.state = 373
                self.match(SygusParser.T__21)
                self.state = 374
                self.sortExpr()
                self.state = 375
                self.match(SygusParser.T__2)
                pass

            elif la_ == 5:
                self.enterOuterAlt(localctx, 5)
                self.state = 377
                self.match(SygusParser.T__0)
                self.state = 378
                self.match(SygusParser.T__22)
                self.state = 379
                self.sortExpr()
                self.state = 380
                self.match(SygusParser.T__2)
                pass

            elif la_ == 6:
                self.enterOuterAlt(localctx, 6)
                self.state = 382
                self.match(SygusParser.T__0)
                self.state = 383
                self.match(SygusParser.T__23)
                self.state = 384
                self.sortExpr()
                self.state = 385
                self.match(SygusParser.T__2)
                pass

            elif la_ == 7:
                self.enterOuterAlt(localctx, 7)
                self.state = 387
                self.match(SygusParser.T__0)
                self.state = 388
                self.match(SygusParser.T__24)
                self.state = 389
                self.sortExpr()
                self.state = 390
                self.match(SygusParser.T__2)
                pass

            elif la_ == 8:
                self.enterOuterAlt(localctx, 8)
                self.state = 392
                self.letGTerm()
                pass


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

    class LetGTermContext(ParserRuleContext):

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

        def letBindingGTermPlus(self):
            return self.getTypedRuleContext(SygusParser.LetBindingGTermPlusContext,0)


        def gTerm(self):
            return self.getTypedRuleContext(SygusParser.GTermContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_letGTerm

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

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

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




    def letGTerm(self):

        localctx = SygusParser.LetGTermContext(self, self._ctx, self.state)
        self.enterRule(localctx, 90, self.RULE_letGTerm)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 395
            self.match(SygusParser.T__0)
            self.state = 396
            self.match(SygusParser.T__17)
            self.state = 397
            self.match(SygusParser.T__0)
            self.state = 398
            self.letBindingGTermPlus()
            self.state = 399
            self.match(SygusParser.T__2)
            self.state = 400
            self.gTerm()
            self.state = 401
            self.match(SygusParser.T__2)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class LetBindingGTermPlusContext(ParserRuleContext):

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

        def letBindingGTerm(self):
            return self.getTypedRuleContext(SygusParser.LetBindingGTermContext,0)


        def letBindingGTermPlusTail(self):
            return self.getTypedRuleContext(SygusParser.LetBindingGTermPlusTailContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_letBindingGTermPlus

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

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

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




    def letBindingGTermPlus(self):

        localctx = SygusParser.LetBindingGTermPlusContext(self, self._ctx, self.state)
        self.enterRule(localctx, 92, self.RULE_letBindingGTermPlus)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 403
            self.letBindingGTerm()
            self.state = 404
            self.letBindingGTermPlusTail()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class LetBindingGTermPlusTailContext(ParserRuleContext):

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

        def letBindingGTerm(self):
            return self.getTypedRuleContext(SygusParser.LetBindingGTermContext,0)


        def letBindingGTermPlusTail(self):
            return self.getTypedRuleContext(SygusParser.LetBindingGTermPlusTailContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_letBindingGTermPlusTail

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

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

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




    def letBindingGTermPlusTail(self):

        localctx = SygusParser.LetBindingGTermPlusTailContext(self, self._ctx, self.state)
        self.enterRule(localctx, 94, self.RULE_letBindingGTermPlusTail)
        try:
            self.state = 410
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [SygusParser.T__0]:
                self.enterOuterAlt(localctx, 1)
                self.state = 406
                self.letBindingGTerm()
                self.state = 407
                self.letBindingGTermPlusTail()
                pass
            elif token in [SygusParser.T__2]:
                self.enterOuterAlt(localctx, 2)

                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 LetBindingGTermContext(ParserRuleContext):

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

        def symbol(self):
            return self.getTypedRuleContext(SygusParser.SymbolContext,0)


        def sortExpr(self):
            return self.getTypedRuleContext(SygusParser.SortExprContext,0)


        def gTerm(self):
            return self.getTypedRuleContext(SygusParser.GTermContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_letBindingGTerm

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

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

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




    def letBindingGTerm(self):

        localctx = SygusParser.LetBindingGTermContext(self, self._ctx, self.state)
        self.enterRule(localctx, 96, self.RULE_letBindingGTerm)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 412
            self.match(SygusParser.T__0)
            self.state = 413
            self.symbol()
            self.state = 414
            self.sortExpr()
            self.state = 415
            self.gTerm()
            self.state = 416
            self.match(SygusParser.T__2)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class GTermStarContext(ParserRuleContext):

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

        def gTerm(self):
            return self.getTypedRuleContext(SygusParser.GTermContext,0)


        def gTermStar(self):
            return self.getTypedRuleContext(SygusParser.GTermStarContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_gTermStar

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

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

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




    def gTermStar(self):

        localctx = SygusParser.GTermStarContext(self, self._ctx, self.state)
        self.enterRule(localctx, 98, self.RULE_gTermStar)
        try:
            self.state = 422
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [SygusParser.T__0, SygusParser.T__11, SygusParser.T__12, SygusParser.INTEGER, SygusParser.BVCONST, SygusParser.REALCONST, SygusParser.SYMBOL]:
                self.enterOuterAlt(localctx, 1)
                self.state = 418
                self.gTerm()
                self.state = 419
                self.gTermStar()
                pass
            elif token in [SygusParser.T__2]:
                self.enterOuterAlt(localctx, 2)

                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 SynthInvCmdContext(ParserRuleContext):

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

        def symbol(self):
            return self.getTypedRuleContext(SygusParser.SymbolContext,0)


        def argList(self):
            return self.getTypedRuleContext(SygusParser.ArgListContext,0)


        def nTDefPlus(self):
            return self.getTypedRuleContext(SygusParser.NTDefPlusContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_synthInvCmd

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

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

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




    def synthInvCmd(self):

        localctx = SygusParser.SynthInvCmdContext(self, self._ctx, self.state)
        self.enterRule(localctx, 100, self.RULE_synthInvCmd)
        try:
            self.state = 439
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,19,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 424
                self.match(SygusParser.T__0)
                self.state = 425
                self.match(SygusParser.T__25)
                self.state = 426
                self.symbol()
                self.state = 427
                self.argList()
                self.state = 428
                self.match(SygusParser.T__0)
                self.state = 429
                self.nTDefPlus()
                self.state = 430
                self.match(SygusParser.T__2)
                self.state = 431
                self.match(SygusParser.T__2)
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 433
                self.match(SygusParser.T__0)
                self.state = 434
                self.match(SygusParser.T__25)
                self.state = 435
                self.symbol()
                self.state = 436
                self.argList()
                self.state = 437
                self.match(SygusParser.T__2)
                pass


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

    class DeclarePrimedVarContext(ParserRuleContext):

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

        def symbol(self):
            return self.getTypedRuleContext(SygusParser.SymbolContext,0)


        def sortExpr(self):
            return self.getTypedRuleContext(SygusParser.SortExprContext,0)


        def getRuleIndex(self):
            return SygusParser.RULE_declarePrimedVar

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

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

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




    def declarePrimedVar(self):

        localctx = SygusParser.DeclarePrimedVarContext(self, self._ctx, self.state)
        self.enterRule(localctx, 102, self.RULE_declarePrimedVar)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 441
            self.match(SygusParser.T__0)
            self.state = 442
            self.match(SygusParser.T__26)
            self.state = 443
            self.symbol()
            self.state = 444
            self.sortExpr()
            self.state = 445
            self.match(SygusParser.T__2)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class InvConstraintCmdContext(ParserRuleContext):

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

        def symbol(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(SygusParser.SymbolContext)
            else:
                return self.getTypedRuleContext(SygusParser.SymbolContext,i)


        def getRuleIndex(self):
            return SygusParser.RULE_invConstraintCmd

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

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

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




    def invConstraintCmd(self):

        localctx = SygusParser.InvConstraintCmdContext(self, self._ctx, self.state)
        self.enterRule(localctx, 104, self.RULE_invConstraintCmd)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 447
            self.match(SygusParser.T__0)
            self.state = 448
            self.match(SygusParser.T__27)
            self.state = 449
            self.symbol()
            self.state = 450
            self.symbol()
            self.state = 451
            self.symbol()
            self.state = 452
            self.symbol()
            self.state = 453
            self.match(SygusParser.T__2)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx
# Generated from Sygus.g4 by ANTLR 4.7.1 # encoding: utf-8 #\t#\4$\t$\4%\t%\4&\t") #\3#\3#\3#\3#\3#\3$\3$\3$\3$\5$\u0131\n") #\2\2\u00c0\37\3\2\2\2\u00c1\u00c2\7\3\2\2\u00c2\u00c3") #\3\2\2\2\u00c8\u00c9") #\2\u011e\u011f\5") #\2\u0121\u0122\5B") # Token type