
# encoding: utf-8

# *** GENERATED BY `setup.py antlr`, DO NOT EDIT BY HAND ***
#
# Generated from ../LaTeX.g4, derived from latex2sympy
#     latex2sympy is licensed under the MIT license
#     https://github.com/augustt198/latex2sympy/blob/master/LICENSE.txt
#
# Generated with antlr4
#    antlr4 is licensed under the BSD-3-Clause License
#    https://github.com/antlr/antlr4/blob/master/LICENSE.txt
from __future__ import print_function
from antlr4 import *
from io import StringIO
import sys


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


class LaTeXParser ( Parser ):

    grammarFileName = "LaTeX.g4"

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

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

    sharedContextCache = PredictionContextCache()

    literalNames = [ u"<INVALID>", u"','", u"<INVALID>", u"<INVALID>", u"<INVALID>",
                     u"<INVALID>", u"'\\quad'", u"'\\qquad'", u"<INVALID>",
                     u"'\\negmedspace'", u"'\\negthickspace'", u"'\\left'",
                     u"'\\right'", u"<INVALID>", u"'+'", u"'-'", u"'*'",
                     u"'/'", u"'('", u"')'", u"'{'", u"'}'", u"'\\{'", u"'\\}'",
                     u"'['", u"']'", u"'|'", u"'\\right|'", u"'\\left|'",
                     u"'\\langle'", u"'\\rangle'", u"'\\lim'", u"<INVALID>",
                     u"'\\int'", u"'\\sum'", u"'\\prod'", u"'\\exp'", u"'\\log'",
                     u"'\\ln'", u"'\\sin'", u"'\\cos'", u"'\\tan'", u"'\\csc'",
                     u"'\\sec'", u"'\\cot'", u"'\\arcsin'", u"'\\arccos'",
                     u"'\\arctan'", u"'\\arccsc'", u"'\\arcsec'", u"'\\arccot'",
                     u"'\\sinh'", u"'\\cosh'", u"'\\tanh'", u"'\\arsinh'",
                     u"'\\arcosh'", u"'\\artanh'", u"'\\lfloor'", u"'\\rfloor'",
                     u"'\\lceil'", u"'\\rceil'", u"'\\sqrt'", u"'\\overline'",
                     u"'\\times'", u"'\\cdot'", u"'\\div'", u"'\\frac'",
                     u"'\\binom'", u"'\\dbinom'", u"'\\tbinom'", u"'\\mathit'",
                     u"'_'", u"'^'", u"':'", u"<INVALID>", u"<INVALID>",
                     u"<INVALID>", u"<INVALID>", u"'\\neq'", u"'<'", u"<INVALID>",
                     u"'\\leqq'", u"'\\leqslant'", u"'>'", u"<INVALID>",
                     u"'\\geqq'", u"'\\geqslant'", u"'!'" ]

    symbolicNames = [ u"<INVALID>", u"<INVALID>", u"WS", u"THINSPACE", u"MEDSPACE",
                      u"THICKSPACE", u"QUAD", u"QQUAD", u"NEGTHINSPACE",
                      u"NEGMEDSPACE", u"NEGTHICKSPACE", u"CMD_LEFT", u"CMD_RIGHT",
                      u"IGNORE", u"ADD", u"SUB", u"MUL", u"DIV", u"L_PAREN",
                      u"R_PAREN", u"L_BRACE", u"R_BRACE", u"L_BRACE_LITERAL",
                      u"R_BRACE_LITERAL", u"L_BRACKET", u"R_BRACKET", u"BAR",
                      u"R_BAR", u"L_BAR", u"L_ANGLE", u"R_ANGLE", u"FUNC_LIM",
                      u"LIM_APPROACH_SYM", u"FUNC_INT", u"FUNC_SUM", u"FUNC_PROD",
                      u"FUNC_EXP", u"FUNC_LOG", u"FUNC_LN", u"FUNC_SIN",
                      u"FUNC_COS", u"FUNC_TAN", u"FUNC_CSC", u"FUNC_SEC",
                      u"FUNC_COT", u"FUNC_ARCSIN", u"FUNC_ARCCOS", u"FUNC_ARCTAN",
                      u"FUNC_ARCCSC", u"FUNC_ARCSEC", u"FUNC_ARCCOT", u"FUNC_SINH",
                      u"FUNC_COSH", u"FUNC_TANH", u"FUNC_ARSINH", u"FUNC_ARCOSH",
                      u"FUNC_ARTANH", u"L_FLOOR", u"R_FLOOR", u"L_CEIL",
                      u"R_CEIL", u"FUNC_SQRT", u"FUNC_OVERLINE", u"CMD_TIMES",
                      u"CMD_CDOT", u"CMD_DIV", u"CMD_FRAC", u"CMD_BINOM",
                      u"CMD_DBINOM", u"CMD_TBINOM", u"CMD_MATHIT", u"UNDERSCORE",
                      u"CARET", u"COLON", u"DIFFERENTIAL", u"LETTER", u"NUMBER",
                      u"EQUAL", u"NEQ", u"LT", u"LTE", u"LTE_Q", u"LTE_S",
                      u"GT", u"GTE", u"GTE_Q", u"GTE_S", u"BANG", u"SYMBOL" ]

    RULE_math = 0
    RULE_relation = 1
    RULE_equality = 2
    RULE_expr = 3
    RULE_additive = 4
    RULE_mp = 5
    RULE_mp_nofunc = 6
    RULE_unary = 7
    RULE_unary_nofunc = 8
    RULE_postfix = 9
    RULE_postfix_nofunc = 10
    RULE_postfix_op = 11
    RULE_eval_at = 12
    RULE_eval_at_sub = 13
    RULE_eval_at_sup = 14
    RULE_exp = 15
    RULE_exp_nofunc = 16
    RULE_comp = 17
    RULE_comp_nofunc = 18
    RULE_group = 19
    RULE_abs_group = 20
    RULE_atom = 21
    RULE_bra = 22
    RULE_ket = 23
    RULE_mathit = 24
    RULE_mathit_text = 25
    RULE_frac = 26
    RULE_binom = 27
    RULE_floor = 28
    RULE_ceil = 29
    RULE_func_normal = 30
    RULE_func = 31
    RULE_args = 32
    RULE_limit_sub = 33
    RULE_func_arg = 34
    RULE_func_arg_noparens = 35
    RULE_subexpr = 36
    RULE_supexpr = 37
    RULE_subeq = 38
    RULE_supeq = 39

    ruleNames =  [ u"math", u"relation", u"equality", u"expr", u"additive",
                   u"mp", u"mp_nofunc", u"unary", u"unary_nofunc", u"postfix",
                   u"postfix_nofunc", u"postfix_op", u"eval_at", u"eval_at_sub",
                   u"eval_at_sup", u"exp", u"exp_nofunc", u"comp", u"comp_nofunc",
                   u"group", u"abs_group", u"atom", u"bra", u"ket", u"mathit",
                   u"mathit_text", u"frac", u"binom", u"floor", u"ceil",
                   u"func_normal", u"func", u"args", u"limit_sub", u"func_arg",
                   u"func_arg_noparens", u"subexpr", u"supexpr", u"subeq",
                   u"supeq" ]

    EOF = Token.EOF
    T__0=1
    WS=2
    THINSPACE=3
    MEDSPACE=4
    THICKSPACE=5
    QUAD=6
    QQUAD=7
    NEGTHINSPACE=8
    NEGMEDSPACE=9
    NEGTHICKSPACE=10
    CMD_LEFT=11
    CMD_RIGHT=12
    IGNORE=13
    ADD=14
    SUB=15
    MUL=16
    DIV=17
    L_PAREN=18
    R_PAREN=19
    L_BRACE=20
    R_BRACE=21
    L_BRACE_LITERAL=22
    R_BRACE_LITERAL=23
    L_BRACKET=24
    R_BRACKET=25
    BAR=26
    R_BAR=27
    L_BAR=28
    L_ANGLE=29
    R_ANGLE=30
    FUNC_LIM=31
    LIM_APPROACH_SYM=32
    FUNC_INT=33
    FUNC_SUM=34
    FUNC_PROD=35
    FUNC_EXP=36
    FUNC_LOG=37
    FUNC_LN=38
    FUNC_SIN=39
    FUNC_COS=40
    FUNC_TAN=41
    FUNC_CSC=42
    FUNC_SEC=43
    FUNC_COT=44
    FUNC_ARCSIN=45
    FUNC_ARCCOS=46
    FUNC_ARCTAN=47
    FUNC_ARCCSC=48
    FUNC_ARCSEC=49
    FUNC_ARCCOT=50
    FUNC_SINH=51
    FUNC_COSH=52
    FUNC_TANH=53
    FUNC_ARSINH=54
    FUNC_ARCOSH=55
    FUNC_ARTANH=56
    L_FLOOR=57
    R_FLOOR=58
    L_CEIL=59
    R_CEIL=60
    FUNC_SQRT=61
    FUNC_OVERLINE=62
    CMD_TIMES=63
    CMD_CDOT=64
    CMD_DIV=65
    CMD_FRAC=66
    CMD_BINOM=67
    CMD_DBINOM=68
    CMD_TBINOM=69
    CMD_MATHIT=70
    UNDERSCORE=71
    CARET=72
    COLON=73
    DIFFERENTIAL=74
    LETTER=75
    NUMBER=76
    EQUAL=77
    NEQ=78
    LT=79
    LTE=80
    LTE_Q=81
    LTE_S=82
    GT=83
    GTE=84
    GTE_Q=85
    GTE_S=86
    BANG=87
    SYMBOL=88

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




    class MathContext(ParserRuleContext):

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

        def relation(self):
            return self.getTypedRuleContext(LaTeXParser.RelationContext,0)


        def getRuleIndex(self):
            return LaTeXParser.RULE_math




    def math(self):

        localctx = LaTeXParser.MathContext(self, self._ctx, self.state)
        self.enterRule(localctx, 0, self.RULE_math)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 80
            self.relation(0)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class RelationContext(ParserRuleContext):

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

        def expr(self):
            return self.getTypedRuleContext(LaTeXParser.ExprContext,0)


        def relation(self, i=None):
            if i is None:
                return self.getTypedRuleContexts(LaTeXParser.RelationContext)
            else:
                return self.getTypedRuleContext(LaTeXParser.RelationContext,i)


        def EQUAL(self):
            return self.getToken(LaTeXParser.EQUAL, 0)

        def LT(self):
            return self.getToken(LaTeXParser.LT, 0)

        def LTE(self):
            return self.getToken(LaTeXParser.LTE, 0)

        def GT(self):
            return self.getToken(LaTeXParser.GT, 0)

        def GTE(self):
            return self.getToken(LaTeXParser.GTE, 0)

        def NEQ(self):
            return self.getToken(LaTeXParser.NEQ, 0)

        def getRuleIndex(self):
            return LaTeXParser.RULE_relation



    def relation(self, _p=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = LaTeXParser.RelationContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 2
        self.enterRecursionRule(localctx, 2, self.RULE_relation, _p)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 83
            self.expr()
            self._ctx.stop = self._input.LT(-1)
            self.state = 90
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,0,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    localctx = LaTeXParser.RelationContext(self, _parentctx, _parentState)
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_relation)
                    self.state = 85
                    if not self.precpred(self._ctx, 2):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                    self.state = 86
                    _la = self._input.LA(1)
                    if not(((((_la - 77)) & ~0x3f) == 0 and ((1 << (_la - 77)) & ((1 << (LaTeXParser.EQUAL - 77)) | (1 << (LaTeXParser.NEQ - 77)) | (1 << (LaTeXParser.LT - 77)) | (1 << (LaTeXParser.LTE - 77)) | (1 << (LaTeXParser.GT - 77)) | (1 << (LaTeXParser.GTE - 77)))) != 0)):
                        self._errHandler.recoverInline(self)
                    else:
                        self._errHandler.reportMatch(self)
                        self.consume()
                    self.state = 87
                    self.relation(3)
                self.state = 92
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,0,self._ctx)

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


    class EqualityContext(ParserRuleContext):

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

        def expr(self, i=None):
            if i is None:
                return self.getTypedRuleContexts(LaTeXParser.ExprContext)
            else:
                return self.getTypedRuleContext(LaTeXParser.ExprContext,i)


        def EQUAL(self):
            return self.getToken(LaTeXParser.EQUAL, 0)

        def getRuleIndex(self):
            return LaTeXParser.RULE_equality




    def equality(self):

        localctx = LaTeXParser.EqualityContext(self, self._ctx, self.state)
        self.enterRule(localctx, 4, self.RULE_equality)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 93
            self.expr()
            self.state = 94
            self.match(LaTeXParser.EQUAL)
            self.state = 95
            self.expr()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ExprContext(ParserRuleContext):

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

        def additive(self):
            return self.getTypedRuleContext(LaTeXParser.AdditiveContext,0)


        def getRuleIndex(self):
            return LaTeXParser.RULE_expr




    def expr(self):

        localctx = LaTeXParser.ExprContext(self, self._ctx, self.state)
        self.enterRule(localctx, 6, self.RULE_expr)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 97
            self.additive(0)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class AdditiveContext(ParserRuleContext):

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

        def mp(self):
            return self.getTypedRuleContext(LaTeXParser.MpContext,0)


        def additive(self, i=None):
            if i is None:
                return self.getTypedRuleContexts(LaTeXParser.AdditiveContext)
            else:
                return self.getTypedRuleContext(LaTeXParser.AdditiveContext,i)


        def ADD(self):
            return self.getToken(LaTeXParser.ADD, 0)

        def SUB(self):
            return self.getToken(LaTeXParser.SUB, 0)

        def getRuleIndex(self):
            return LaTeXParser.RULE_additive



    def additive(self, _p=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = LaTeXParser.AdditiveContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 8
        self.enterRecursionRule(localctx, 8, self.RULE_additive, _p)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 100
            self.mp(0)
            self._ctx.stop = self._input.LT(-1)
            self.state = 107
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,1,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    localctx = LaTeXParser.AdditiveContext(self, _parentctx, _parentState)
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_additive)
                    self.state = 102
                    if not self.precpred(self._ctx, 2):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                    self.state = 103
                    _la = self._input.LA(1)
                    if not(_la==LaTeXParser.ADD or _la==LaTeXParser.SUB):
                        self._errHandler.recoverInline(self)
                    else:
                        self._errHandler.reportMatch(self)
                        self.consume()
                    self.state = 104
                    self.additive(3)
                self.state = 109
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,1,self._ctx)

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


    class MpContext(ParserRuleContext):

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

        def unary(self):
            return self.getTypedRuleContext(LaTeXParser.UnaryContext,0)


        def mp(self, i=None):
            if i is None:
                return self.getTypedRuleContexts(LaTeXParser.MpContext)
            else:
                return self.getTypedRuleContext(LaTeXParser.MpContext,i)


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

        def CMD_TIMES(self):
            return self.getToken(LaTeXParser.CMD_TIMES, 0)

        def CMD_CDOT(self):
            return self.getToken(LaTeXParser.CMD_CDOT, 0)

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

        def CMD_DIV(self):
            return self.getToken(LaTeXParser.CMD_DIV, 0)

        def COLON(self):
            return self.getToken(LaTeXParser.COLON, 0)

        def getRuleIndex(self):
            return LaTeXParser.RULE_mp



    def mp(self, _p=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = LaTeXParser.MpContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 10
        self.enterRecursionRule(localctx, 10, self.RULE_mp, _p)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 111
            self.unary()
            self._ctx.stop = self._input.LT(-1)
            self.state = 118
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,2,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    localctx = LaTeXParser.MpContext(self, _parentctx, _parentState)
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_mp)
                    self.state = 113
                    if not self.precpred(self._ctx, 2):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                    self.state = 114
                    _la = self._input.LA(1)
                    if not(((((_la - 16)) & ~0x3f) == 0 and ((1 << (_la - 16)) & ((1 << (LaTeXParser.MUL - 16)) | (1 << (LaTeXParser.DIV - 16)) | (1 << (LaTeXParser.CMD_TIMES - 16)) | (1 << (LaTeXParser.CMD_CDOT - 16)) | (1 << (LaTeXParser.CMD_DIV - 16)) | (1 << (LaTeXParser.COLON - 16)))) != 0)):
                        self._errHandler.recoverInline(self)
                    else:
                        self._errHandler.reportMatch(self)
                        self.consume()
                    self.state = 115
                    self.mp(3)
                self.state = 120
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,2,self._ctx)

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


    class Mp_nofuncContext(ParserRuleContext):

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

        def unary_nofunc(self):
            return self.getTypedRuleContext(LaTeXParser.Unary_nofuncContext,0)


        def mp_nofunc(self, i=None):
            if i is None:
                return self.getTypedRuleContexts(LaTeXParser.Mp_nofuncContext)
            else:
                return self.getTypedRuleContext(LaTeXParser.Mp_nofuncContext,i)


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

        def CMD_TIMES(self):
            return self.getToken(LaTeXParser.CMD_TIMES, 0)

        def CMD_CDOT(self):
            return self.getToken(LaTeXParser.CMD_CDOT, 0)

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

        def CMD_DIV(self):
            return self.getToken(LaTeXParser.CMD_DIV, 0)

        def COLON(self):
            return self.getToken(LaTeXParser.COLON, 0)

        def getRuleIndex(self):
            return LaTeXParser.RULE_mp_nofunc



    def mp_nofunc(self, _p=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = LaTeXParser.Mp_nofuncContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 12
        self.enterRecursionRule(localctx, 12, self.RULE_mp_nofunc, _p)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 122
            self.unary_nofunc()
            self._ctx.stop = self._input.LT(-1)
            self.state = 129
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,3,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    localctx = LaTeXParser.Mp_nofuncContext(self, _parentctx, _parentState)
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_mp_nofunc)
                    self.state = 124
                    if not self.precpred(self._ctx, 2):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                    self.state = 125
                    _la = self._input.LA(1)
                    if not(((((_la - 16)) & ~0x3f) == 0 and ((1 << (_la - 16)) & ((1 << (LaTeXParser.MUL - 16)) | (1 << (LaTeXParser.DIV - 16)) | (1 << (LaTeXParser.CMD_TIMES - 16)) | (1 << (LaTeXParser.CMD_CDOT - 16)) | (1 << (LaTeXParser.CMD_DIV - 16)) | (1 << (LaTeXParser.COLON - 16)))) != 0)):
                        self._errHandler.recoverInline(self)
                    else:
                        self._errHandler.reportMatch(self)
                        self.consume()
                    self.state = 126
                    self.mp_nofunc(3)
                self.state = 131
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,3,self._ctx)

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


    class UnaryContext(ParserRuleContext):

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

        def unary(self):
            return self.getTypedRuleContext(LaTeXParser.UnaryContext,0)


        def ADD(self):
            return self.getToken(LaTeXParser.ADD, 0)

        def SUB(self):
            return self.getToken(LaTeXParser.SUB, 0)

        def postfix(self, i=None):
            if i is None:
                return self.getTypedRuleContexts(LaTeXParser.PostfixContext)
            else:
                return self.getTypedRuleContext(LaTeXParser.PostfixContext,i)


        def getRuleIndex(self):
            return LaTeXParser.RULE_unary




    def unary(self):

        localctx = LaTeXParser.UnaryContext(self, self._ctx, self.state)
        self.enterRule(localctx, 14, self.RULE_unary)
        self._la = 0 # Token type
        try:
            self.state = 139
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [LaTeXParser.ADD, LaTeXParser.SUB]:
                self.enterOuterAlt(localctx, 1)
                self.state = 132
                _la = self._input.LA(1)
                if not(_la==LaTeXParser.ADD or _la==LaTeXParser.SUB):
                    self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 133
                self.unary()
                pass
            elif token in [LaTeXParser.L_PAREN, LaTeXParser.L_BRACE, LaTeXParser.L_BRACE_LITERAL, LaTeXParser.L_BRACKET, LaTeXParser.BAR, LaTeXParser.L_BAR, LaTeXParser.L_ANGLE, LaTeXParser.FUNC_LIM, LaTeXParser.FUNC_INT, LaTeXParser.FUNC_SUM, LaTeXParser.FUNC_PROD, LaTeXParser.FUNC_EXP, LaTeXParser.FUNC_LOG, LaTeXParser.FUNC_LN, LaTeXParser.FUNC_SIN, LaTeXParser.FUNC_COS, LaTeXParser.FUNC_TAN, LaTeXParser.FUNC_CSC, LaTeXParser.FUNC_SEC, LaTeXParser.FUNC_COT, LaTeXParser.FUNC_ARCSIN, LaTeXParser.FUNC_ARCCOS, LaTeXParser.FUNC_ARCTAN, LaTeXParser.FUNC_ARCCSC, LaTeXParser.FUNC_ARCSEC, LaTeXParser.FUNC_ARCCOT, LaTeXParser.FUNC_SINH, LaTeXParser.FUNC_COSH, LaTeXParser.FUNC_TANH, LaTeXParser.FUNC_ARSINH, LaTeXParser.FUNC_ARCOSH, LaTeXParser.FUNC_ARTANH, LaTeXParser.L_FLOOR, LaTeXParser.L_CEIL, LaTeXParser.FUNC_SQRT, LaTeXParser.FUNC_OVERLINE, LaTeXParser.CMD_FRAC, LaTeXParser.CMD_BINOM, LaTeXParser.CMD_DBINOM, LaTeXParser.CMD_TBINOM, LaTeXParser.CMD_MATHIT, LaTeXParser.DIFFERENTIAL, LaTeXParser.LETTER, LaTeXParser.NUMBER, LaTeXParser.SYMBOL]:
                self.enterOuterAlt(localctx, 2)
                self.state = 135
                self._errHandler.sync(self)
                _alt = 1
                while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                    if _alt == 1:
                        self.state = 134
                        self.postfix()

                    else:
                        raise NoViableAltException(self)
                    self.state = 137
                    self._errHandler.sync(self)
                    _alt = self._interp.adaptivePredict(self._input,4,self._ctx)

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

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

        def unary_nofunc(self):
            return self.getTypedRuleContext(LaTeXParser.Unary_nofuncContext,0)


        def ADD(self):
            return self.getToken(LaTeXParser.ADD, 0)

        def SUB(self):
            return self.getToken(LaTeXParser.SUB, 0)

        def postfix(self):
            return self.getTypedRuleContext(LaTeXParser.PostfixContext,0)


        def postfix_nofunc(self, i=None):
            if i is None:
                return self.getTypedRuleContexts(LaTeXParser.Postfix_nofuncContext)
            else:
                return self.getTypedRuleContext(LaTeXParser.Postfix_nofuncContext,i)


        def getRuleIndex(self):
            return LaTeXParser.RULE_unary_nofunc




    def unary_nofunc(self):

        localctx = LaTeXParser.Unary_nofuncContext(self, self._ctx, self.state)
        self.enterRule(localctx, 16, self.RULE_unary_nofunc)
        self._la = 0 # Token type
        try:
            self.state = 150
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [LaTeXParser.ADD, LaTeXParser.SUB]:
                self.enterOuterAlt(localctx, 1)
                self.state = 141
                _la = self._input.LA(1)
                if not(_la==LaTeXParser.ADD or _la==LaTeXParser.SUB):
                    self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 142
                self.unary_nofunc()
                pass
            elif token in [LaTeXParser.L_PAREN, LaTeXParser.L_BRACE, LaTeXParser.L_BRACE_LITERAL, LaTeXParser.L_BRACKET, LaTeXParser.BAR, LaTeXParser.L_BAR, LaTeXParser.L_ANGLE, LaTeXParser.FUNC_LIM, LaTeXParser.FUNC_INT, LaTeXParser.FUNC_SUM, LaTeXParser.FUNC_PROD, LaTeXParser.FUNC_EXP, LaTeXParser.FUNC_LOG, LaTeXParser.FUNC_LN, LaTeXParser.FUNC_SIN, LaTeXParser.FUNC_COS, LaTeXParser.FUNC_TAN, LaTeXParser.FUNC_CSC, LaTeXParser.FUNC_SEC, LaTeXParser.FUNC_COT, LaTeXParser.FUNC_ARCSIN, LaTeXParser.FUNC_ARCCOS, LaTeXParser.FUNC_ARCTAN, LaTeXParser.FUNC_ARCCSC, LaTeXParser.FUNC_ARCSEC, LaTeXParser.FUNC_ARCCOT, LaTeXParser.FUNC_SINH, LaTeXParser.FUNC_COSH, LaTeXParser.FUNC_TANH, LaTeXParser.FUNC_ARSINH, LaTeXParser.FUNC_ARCOSH, LaTeXParser.FUNC_ARTANH, LaTeXParser.L_FLOOR, LaTeXParser.L_CEIL, LaTeXParser.FUNC_SQRT, LaTeXParser.FUNC_OVERLINE, LaTeXParser.CMD_FRAC, LaTeXParser.CMD_BINOM, LaTeXParser.CMD_DBINOM, LaTeXParser.CMD_TBINOM, LaTeXParser.CMD_MATHIT, LaTeXParser.DIFFERENTIAL, LaTeXParser.LETTER, LaTeXParser.NUMBER, LaTeXParser.SYMBOL]:
                self.enterOuterAlt(localctx, 2)
                self.state = 143
                self.postfix()
                self.state = 147
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,6,self._ctx)
                while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                    if _alt==1:
                        self.state = 144
                        self.postfix_nofunc()
                    self.state = 149
                    self._errHandler.sync(self)
                    _alt = self._interp.adaptivePredict(self._input,6,self._ctx)

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

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

        def exp(self):
            return self.getTypedRuleContext(LaTeXParser.ExpContext,0)


        def postfix_op(self, i=None):
            if i is None:
                return self.getTypedRuleContexts(LaTeXParser.Postfix_opContext)
            else:
                return self.getTypedRuleContext(LaTeXParser.Postfix_opContext,i)


        def getRuleIndex(self):
            return LaTeXParser.RULE_postfix




    def postfix(self):

        localctx = LaTeXParser.PostfixContext(self, self._ctx, self.state)
        self.enterRule(localctx, 18, self.RULE_postfix)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 152
            self.exp(0)
            self.state = 156
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,8,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 153
                    self.postfix_op()
                self.state = 158
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,8,self._ctx)

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


    class Postfix_nofuncContext(ParserRuleContext):

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

        def exp_nofunc(self):
            return self.getTypedRuleContext(LaTeXParser.Exp_nofuncContext,0)


        def postfix_op(self, i=None):
            if i is None:
                return self.getTypedRuleContexts(LaTeXParser.Postfix_opContext)
            else:
                return self.getTypedRuleContext(LaTeXParser.Postfix_opContext,i)


        def getRuleIndex(self):
            return LaTeXParser.RULE_postfix_nofunc




    def postfix_nofunc(self):

        localctx = LaTeXParser.Postfix_nofuncContext(self, self._ctx, self.state)
        self.enterRule(localctx, 20, self.RULE_postfix_nofunc)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 159
            self.exp_nofunc(0)
            self.state = 163
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,9,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 160
                    self.postfix_op()
                self.state = 165
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,9,self._ctx)

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


    class Postfix_opContext(ParserRuleContext):

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

        def BANG(self):
            return self.getToken(LaTeXParser.BANG, 0)

        def eval_at(self):
            return self.getTypedRuleContext(LaTeXParser.Eval_atContext,0)


        def getRuleIndex(self):
            return LaTeXParser.RULE_postfix_op




    def postfix_op(self):

        localctx = LaTeXParser.Postfix_opContext(self, self._ctx, self.state)
        self.enterRule(localctx, 22, self.RULE_postfix_op)
        try:
            self.state = 168
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [LaTeXParser.BANG]:
                self.enterOuterAlt(localctx, 1)
                self.state = 166
                self.match(LaTeXParser.BANG)
                pass
            elif token in [LaTeXParser.BAR]:
                self.enterOuterAlt(localctx, 2)
                self.state = 167
                self.eval_at()
                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 Eval_atContext(ParserRuleContext):

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

        def BAR(self):
            return self.getToken(LaTeXParser.BAR, 0)

        def eval_at_sup(self):
            return self.getTypedRuleContext(LaTeXParser.Eval_at_supContext,0)


        def eval_at_sub(self):
            return self.getTypedRuleContext(LaTeXParser.Eval_at_subContext,0)


        def getRuleIndex(self):
            return LaTeXParser.RULE_eval_at




    def eval_at(self):

        localctx = LaTeXParser.Eval_atContext(self, self._ctx, self.state)
        self.enterRule(localctx, 24, self.RULE_eval_at)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 170
            self.match(LaTeXParser.BAR)
            self.state = 176
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,11,self._ctx)
            if la_ == 1:
                self.state = 171
                self.eval_at_sup()
                pass

            elif la_ == 2:
                self.state = 172
                self.eval_at_sub()
                pass

            elif la_ == 3:
                self.state = 173
                self.eval_at_sup()
                self.state = 174
                self.eval_at_sub()
                pass


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


    class Eval_at_subContext(ParserRuleContext):

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

        def UNDERSCORE(self):
            return self.getToken(LaTeXParser.UNDERSCORE, 0)

        def L_BRACE(self):
            return self.getToken(LaTeXParser.L_BRACE, 0)

        def R_BRACE(self):
            return self.getToken(LaTeXParser.R_BRACE, 0)

        def expr(self):
            return self.getTypedRuleContext(LaTeXParser.ExprContext,0)


        def equality(self):
            return self.getTypedRuleContext(LaTeXParser.EqualityContext,0)


        def getRuleIndex(self):
            return LaTeXParser.RULE_eval_at_sub




    def eval_at_sub(self):

        localctx = LaTeXParser.Eval_at_subContext(self, self._ctx, self.state)
        self.enterRule(localctx, 26, self.RULE_eval_at_sub)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 178
            self.match(LaTeXParser.UNDERSCORE)
            self.state = 179
            self.match(LaTeXParser.L_BRACE)
            self.state = 182
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,12,self._ctx)
            if la_ == 1:
                self.state = 180
                self.expr()
                pass

            elif la_ == 2:
                self.state = 181
                self.equality()
                pass


            self.state = 184
            self.match(LaTeXParser.R_BRACE)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Eval_at_supContext(ParserRuleContext):

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

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

        def L_BRACE(self):
            return self.getToken(LaTeXParser.L_BRACE, 0)

        def R_BRACE(self):
            return self.getToken(LaTeXParser.R_BRACE, 0)

        def expr(self):
            return self.getTypedRuleContext(LaTeXParser.ExprContext,0)


        def equality(self):
            return self.getTypedRuleContext(LaTeXParser.EqualityContext,0)


        def getRuleIndex(self):
            return LaTeXParser.RULE_eval_at_sup




    def eval_at_sup(self):

        localctx = LaTeXParser.Eval_at_supContext(self, self._ctx, self.state)
        self.enterRule(localctx, 28, self.RULE_eval_at_sup)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 186
            self.match(LaTeXParser.CARET)
            self.state = 187
            self.match(LaTeXParser.L_BRACE)
            self.state = 190
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,13,self._ctx)
            if la_ == 1:
                self.state = 188
                self.expr()
                pass

            elif la_ == 2:
                self.state = 189
                self.equality()
                pass


            self.state = 192
            self.match(LaTeXParser.R_BRACE)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ExpContext(ParserRuleContext):

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

        def comp(self):
            return self.getTypedRuleContext(LaTeXParser.CompContext,0)


        def exp(self):
            return self.getTypedRuleContext(LaTeXParser.ExpContext,0)


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

        def atom(self):
            return self.getTypedRuleContext(LaTeXParser.AtomContext,0)


        def L_BRACE(self):
            return self.getToken(LaTeXParser.L_BRACE, 0)

        def expr(self):
            return self.getTypedRuleContext(LaTeXParser.ExprContext,0)


        def R_BRACE(self):
            return self.getToken(LaTeXParser.R_BRACE, 0)

        def subexpr(self):
            return self.getTypedRuleContext(LaTeXParser.SubexprContext,0)


        def getRuleIndex(self):
            return LaTeXParser.RULE_exp



    def exp(self, _p=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = LaTeXParser.ExpContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 30
        self.enterRecursionRule(localctx, 30, self.RULE_exp, _p)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 195
            self.comp()
            self._ctx.stop = self._input.LT(-1)
            self.state = 211
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,16,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    localctx = LaTeXParser.ExpContext(self, _parentctx, _parentState)
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_exp)
                    self.state = 197
                    if not self.precpred(self._ctx, 2):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                    self.state = 198
                    self.match(LaTeXParser.CARET)
                    self.state = 204
                    self._errHandler.sync(self)
                    token = self._input.LA(1)
                    if token in [LaTeXParser.BAR, LaTeXParser.L_BAR, LaTeXParser.L_ANGLE, LaTeXParser.CMD_MATHIT, LaTeXParser.DIFFERENTIAL, LaTeXParser.LETTER, LaTeXParser.NUMBER, LaTeXParser.SYMBOL]:
                        self.state = 199
                        self.atom()
                        pass
                    elif token in [LaTeXParser.L_BRACE]:
                        self.state = 200
                        self.match(LaTeXParser.L_BRACE)
                        self.state = 201
                        self.expr()
                        self.state = 202
                        self.match(LaTeXParser.R_BRACE)
                        pass
                    else:
                        raise NoViableAltException(self)

                    self.state = 207
                    self._errHandler.sync(self)
                    la_ = self._interp.adaptivePredict(self._input,15,self._ctx)
                    if la_ == 1:
                        self.state = 206
                        self.subexpr()


                self.state = 213
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,16,self._ctx)

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


    class Exp_nofuncContext(ParserRuleContext):

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

        def comp_nofunc(self):
            return self.getTypedRuleContext(LaTeXParser.Comp_nofuncContext,0)


        def exp_nofunc(self):
            return self.getTypedRuleContext(LaTeXParser.Exp_nofuncContext,0)


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

        def atom(self):
            return self.getTypedRuleContext(LaTeXParser.AtomContext,0)


        def L_BRACE(self):
            return self.getToken(LaTeXParser.L_BRACE, 0)

        def expr(self):
            return self.getTypedRuleContext(LaTeXParser.ExprContext,0)


        def R_BRACE(self):
            return self.getToken(LaTeXParser.R_BRACE, 0)

        def subexpr(self):
            return self.getTypedRuleContext(LaTeXParser.SubexprContext,0)


        def getRuleIndex(self):
            return LaTeXParser.RULE_exp_nofunc



    def exp_nofunc(self, _p=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = LaTeXParser.Exp_nofuncContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 32
        self.enterRecursionRule(localctx, 32, self.RULE_exp_nofunc, _p)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 215
            self.comp_nofunc()
            self._ctx.stop = self._input.LT(-1)
            self.state = 231
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,19,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    localctx = LaTeXParser.Exp_nofuncContext(self, _parentctx, _parentState)
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_exp_nofunc)
                    self.state = 217
                    if not self.precpred(self._ctx, 2):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                    self.state = 218
                    self.match(LaTeXParser.CARET)
                    self.state = 224
                    self._errHandler.sync(self)
                    token = self._input.LA(1)
                    if token in [LaTeXParser.BAR, LaTeXParser.L_BAR, LaTeXParser.L_ANGLE, LaTeXParser.CMD_MATHIT, LaTeXParser.DIFFERENTIAL, LaTeXParser.LETTER, LaTeXParser.NUMBER, LaTeXParser.SYMBOL]:
                        self.state = 219
                        self.atom()
                        pass
                    elif token in [LaTeXParser.L_BRACE]:
                        self.state = 220
                        self.match(LaTeXParser.L_BRACE)
                        self.state = 221
                        self.expr()
                        self.state = 222
                        self.match(LaTeXParser.R_BRACE)
                        pass
                    else:
                        raise NoViableAltException(self)

                    self.state = 227
                    self._errHandler.sync(self)
                    la_ = self._interp.adaptivePredict(self._input,18,self._ctx)
                    if la_ == 1:
                        self.state = 226
                        self.subexpr()


                self.state = 233
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,19,self._ctx)

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


    class CompContext(ParserRuleContext):

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

        def group(self):
            return self.getTypedRuleContext(LaTeXParser.GroupContext,0)


        def abs_group(self):
            return self.getTypedRuleContext(LaTeXParser.Abs_groupContext,0)


        def func(self):
            return self.getTypedRuleContext(LaTeXParser.FuncContext,0)


        def atom(self):
            return self.getTypedRuleContext(LaTeXParser.AtomContext,0)


        def frac(self):
            return self.getTypedRuleContext(LaTeXParser.FracContext,0)


        def binom(self):
            return self.getTypedRuleContext(LaTeXParser.BinomContext,0)


        def floor(self):
            return self.getTypedRuleContext(LaTeXParser.FloorContext,0)


        def ceil(self):
            return self.getTypedRuleContext(LaTeXParser.CeilContext,0)


        def getRuleIndex(self):
            return LaTeXParser.RULE_comp




    def comp(self):

        localctx = LaTeXParser.CompContext(self, self._ctx, self.state)
        self.enterRule(localctx, 34, self.RULE_comp)
        try:
            self.state = 242
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,20,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 234
                self.group()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 235
                self.abs_group()
                pass

            elif la_ == 3:
                self.enterOuterAlt(localctx, 3)
                self.state = 236
                self.func()
                pass

            elif la_ == 4:
                self.enterOuterAlt(localctx, 4)
                self.state = 237
                self.atom()
                pass

            elif la_ == 5:
                self.enterOuterAlt(localctx, 5)
                self.state = 238
                self.frac()
                pass

            elif la_ == 6:
                self.enterOuterAlt(localctx, 6)
                self.state = 239
                self.binom()
                pass

            elif la_ == 7:
                self.enterOuterAlt(localctx, 7)
                self.state = 240
                self.floor()
                pass

            elif la_ == 8:
                self.enterOuterAlt(localctx, 8)
                self.state = 241
                self.ceil()
                pass


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


    class Comp_nofuncContext(ParserRuleContext):

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

        def group(self):
            return self.getTypedRuleContext(LaTeXParser.GroupContext,0)


        def abs_group(self):
            return self.getTypedRuleContext(LaTeXParser.Abs_groupContext,0)


        def atom(self):
            return self.getTypedRuleContext(LaTeXParser.AtomContext,0)


        def frac(self):
            return self.getTypedRuleContext(LaTeXParser.FracContext,0)


        def binom(self):
            return self.getTypedRuleContext(LaTeXParser.BinomContext,0)


        def floor(self):
            return self.getTypedRuleContext(LaTeXParser.FloorContext,0)


        def ceil(self):
            return self.getTypedRuleContext(LaTeXParser.CeilContext,0)


        def getRuleIndex(self):
            return LaTeXParser.RULE_comp_nofunc




    def comp_nofunc(self):

        localctx = LaTeXParser.Comp_nofuncContext(self, self._ctx, self.state)
        self.enterRule(localctx, 36, self.RULE_comp_nofunc)
        try:
            self.state = 251
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,21,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 244
                self.group()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 245
                self.abs_group()
                pass

            elif la_ == 3:
                self.enterOuterAlt(localctx, 3)
                self.state = 246
                self.atom()
                pass

            elif la_ == 4:
                self.enterOuterAlt(localctx, 4)
                self.state = 247
                self.frac()
                pass

            elif la_ == 5:
                self.enterOuterAlt(localctx, 5)
                self.state = 248
                self.binom()
                pass

            elif la_ == 6:
                self.enterOuterAlt(localctx, 6)
                self.state = 249
                self.floor()
                pass

            elif la_ == 7:
                self.enterOuterAlt(localctx, 7)
                self.state = 250
                self.ceil()
                pass


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


    class GroupContext(ParserRuleContext):

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

        def L_PAREN(self):
            return self.getToken(LaTeXParser.L_PAREN, 0)

        def expr(self):
            return self.getTypedRuleContext(LaTeXParser.ExprContext,0)


        def R_PAREN(self):
            return self.getToken(LaTeXParser.R_PAREN, 0)

        def L_BRACKET(self):
            return self.getToken(LaTeXParser.L_BRACKET, 0)

        def R_BRACKET(self):
            return self.getToken(LaTeXParser.R_BRACKET, 0)

        def L_BRACE(self):
            return self.getToken(LaTeXParser.L_BRACE, 0)

        def R_BRACE(self):
            return self.getToken(LaTeXParser.R_BRACE, 0)

        def L_BRACE_LITERAL(self):
            return self.getToken(LaTeXParser.L_BRACE_LITERAL, 0)

        def R_BRACE_LITERAL(self):
            return self.getToken(LaTeXParser.R_BRACE_LITERAL, 0)

        def getRuleIndex(self):
            return LaTeXParser.RULE_group




    def group(self):

        localctx = LaTeXParser.GroupContext(self, self._ctx, self.state)
        self.enterRule(localctx, 38, self.RULE_group)
        try:
            self.state = 269
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [LaTeXParser.L_PAREN]:
                self.enterOuterAlt(localctx, 1)
                self.state = 253
                self.match(LaTeXParser.L_PAREN)
                self.state = 254
                self.expr()
                self.state = 255
                self.match(LaTeXParser.R_PAREN)
                pass
            elif token in [LaTeXParser.L_BRACKET]:
                self.enterOuterAlt(localctx, 2)
                self.state = 257
                self.match(LaTeXParser.L_BRACKET)
                self.state = 258
                self.expr()
                self.state = 259
                self.match(LaTeXParser.R_BRACKET)
                pass
            elif token in [LaTeXParser.L_BRACE]:
                self.enterOuterAlt(localctx, 3)
                self.state = 261
                self.match(LaTeXParser.L_BRACE)
                self.state = 262
                self.expr()
                self.state = 263
                self.match(LaTeXParser.R_BRACE)
                pass
            elif token in [LaTeXParser.L_BRACE_LITERAL]:
                self.enterOuterAlt(localctx, 4)
                self.state = 265
                self.match(LaTeXParser.L_BRACE_LITERAL)
                self.state = 266
                self.expr()
                self.state = 267
                self.match(LaTeXParser.R_BRACE_LITERAL)
                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 Abs_groupContext(ParserRuleContext):

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

        def BAR(self, i=None):
            if i is None:
                return self.getTokens(LaTeXParser.BAR)
            else:
                return self.getToken(LaTeXParser.BAR, i)

        def expr(self):
            return self.getTypedRuleContext(LaTeXParser.ExprContext,0)


        def getRuleIndex(self):
            return LaTeXParser.RULE_abs_group




    def abs_group(self):

        localctx = LaTeXParser.Abs_groupContext(self, self._ctx, self.state)
        self.enterRule(localctx, 40, self.RULE_abs_group)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 271
            self.match(LaTeXParser.BAR)
            self.state = 272
            self.expr()
            self.state = 273
            self.match(LaTeXParser.BAR)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class AtomContext(ParserRuleContext):

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

        def LETTER(self):
            return self.getToken(LaTeXParser.LETTER, 0)

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

        def subexpr(self):
            return self.getTypedRuleContext(LaTeXParser.SubexprContext,0)


        def NUMBER(self):
            return self.getToken(LaTeXParser.NUMBER, 0)

        def DIFFERENTIAL(self):
            return self.getToken(LaTeXParser.DIFFERENTIAL, 0)

        def mathit(self):
            return self.getTypedRuleContext(LaTeXParser.MathitContext,0)


        def bra(self):
            return self.getTypedRuleContext(LaTeXParser.BraContext,0)


        def ket(self):
            return self.getTypedRuleContext(LaTeXParser.KetContext,0)


        def getRuleIndex(self):
            return LaTeXParser.RULE_atom




    def atom(self):

        localctx = LaTeXParser.AtomContext(self, self._ctx, self.state)
        self.enterRule(localctx, 42, self.RULE_atom)
        self._la = 0 # Token type
        try:
            self.state = 284
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [LaTeXParser.LETTER, LaTeXParser.SYMBOL]:
                self.enterOuterAlt(localctx, 1)
                self.state = 275
                _la = self._input.LA(1)
                if not(_la==LaTeXParser.LETTER or _la==LaTeXParser.SYMBOL):
                    self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 277
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,23,self._ctx)
                if la_ == 1:
                    self.state = 276
                    self.subexpr()


                pass
            elif token in [LaTeXParser.NUMBER]:
                self.enterOuterAlt(localctx, 2)
                self.state = 279
                self.match(LaTeXParser.NUMBER)
                pass
            elif token in [LaTeXParser.DIFFERENTIAL]:
                self.enterOuterAlt(localctx, 3)
                self.state = 280
                self.match(LaTeXParser.DIFFERENTIAL)
                pass
            elif token in [LaTeXParser.CMD_MATHIT]:
                self.enterOuterAlt(localctx, 4)
                self.state = 281
                self.mathit()
                pass
            elif token in [LaTeXParser.L_ANGLE]:
                self.enterOuterAlt(localctx, 5)
                self.state = 282
                self.bra()
                pass
            elif token in [LaTeXParser.BAR, LaTeXParser.L_BAR]:
                self.enterOuterAlt(localctx, 6)
                self.state = 283
                self.ket()
                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 BraContext(ParserRuleContext):

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

        def L_ANGLE(self):
            return self.getToken(LaTeXParser.L_ANGLE, 0)

        def expr(self):
            return self.getTypedRuleContext(LaTeXParser.ExprContext,0)


        def R_BAR(self):
            return self.getToken(LaTeXParser.R_BAR, 0)

        def BAR(self):
            return self.getToken(LaTeXParser.BAR, 0)

        def getRuleIndex(self):
            return LaTeXParser.RULE_bra




    def bra(self):

        localctx = LaTeXParser.BraContext(self, self._ctx, self.state)
        self.enterRule(localctx, 44, self.RULE_bra)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 286
            self.match(LaTeXParser.L_ANGLE)
            self.state = 287
            self.expr()
            self.state = 288
            _la = self._input.LA(1)
            if not(_la==LaTeXParser.BAR or _la==LaTeXParser.R_BAR):
                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 KetContext(ParserRuleContext):

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

        def expr(self):
            return self.getTypedRuleContext(LaTeXParser.ExprContext,0)


        def R_ANGLE(self):
            return self.getToken(LaTeXParser.R_ANGLE, 0)

        def L_BAR(self):
            return self.getToken(LaTeXParser.L_BAR, 0)

        def BAR(self):
            return self.getToken(LaTeXParser.BAR, 0)

        def getRuleIndex(self):
            return LaTeXParser.RULE_ket




    def ket(self):

        localctx = LaTeXParser.KetContext(self, self._ctx, self.state)
        self.enterRule(localctx, 46, self.RULE_ket)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 290
            _la = self._input.LA(1)
            if not(_la==LaTeXParser.BAR or _la==LaTeXParser.L_BAR):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
            self.state = 291
            self.expr()
            self.state = 292
            self.match(LaTeXParser.R_ANGLE)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class MathitContext(ParserRuleContext):

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

        def CMD_MATHIT(self):
            return self.getToken(LaTeXParser.CMD_MATHIT, 0)

        def L_BRACE(self):
            return self.getToken(LaTeXParser.L_BRACE, 0)

        def mathit_text(self):
            return self.getTypedRuleContext(LaTeXParser.Mathit_textContext,0)


        def R_BRACE(self):
            return self.getToken(LaTeXParser.R_BRACE, 0)

        def getRuleIndex(self):
            return LaTeXParser.RULE_mathit




    def mathit(self):

        localctx = LaTeXParser.MathitContext(self, self._ctx, self.state)
        self.enterRule(localctx, 48, self.RULE_mathit)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 294
            self.match(LaTeXParser.CMD_MATHIT)
            self.state = 295
            self.match(LaTeXParser.L_BRACE)
            self.state = 296
            self.mathit_text()
            self.state = 297
            self.match(LaTeXParser.R_BRACE)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Mathit_textContext(ParserRuleContext):

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

        def LETTER(self, i=None):
            if i is None:
                return self.getTokens(LaTeXParser.LETTER)
            else:
                return self.getToken(LaTeXParser.LETTER, i)

        def getRuleIndex(self):
            return LaTeXParser.RULE_mathit_text




    def mathit_text(self):

        localctx = LaTeXParser.Mathit_textContext(self, self._ctx, self.state)
        self.enterRule(localctx, 50, self.RULE_mathit_text)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 302
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==LaTeXParser.LETTER:
                self.state = 299
                self.match(LaTeXParser.LETTER)
                self.state = 304
                self._errHandler.sync(self)
                _la = self._input.LA(1)

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


    class FracContext(ParserRuleContext):

        def __init__(self, parser, parent=None, invokingState=-1):
            super(LaTeXParser.FracContext, self).__init__(parent, invokingState)
            self.parser = parser
            self.upper = None # ExprContext
            self.lower = None # ExprContext

        def CMD_FRAC(self):
            return self.getToken(LaTeXParser.CMD_FRAC, 0)

        def L_BRACE(self, i=None):
            if i is None:
                return self.getTokens(LaTeXParser.L_BRACE)
            else:
                return self.getToken(LaTeXParser.L_BRACE, i)

        def R_BRACE(self, i=None):
            if i is None:
                return self.getTokens(LaTeXParser.R_BRACE)
            else:
                return self.getToken(LaTeXParser.R_BRACE, i)

        def expr(self, i=None):
            if i is None:
                return self.getTypedRuleContexts(LaTeXParser.ExprContext)
            else:
                return self.getTypedRuleContext(LaTeXParser.ExprContext,i)


        def getRuleIndex(self):
            return LaTeXParser.RULE_frac




    def frac(self):

        localctx = LaTeXParser.FracContext(self, self._ctx, self.state)
        self.enterRule(localctx, 52, self.RULE_frac)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 305
            self.match(LaTeXParser.CMD_FRAC)
            self.state = 306
            self.match(LaTeXParser.L_BRACE)
            self.state = 307
            localctx.upper = self.expr()
            self.state = 308
            self.match(LaTeXParser.R_BRACE)
            self.state = 309
            self.match(LaTeXParser.L_BRACE)
            self.state = 310
            localctx.lower = self.expr()
            self.state = 311
            self.match(LaTeXParser.R_BRACE)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class BinomContext(ParserRuleContext):

        def __init__(self, parser, parent=None, invokingState=-1):
            super(LaTeXParser.BinomContext, self).__init__(parent, invokingState)
            self.parser = parser
            self.n = None # ExprContext
            self.k = None # ExprContext

        def L_BRACE(self, i=None):
            if i is None:
                return self.getTokens(LaTeXParser.L_BRACE)
            else:
                return self.getToken(LaTeXParser.L_BRACE, i)

        def R_BRACE(self, i=None):
            if i is None:
                return self.getTokens(LaTeXParser.R_BRACE)
            else:
                return self.getToken(LaTeXParser.R_BRACE, i)

        def CMD_BINOM(self):
            return self.getToken(LaTeXParser.CMD_BINOM, 0)

        def CMD_DBINOM(self):
            return self.getToken(LaTeXParser.CMD_DBINOM, 0)

        def CMD_TBINOM(self):
            return self.getToken(LaTeXParser.CMD_TBINOM, 0)

        def expr(self, i=None):
            if i is None:
                return self.getTypedRuleContexts(LaTeXParser.ExprContext)
            else:
                return self.getTypedRuleContext(LaTeXParser.ExprContext,i)


        def getRuleIndex(self):
            return LaTeXParser.RULE_binom




    def binom(self):

        localctx = LaTeXParser.BinomContext(self, self._ctx, self.state)
        self.enterRule(localctx, 54, self.RULE_binom)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 313
            _la = self._input.LA(1)
            if not(((((_la - 67)) & ~0x3f) == 0 and ((1 << (_la - 67)) & ((1 << (LaTeXParser.CMD_BINOM - 67)) | (1 << (LaTeXParser.CMD_DBINOM - 67)) | (1 << (LaTeXParser.CMD_TBINOM - 67)))) != 0)):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
            self.state = 314
            self.match(LaTeXParser.L_BRACE)
            self.state = 315
            localctx.n = self.expr()
            self.state = 316
            self.match(LaTeXParser.R_BRACE)
            self.state = 317
            self.match(LaTeXParser.L_BRACE)
            self.state = 318
            localctx.k = self.expr()
            self.state = 319
            self.match(LaTeXParser.R_BRACE)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class FloorContext(ParserRuleContext):

        def __init__(self, parser, parent=None, invokingState=-1):
            super(LaTeXParser.FloorContext, self).__init__(parent, invokingState)
            self.parser = parser
            self.val = None # ExprContext

        def L_FLOOR(self):
            return self.getToken(LaTeXParser.L_FLOOR, 0)

        def R_FLOOR(self):
            return self.getToken(LaTeXParser.R_FLOOR, 0)

        def expr(self):
            return self.getTypedRuleContext(LaTeXParser.ExprContext,0)


        def getRuleIndex(self):
            return LaTeXParser.RULE_floor




    def floor(self):

        localctx = LaTeXParser.FloorContext(self, self._ctx, self.state)
        self.enterRule(localctx, 56, self.RULE_floor)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 321
            self.match(LaTeXParser.L_FLOOR)
            self.state = 322
            localctx.val = self.expr()
            self.state = 323
            self.match(LaTeXParser.R_FLOOR)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class CeilContext(ParserRuleContext):

        def __init__(self, parser, parent=None, invokingState=-1):
            super(LaTeXParser.CeilContext, self).__init__(parent, invokingState)
            self.parser = parser
            self.val = None # ExprContext

        def L_CEIL(self):
            return self.getToken(LaTeXParser.L_CEIL, 0)

        def R_CEIL(self):
            return self.getToken(LaTeXParser.R_CEIL, 0)

        def expr(self):
            return self.getTypedRuleContext(LaTeXParser.ExprContext,0)


        def getRuleIndex(self):
            return LaTeXParser.RULE_ceil




    def ceil(self):

        localctx = LaTeXParser.CeilContext(self, self._ctx, self.state)
        self.enterRule(localctx, 58, self.RULE_ceil)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 325
            self.match(LaTeXParser.L_CEIL)
            self.state = 326
            localctx.val = self.expr()
            self.state = 327
            self.match(LaTeXParser.R_CEIL)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Func_normalContext(ParserRuleContext):

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

        def FUNC_EXP(self):
            return self.getToken(LaTeXParser.FUNC_EXP, 0)

        def FUNC_LOG(self):
            return self.getToken(LaTeXParser.FUNC_LOG, 0)

        def FUNC_LN(self):
            return self.getToken(LaTeXParser.FUNC_LN, 0)

        def FUNC_SIN(self):
            return self.getToken(LaTeXParser.FUNC_SIN, 0)

        def FUNC_COS(self):
            return self.getToken(LaTeXParser.FUNC_COS, 0)

        def FUNC_TAN(self):
            return self.getToken(LaTeXParser.FUNC_TAN, 0)

        def FUNC_CSC(self):
            return self.getToken(LaTeXParser.FUNC_CSC, 0)

        def FUNC_SEC(self):
            return self.getToken(LaTeXParser.FUNC_SEC, 0)

        def FUNC_COT(self):
            return self.getToken(LaTeXParser.FUNC_COT, 0)

        def FUNC_ARCSIN(self):
            return self.getToken(LaTeXParser.FUNC_ARCSIN, 0)

        def FUNC_ARCCOS(self):
            return self.getToken(LaTeXParser.FUNC_ARCCOS, 0)

        def FUNC_ARCTAN(self):
            return self.getToken(LaTeXParser.FUNC_ARCTAN, 0)

        def FUNC_ARCCSC(self):
            return self.getToken(LaTeXParser.FUNC_ARCCSC, 0)

        def FUNC_ARCSEC(self):
            return self.getToken(LaTeXParser.FUNC_ARCSEC, 0)

        def FUNC_ARCCOT(self):
            return self.getToken(LaTeXParser.FUNC_ARCCOT, 0)

        def FUNC_SINH(self):
            return self.getToken(LaTeXParser.FUNC_SINH, 0)

        def FUNC_COSH(self):
            return self.getToken(LaTeXParser.FUNC_COSH, 0)

        def FUNC_TANH(self):
            return self.getToken(LaTeXParser.FUNC_TANH, 0)

        def FUNC_ARSINH(self):
            return self.getToken(LaTeXParser.FUNC_ARSINH, 0)

        def FUNC_ARCOSH(self):
            return self.getToken(LaTeXParser.FUNC_ARCOSH, 0)

        def FUNC_ARTANH(self):
            return self.getToken(LaTeXParser.FUNC_ARTANH, 0)

        def getRuleIndex(self):
            return LaTeXParser.RULE_func_normal




    def func_normal(self):

        localctx = LaTeXParser.Func_normalContext(self, self._ctx, self.state)
        self.enterRule(localctx, 60, self.RULE_func_normal)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 329
            _la = self._input.LA(1)
            if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << LaTeXParser.FUNC_EXP) | (1 << LaTeXParser.FUNC_LOG) | (1 << LaTeXParser.FUNC_LN) | (1 << LaTeXParser.FUNC_SIN) | (1 << LaTeXParser.FUNC_COS) | (1 << LaTeXParser.FUNC_TAN) | (1 << LaTeXParser.FUNC_CSC) | (1 << LaTeXParser.FUNC_SEC) | (1 << LaTeXParser.FUNC_COT) | (1 << LaTeXParser.FUNC_ARCSIN) | (1 << LaTeXParser.FUNC_ARCCOS) | (1 << LaTeXParser.FUNC_ARCTAN) | (1 << LaTeXParser.FUNC_ARCCSC) | (1 << LaTeXParser.FUNC_ARCSEC) | (1 << LaTeXParser.FUNC_ARCCOT) | (1 << LaTeXParser.FUNC_SINH) | (1 << LaTeXParser.FUNC_COSH) | (1 << LaTeXParser.FUNC_TANH) | (1 << LaTeXParser.FUNC_ARSINH) | (1 << LaTeXParser.FUNC_ARCOSH) | (1 << LaTeXParser.FUNC_ARTANH))) != 0)):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class FuncContext(ParserRuleContext):

        def __init__(self, parser, parent=None, invokingState=-1):
            super(LaTeXParser.FuncContext, self).__init__(parent, invokingState)
            self.parser = parser
            self.root = None # ExprContext
            self.base = None # ExprContext

        def func_normal(self):
            return self.getTypedRuleContext(LaTeXParser.Func_normalContext,0)


        def L_PAREN(self):
            return self.getToken(LaTeXParser.L_PAREN, 0)

        def func_arg(self):
            return self.getTypedRuleContext(LaTeXParser.Func_argContext,0)


        def R_PAREN(self):
            return self.getToken(LaTeXParser.R_PAREN, 0)

        def func_arg_noparens(self):
            return self.getTypedRuleContext(LaTeXParser.Func_arg_noparensContext,0)


        def subexpr(self):
            return self.getTypedRuleContext(LaTeXParser.SubexprContext,0)


        def supexpr(self):
            return self.getTypedRuleContext(LaTeXParser.SupexprContext,0)


        def args(self):
            return self.getTypedRuleContext(LaTeXParser.ArgsContext,0)


        def LETTER(self):
            return self.getToken(LaTeXParser.LETTER, 0)

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

        def FUNC_INT(self):
            return self.getToken(LaTeXParser.FUNC_INT, 0)

        def DIFFERENTIAL(self):
            return self.getToken(LaTeXParser.DIFFERENTIAL, 0)

        def frac(self):
            return self.getTypedRuleContext(LaTeXParser.FracContext,0)


        def additive(self):
            return self.getTypedRuleContext(LaTeXParser.AdditiveContext,0)


        def FUNC_SQRT(self):
            return self.getToken(LaTeXParser.FUNC_SQRT, 0)

        def L_BRACE(self):
            return self.getToken(LaTeXParser.L_BRACE, 0)

        def R_BRACE(self):
            return self.getToken(LaTeXParser.R_BRACE, 0)

        def expr(self, i=None):
            if i is None:
                return self.getTypedRuleContexts(LaTeXParser.ExprContext)
            else:
                return self.getTypedRuleContext(LaTeXParser.ExprContext,i)


        def L_BRACKET(self):
            return self.getToken(LaTeXParser.L_BRACKET, 0)

        def R_BRACKET(self):
            return self.getToken(LaTeXParser.R_BRACKET, 0)

        def FUNC_OVERLINE(self):
            return self.getToken(LaTeXParser.FUNC_OVERLINE, 0)

        def mp(self):
            return self.getTypedRuleContext(LaTeXParser.MpContext,0)


        def FUNC_SUM(self):
            return self.getToken(LaTeXParser.FUNC_SUM, 0)

        def FUNC_PROD(self):
            return self.getToken(LaTeXParser.FUNC_PROD, 0)

        def subeq(self):
            return self.getTypedRuleContext(LaTeXParser.SubeqContext,0)


        def FUNC_LIM(self):
            return self.getToken(LaTeXParser.FUNC_LIM, 0)

        def limit_sub(self):
            return self.getTypedRuleContext(LaTeXParser.Limit_subContext,0)


        def getRuleIndex(self):
            return LaTeXParser.RULE_func




    def func(self):

        localctx = LaTeXParser.FuncContext(self, self._ctx, self.state)
        self.enterRule(localctx, 62, self.RULE_func)
        self._la = 0 # Token type
        try:
            self.state = 409
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [LaTeXParser.FUNC_EXP, LaTeXParser.FUNC_LOG, LaTeXParser.FUNC_LN, LaTeXParser.FUNC_SIN, LaTeXParser.FUNC_COS, LaTeXParser.FUNC_TAN, LaTeXParser.FUNC_CSC, LaTeXParser.FUNC_SEC, LaTeXParser.FUNC_COT, LaTeXParser.FUNC_ARCSIN, LaTeXParser.FUNC_ARCCOS, LaTeXParser.FUNC_ARCTAN, LaTeXParser.FUNC_ARCCSC, LaTeXParser.FUNC_ARCSEC, LaTeXParser.FUNC_ARCCOT, LaTeXParser.FUNC_SINH, LaTeXParser.FUNC_COSH, LaTeXParser.FUNC_TANH, LaTeXParser.FUNC_ARSINH, LaTeXParser.FUNC_ARCOSH, LaTeXParser.FUNC_ARTANH]:
                self.enterOuterAlt(localctx, 1)
                self.state = 331
                self.func_normal()
                self.state = 344
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,30,self._ctx)
                if la_ == 1:
                    self.state = 333
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if _la==LaTeXParser.UNDERSCORE:
                        self.state = 332
                        self.subexpr()


                    self.state = 336
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if _la==LaTeXParser.CARET:
                        self.state = 335
                        self.supexpr()


                    pass

                elif la_ == 2:
                    self.state = 339
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if _la==LaTeXParser.CARET:
                        self.state = 338
                        self.supexpr()


                    self.state = 342
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if _la==LaTeXParser.UNDERSCORE:
                        self.state = 341
                        self.subexpr()


                    pass


                self.state = 351
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,31,self._ctx)
                if la_ == 1:
                    self.state = 346
                    self.match(LaTeXParser.L_PAREN)
                    self.state = 347
                    self.func_arg()
                    self.state = 348
                    self.match(LaTeXParser.R_PAREN)
                    pass

                elif la_ == 2:
                    self.state = 350
                    self.func_arg_noparens()
                    pass


                pass
            elif token in [LaTeXParser.LETTER, LaTeXParser.SYMBOL]:
                self.enterOuterAlt(localctx, 2)
                self.state = 353
                _la = self._input.LA(1)
                if not(_la==LaTeXParser.LETTER or _la==LaTeXParser.SYMBOL):
                    self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 355
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==LaTeXParser.UNDERSCORE:
                    self.state = 354
                    self.subexpr()


                self.state = 357
                self.match(LaTeXParser.L_PAREN)
                self.state = 358
                self.args()
                self.state = 359
                self.match(LaTeXParser.R_PAREN)
                pass
            elif token in [LaTeXParser.FUNC_INT]:
                self.enterOuterAlt(localctx, 3)
                self.state = 361
                self.match(LaTeXParser.FUNC_INT)
                self.state = 368
                self._errHandler.sync(self)
                token = self._input.LA(1)
                if token in [LaTeXParser.UNDERSCORE]:
                    self.state = 362
                    self.subexpr()
                    self.state = 363
                    self.supexpr()
                    pass
                elif token in [LaTeXParser.CARET]:
                    self.state = 365
                    self.supexpr()
                    self.state = 366
                    self.subexpr()
                    pass
                elif token in [LaTeXParser.ADD, LaTeXParser.SUB, LaTeXParser.L_PAREN, LaTeXParser.L_BRACE, LaTeXParser.L_BRACE_LITERAL, LaTeXParser.L_BRACKET, LaTeXParser.BAR, LaTeXParser.L_BAR, LaTeXParser.L_ANGLE, LaTeXParser.FUNC_LIM, LaTeXParser.FUNC_INT, LaTeXParser.FUNC_SUM, LaTeXParser.FUNC_PROD, LaTeXParser.FUNC_EXP, LaTeXParser.FUNC_LOG, LaTeXParser.FUNC_LN, LaTeXParser.FUNC_SIN, LaTeXParser.FUNC_COS, LaTeXParser.FUNC_TAN, LaTeXParser.FUNC_CSC, LaTeXParser.FUNC_SEC, LaTeXParser.FUNC_COT, LaTeXParser.FUNC_ARCSIN, LaTeXParser.FUNC_ARCCOS, LaTeXParser.FUNC_ARCTAN, LaTeXParser.FUNC_ARCCSC, LaTeXParser.FUNC_ARCSEC, LaTeXParser.FUNC_ARCCOT, LaTeXParser.FUNC_SINH, LaTeXParser.FUNC_COSH, LaTeXParser.FUNC_TANH, LaTeXParser.FUNC_ARSINH, LaTeXParser.FUNC_ARCOSH, LaTeXParser.FUNC_ARTANH, LaTeXParser.L_FLOOR, LaTeXParser.L_CEIL, LaTeXParser.FUNC_SQRT, LaTeXParser.FUNC_OVERLINE, LaTeXParser.CMD_FRAC, LaTeXParser.CMD_BINOM, LaTeXParser.CMD_DBINOM, LaTeXParser.CMD_TBINOM, LaTeXParser.CMD_MATHIT, LaTeXParser.DIFFERENTIAL, LaTeXParser.LETTER, LaTeXParser.NUMBER, LaTeXParser.SYMBOL]:
                    pass
                else:
                    pass
                self.state = 376
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,35,self._ctx)
                if la_ == 1:
                    self.state = 371
                    self._errHandler.sync(self)
                    la_ = self._interp.adaptivePredict(self._input,34,self._ctx)
                    if la_ == 1:
                        self.state = 370
                        self.additive(0)


                    self.state = 373
                    self.match(LaTeXParser.DIFFERENTIAL)
                    pass

                elif la_ == 2:
                    self.state = 374
                    self.frac()
                    pass

                elif la_ == 3:
                    self.state = 375
                    self.additive(0)
                    pass


                pass
            elif token in [LaTeXParser.FUNC_SQRT]:
                self.enterOuterAlt(localctx, 4)
                self.state = 378
                self.match(LaTeXParser.FUNC_SQRT)
                self.state = 383
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==LaTeXParser.L_BRACKET:
                    self.state = 379
                    self.match(LaTeXParser.L_BRACKET)
                    self.state = 380
                    localctx.root = self.expr()
                    self.state = 381
                    self.match(LaTeXParser.R_BRACKET)


                self.state = 385
                self.match(LaTeXParser.L_BRACE)
                self.state = 386
                localctx.base = self.expr()
                self.state = 387
                self.match(LaTeXParser.R_BRACE)
                pass
            elif token in [LaTeXParser.FUNC_OVERLINE]:
                self.enterOuterAlt(localctx, 5)
                self.state = 389
                self.match(LaTeXParser.FUNC_OVERLINE)
                self.state = 390
                self.match(LaTeXParser.L_BRACE)
                self.state = 391
                localctx.base = self.expr()
                self.state = 392
                self.match(LaTeXParser.R_BRACE)
                pass
            elif token in [LaTeXParser.FUNC_SUM, LaTeXParser.FUNC_PROD]:
                self.enterOuterAlt(localctx, 6)
                self.state = 394
                _la = self._input.LA(1)
                if not(_la==LaTeXParser.FUNC_SUM or _la==LaTeXParser.FUNC_PROD):
                    self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 401
                self._errHandler.sync(self)
                token = self._input.LA(1)
                if token in [LaTeXParser.UNDERSCORE]:
                    self.state = 395
                    self.subeq()
                    self.state = 396
                    self.supexpr()
                    pass
                elif token in [LaTeXParser.CARET]:
                    self.state = 398
                    self.supexpr()
                    self.state = 399
                    self.subeq()
                    pass
                else:
                    raise NoViableAltException(self)

                self.state = 403
                self.mp(0)
                pass
            elif token in [LaTeXParser.FUNC_LIM]:
                self.enterOuterAlt(localctx, 7)
                self.state = 405
                self.match(LaTeXParser.FUNC_LIM)
                self.state = 406
                self.limit_sub()
                self.state = 407
                self.mp(0)
                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 ArgsContext(ParserRuleContext):

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

        def expr(self):
            return self.getTypedRuleContext(LaTeXParser.ExprContext,0)


        def args(self):
            return self.getTypedRuleContext(LaTeXParser.ArgsContext,0)


        def getRuleIndex(self):
            return LaTeXParser.RULE_args




    def args(self):

        localctx = LaTeXParser.ArgsContext(self, self._ctx, self.state)
        self.enterRule(localctx, 64, self.RULE_args)
        try:
            self.state = 416
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,39,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 411
                self.expr()
                self.state = 412
                self.match(LaTeXParser.T__0)
                self.state = 413
                self.args()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 415
                self.expr()
                pass


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


    class Limit_subContext(ParserRuleContext):

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

        def UNDERSCORE(self):
            return self.getToken(LaTeXParser.UNDERSCORE, 0)

        def L_BRACE(self, i=None):
            if i is None:
                return self.getTokens(LaTeXParser.L_BRACE)
            else:
                return self.getToken(LaTeXParser.L_BRACE, i)

        def LIM_APPROACH_SYM(self):
            return self.getToken(LaTeXParser.LIM_APPROACH_SYM, 0)

        def expr(self):
            return self.getTypedRuleContext(LaTeXParser.ExprContext,0)


        def R_BRACE(self, i=None):
            if i is None:
                return self.getTokens(LaTeXParser.R_BRACE)
            else:
                return self.getToken(LaTeXParser.R_BRACE, i)

        def LETTER(self):
            return self.getToken(LaTeXParser.LETTER, 0)

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

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

        def ADD(self):
            return self.getToken(LaTeXParser.ADD, 0)

        def SUB(self):
            return self.getToken(LaTeXParser.SUB, 0)

        def getRuleIndex(self):
            return LaTeXParser.RULE_limit_sub




    def limit_sub(self):

        localctx = LaTeXParser.Limit_subContext(self, self._ctx, self.state)
        self.enterRule(localctx, 66, self.RULE_limit_sub)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 418
            self.match(LaTeXParser.UNDERSCORE)
            self.state = 419
            self.match(LaTeXParser.L_BRACE)
            self.state = 420
            _la = self._input.LA(1)
            if not(_la==LaTeXParser.LETTER or _la==LaTeXParser.SYMBOL):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
            self.state = 421
            self.match(LaTeXParser.LIM_APPROACH_SYM)
            self.state = 422
            self.expr()
            self.state = 427
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==LaTeXParser.CARET:
                self.state = 423
                self.match(LaTeXParser.CARET)
                self.state = 424
                self.match(LaTeXParser.L_BRACE)
                self.state = 425
                _la = self._input.LA(1)
                if not(_la==LaTeXParser.ADD or _la==LaTeXParser.SUB):
                    self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 426
                self.match(LaTeXParser.R_BRACE)


            self.state = 429
            self.match(LaTeXParser.R_BRACE)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Func_argContext(ParserRuleContext):

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

        def expr(self):
            return self.getTypedRuleContext(LaTeXParser.ExprContext,0)


        def func_arg(self):
            return self.getTypedRuleContext(LaTeXParser.Func_argContext,0)


        def getRuleIndex(self):
            return LaTeXParser.RULE_func_arg




    def func_arg(self):

        localctx = LaTeXParser.Func_argContext(self, self._ctx, self.state)
        self.enterRule(localctx, 68, self.RULE_func_arg)
        try:
            self.state = 436
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,41,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 431
                self.expr()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 432
                self.expr()
                self.state = 433
                self.match(LaTeXParser.T__0)
                self.state = 434
                self.func_arg()
                pass


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


    class Func_arg_noparensContext(ParserRuleContext):

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

        def mp_nofunc(self):
            return self.getTypedRuleContext(LaTeXParser.Mp_nofuncContext,0)


        def getRuleIndex(self):
            return LaTeXParser.RULE_func_arg_noparens




    def func_arg_noparens(self):

        localctx = LaTeXParser.Func_arg_noparensContext(self, self._ctx, self.state)
        self.enterRule(localctx, 70, self.RULE_func_arg_noparens)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 438
            self.mp_nofunc(0)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class SubexprContext(ParserRuleContext):

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

        def UNDERSCORE(self):
            return self.getToken(LaTeXParser.UNDERSCORE, 0)

        def atom(self):
            return self.getTypedRuleContext(LaTeXParser.AtomContext,0)


        def L_BRACE(self):
            return self.getToken(LaTeXParser.L_BRACE, 0)

        def expr(self):
            return self.getTypedRuleContext(LaTeXParser.ExprContext,0)


        def R_BRACE(self):
            return self.getToken(LaTeXParser.R_BRACE, 0)

        def getRuleIndex(self):
            return LaTeXParser.RULE_subexpr




    def subexpr(self):

        localctx = LaTeXParser.SubexprContext(self, self._ctx, self.state)
        self.enterRule(localctx, 72, self.RULE_subexpr)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 440
            self.match(LaTeXParser.UNDERSCORE)
            self.state = 446
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [LaTeXParser.BAR, LaTeXParser.L_BAR, LaTeXParser.L_ANGLE, LaTeXParser.CMD_MATHIT, LaTeXParser.DIFFERENTIAL, LaTeXParser.LETTER, LaTeXParser.NUMBER, LaTeXParser.SYMBOL]:
                self.state = 441
                self.atom()
                pass
            elif token in [LaTeXParser.L_BRACE]:
                self.state = 442
                self.match(LaTeXParser.L_BRACE)
                self.state = 443
                self.expr()
                self.state = 444
                self.match(LaTeXParser.R_BRACE)
                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 SupexprContext(ParserRuleContext):

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

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

        def atom(self):
            return self.getTypedRuleContext(LaTeXParser.AtomContext,0)


        def L_BRACE(self):
            return self.getToken(LaTeXParser.L_BRACE, 0)

        def expr(self):
            return self.getTypedRuleContext(LaTeXParser.ExprContext,0)


        def R_BRACE(self):
            return self.getToken(LaTeXParser.R_BRACE, 0)

        def getRuleIndex(self):
            return LaTeXParser.RULE_supexpr




    def supexpr(self):

        localctx = LaTeXParser.SupexprContext(self, self._ctx, self.state)
        self.enterRule(localctx, 74, self.RULE_supexpr)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 448
            self.match(LaTeXParser.CARET)
            self.state = 454
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [LaTeXParser.BAR, LaTeXParser.L_BAR, LaTeXParser.L_ANGLE, LaTeXParser.CMD_MATHIT, LaTeXParser.DIFFERENTIAL, LaTeXParser.LETTER, LaTeXParser.NUMBER, LaTeXParser.SYMBOL]:
                self.state = 449
                self.atom()
                pass
            elif token in [LaTeXParser.L_BRACE]:
                self.state = 450
                self.match(LaTeXParser.L_BRACE)
                self.state = 451
                self.expr()
                self.state = 452
                self.match(LaTeXParser.R_BRACE)
                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 SubeqContext(ParserRuleContext):

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

        def UNDERSCORE(self):
            return self.getToken(LaTeXParser.UNDERSCORE, 0)

        def L_BRACE(self):
            return self.getToken(LaTeXParser.L_BRACE, 0)

        def equality(self):
            return self.getTypedRuleContext(LaTeXParser.EqualityContext,0)


        def R_BRACE(self):
            return self.getToken(LaTeXParser.R_BRACE, 0)

        def getRuleIndex(self):
            return LaTeXParser.RULE_subeq




    def subeq(self):

        localctx = LaTeXParser.SubeqContext(self, self._ctx, self.state)
        self.enterRule(localctx, 76, self.RULE_subeq)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 456
            self.match(LaTeXParser.UNDERSCORE)
            self.state = 457
            self.match(LaTeXParser.L_BRACE)
            self.state = 458
            self.equality()
            self.state = 459
            self.match(LaTeXParser.R_BRACE)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class SupeqContext(ParserRuleContext):

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

        def UNDERSCORE(self):
            return self.getToken(LaTeXParser.UNDERSCORE, 0)

        def L_BRACE(self):
            return self.getToken(LaTeXParser.L_BRACE, 0)

        def equality(self):
            return self.getTypedRuleContext(LaTeXParser.EqualityContext,0)


        def R_BRACE(self):
            return self.getToken(LaTeXParser.R_BRACE, 0)

        def getRuleIndex(self):
            return LaTeXParser.RULE_supeq




    def supeq(self):

        localctx = LaTeXParser.SupeqContext(self, self._ctx, self.state)
        self.enterRule(localctx, 78, self.RULE_supeq)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 461
            self.match(LaTeXParser.UNDERSCORE)
            self.state = 462
            self.match(LaTeXParser.L_BRACE)
            self.state = 463
            self.equality()
            self.state = 464
            self.match(LaTeXParser.R_BRACE)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx



    def sempred(self, localctx, ruleIndex, predIndex):
        if self._predicates == None:
            self._predicates = dict()
        self._predicates[1] = self.relation_sempred
        self._predicates[4] = self.additive_sempred
        self._predicates[5] = self.mp_sempred
        self._predicates[6] = self.mp_nofunc_sempred
        self._predicates[15] = self.exp_sempred
        self._predicates[16] = self.exp_nofunc_sempred
        pred = self._predicates.get(ruleIndex, None)
        if pred is None:
            raise Exception("No predicate with index:" + str(ruleIndex))
        else:
            return pred(localctx, predIndex)

    def relation_sempred(self, localctx, predIndex):
            if predIndex == 0:
                return self.precpred(self._ctx, 2)


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


    def mp_sempred(self, localctx, predIndex):
            if predIndex == 2:
                return self.precpred(self._ctx, 2)


    def mp_nofunc_sempred(self, localctx, predIndex):
            if predIndex == 3:
                return self.precpred(self._ctx, 2)


    def exp_sempred(self, localctx, predIndex):
            if predIndex == 4:
                return self.precpred(self._ctx, 2)


    def exp_nofunc_sempred(self, localctx, predIndex):
            if predIndex == 5:
                return self.precpred(self._ctx, 2)





