# Generated from C:/Git/Masterarbeit/src/sympy/parsing/latex\LaTeX.g4 by ANTLR 4.12.0
# encoding: utf-8
from antlr4 import *
from io import StringIO
import sys
if sys.version_info[1] > 5:
	from typing import TextIO
else:
	from typing.io import TextIO

def serializedATN():
    return [
        4,1,158,921,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,
        7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,
        13,2,14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,19,2,
        20,7,20,2,21,7,21,2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25,2,26,7,
        26,2,27,7,27,2,28,7,28,2,29,7,29,2,30,7,30,2,31,7,31,2,32,7,32,2,
        33,7,33,2,34,7,34,2,35,7,35,2,36,7,36,2,37,7,37,2,38,7,38,2,39,7,
        39,2,40,7,40,2,41,7,41,2,42,7,42,2,43,7,43,2,44,7,44,2,45,7,45,2,
        46,7,46,2,47,7,47,2,48,7,48,2,49,7,49,2,50,7,50,2,51,7,51,2,52,7,
        52,2,53,7,53,2,54,7,54,2,55,7,55,2,56,7,56,2,57,7,57,2,58,7,58,2,
        59,7,59,2,60,7,60,2,61,7,61,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
        1,1,3,1,135,8,1,1,1,1,1,1,1,5,1,140,8,1,10,1,12,1,143,9,1,1,2,1,
        2,1,2,5,2,148,8,2,10,2,12,2,151,9,2,1,3,1,3,1,4,1,4,1,5,1,5,3,5,
        159,8,5,1,6,1,6,1,6,1,6,5,6,165,8,6,10,6,12,6,168,9,6,1,6,1,6,1,
        6,1,6,1,6,1,6,1,6,1,6,3,6,178,8,6,1,6,1,6,3,6,182,8,6,1,6,3,6,185,
        8,6,1,6,1,6,3,6,189,8,6,1,6,1,6,1,6,3,6,194,8,6,1,6,1,6,1,6,3,6,
        199,8,6,1,7,1,7,1,7,3,7,204,8,7,1,8,1,8,1,8,1,8,3,8,210,8,8,1,8,
        1,8,1,8,5,8,215,8,8,10,8,12,8,218,9,8,1,9,1,9,1,9,1,9,1,10,1,10,
        1,10,5,10,227,8,10,10,10,12,10,230,9,10,1,10,1,10,1,11,3,11,235,
        8,11,1,11,1,11,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,
        1,12,1,12,1,12,1,12,1,12,1,12,5,12,255,8,12,10,12,12,12,258,9,12,
        1,12,3,12,261,8,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,
        1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,
        1,12,1,12,5,12,287,8,12,10,12,12,12,290,9,12,1,12,1,12,1,12,1,12,
        1,12,1,12,3,12,298,8,12,1,12,1,12,1,12,1,12,1,12,3,12,305,8,12,1,
        13,1,13,3,13,309,8,13,1,13,3,13,312,8,13,1,13,1,13,3,13,316,8,13,
        1,14,1,14,1,14,5,14,321,8,14,10,14,12,14,324,9,14,1,15,1,15,1,15,
        5,15,329,8,15,10,15,12,15,332,9,15,1,16,1,16,1,16,5,16,337,8,16,
        10,16,12,16,340,9,16,1,17,1,17,1,17,1,17,1,17,1,17,5,17,348,8,17,
        10,17,12,17,351,9,17,1,18,1,18,1,18,1,18,1,18,1,18,5,18,359,8,18,
        10,18,12,18,362,9,18,1,19,1,19,1,19,1,19,1,19,1,19,5,19,370,8,19,
        10,19,12,19,373,9,19,1,20,1,20,1,20,1,20,1,20,1,20,5,20,381,8,20,
        10,20,12,20,384,9,20,1,21,1,21,1,21,1,21,1,21,1,21,1,21,1,21,1,21,
        1,21,1,21,1,21,4,21,398,8,21,11,21,12,21,399,3,21,402,8,21,1,22,
        1,22,1,22,1,22,5,22,408,8,22,10,22,12,22,411,9,22,3,22,413,8,22,
        1,23,1,23,5,23,417,8,23,10,23,12,23,420,9,23,1,24,1,24,5,24,424,
        8,24,10,24,12,24,427,9,24,1,25,1,25,3,25,431,8,25,1,26,1,26,1,26,
        1,26,1,26,1,26,3,26,439,8,26,1,27,1,27,1,27,1,27,3,27,445,8,27,1,
        27,1,27,1,28,1,28,1,28,1,28,3,28,453,8,28,1,28,1,28,1,29,1,29,1,
        29,1,29,1,29,1,29,1,29,1,29,1,29,1,29,3,29,467,8,29,1,29,3,29,470,
        8,29,5,29,472,8,29,10,29,12,29,475,9,29,1,30,1,30,1,30,1,30,1,30,
        1,30,1,30,1,30,1,30,1,30,3,30,487,8,30,1,30,3,30,490,8,30,5,30,492,
        8,30,10,30,12,30,495,9,30,1,31,1,31,1,31,1,31,1,31,1,31,3,31,503,
        8,31,1,32,1,32,1,32,1,32,1,32,3,32,510,8,32,1,33,1,33,1,33,1,33,
        1,33,1,33,1,33,1,33,3,33,520,8,33,1,33,3,33,523,8,33,1,33,1,33,1,
        33,1,33,1,33,1,33,1,33,1,33,3,33,533,8,33,1,34,1,34,1,34,1,34,1,
        34,1,34,1,34,1,34,3,34,543,8,34,1,35,4,35,546,8,35,11,35,12,35,547,
        1,35,1,35,1,35,1,35,5,35,554,8,35,10,35,12,35,557,9,35,1,35,1,35,
        4,35,561,8,35,11,35,12,35,562,3,35,565,8,35,1,35,3,35,568,8,35,1,
        36,1,36,1,37,1,37,1,37,1,37,1,37,1,38,1,38,1,38,1,38,4,38,581,8,
        38,11,38,12,38,582,1,38,1,38,1,39,1,39,1,39,3,39,590,8,39,1,39,3,
        39,593,8,39,1,39,3,39,596,8,39,1,39,3,39,599,8,39,3,39,601,8,39,
        1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,
        1,39,1,39,3,39,618,8,39,1,40,1,40,1,40,1,40,3,40,624,8,40,1,40,1,
        40,1,40,1,40,3,40,630,8,40,1,40,1,40,1,40,1,40,3,40,636,8,40,1,40,
        1,40,1,41,1,41,1,41,1,41,1,42,1,42,1,42,1,42,1,43,1,43,1,43,1,43,
        1,44,1,44,1,44,1,44,1,44,1,45,5,45,658,8,45,10,45,12,45,661,9,45,
        1,46,1,46,1,46,1,46,1,46,1,46,3,46,669,8,46,1,46,1,46,1,46,1,46,
        1,46,1,46,3,46,677,8,46,1,46,1,46,1,46,1,46,1,46,1,46,3,46,685,8,
        46,1,47,1,47,1,47,1,47,1,47,1,47,1,47,1,47,1,48,1,48,1,48,1,48,1,
        49,1,49,1,49,1,49,1,50,1,50,1,51,1,51,1,52,1,52,1,53,3,53,710,8,
        53,1,53,1,53,3,53,714,8,53,1,53,3,53,717,8,53,1,53,3,53,720,8,53,
        1,53,3,53,723,8,53,3,53,725,8,53,1,53,1,53,1,53,1,53,1,53,3,53,732,
        8,53,1,53,1,53,1,53,1,53,1,53,1,53,3,53,740,8,53,1,53,1,53,1,53,
        1,53,1,53,1,53,1,53,1,53,1,53,3,53,751,8,53,1,53,3,53,754,8,53,1,
        53,1,53,1,53,1,53,1,53,1,53,1,53,3,53,763,8,53,1,53,3,53,766,8,53,
        1,53,3,53,769,8,53,3,53,771,8,53,1,53,3,53,774,8,53,1,53,1,53,1,
        53,1,53,1,53,1,53,1,53,1,53,1,53,1,53,1,53,3,53,787,8,53,1,53,3,
        53,790,8,53,1,53,1,53,1,53,3,53,795,8,53,1,53,1,53,1,53,1,53,1,53,
        3,53,802,8,53,1,53,1,53,1,53,1,53,1,53,1,53,1,53,1,53,1,53,1,53,
        1,53,1,53,1,53,1,53,1,53,1,53,1,53,3,53,821,8,53,1,53,1,53,1,53,
        1,53,1,53,1,53,3,53,829,8,53,1,53,1,53,3,53,833,8,53,1,53,1,53,1,
        53,3,53,838,8,53,1,53,1,53,1,53,1,53,1,53,3,53,845,8,53,1,54,1,54,
        1,54,1,54,1,54,3,54,852,8,54,1,55,1,55,1,55,1,55,1,55,1,55,1,55,
        1,55,1,55,1,55,1,55,3,55,865,8,55,3,55,867,8,55,1,55,1,55,1,56,1,
        56,1,56,1,56,1,56,3,56,876,8,56,1,57,1,57,1,58,1,58,1,58,1,58,1,
        58,3,58,885,8,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,3,58,895,
        8,58,1,59,1,59,1,59,1,59,1,59,1,59,3,59,903,8,59,1,60,1,60,1,60,
        1,60,1,60,3,60,910,8,60,3,60,912,8,60,1,60,1,60,1,61,1,61,1,61,1,
        61,1,61,1,61,0,8,2,16,34,36,38,40,58,60,62,0,2,4,6,8,10,12,14,16,
        18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,
        62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,
        104,106,108,110,112,114,116,118,120,122,0,29,1,0,93,94,3,0,117,117,
        119,119,158,158,2,0,39,40,45,46,2,0,128,128,155,155,3,0,47,47,114,
        114,145,145,3,0,130,134,137,138,141,143,1,0,1,3,2,0,4,6,128,128,
        1,0,4,6,1,0,8,10,2,0,48,48,158,158,4,0,33,34,38,38,109,110,118,118,
        3,0,35,37,102,104,114,114,3,0,35,36,102,104,114,114,1,0,33,34,1,
        0,13,17,5,0,4,6,19,19,121,121,128,128,155,155,2,0,39,39,45,45,2,
        0,40,40,46,46,2,0,47,47,49,49,2,0,47,47,50,50,1,0,106,108,2,0,64,
        85,90,92,2,0,86,86,88,88,2,0,39,39,41,41,2,0,40,40,42,42,3,0,121,
        121,128,128,155,155,1,0,62,63,1,0,56,59,1013,0,124,1,0,0,0,2,134,
        1,0,0,0,4,144,1,0,0,0,6,152,1,0,0,0,8,154,1,0,0,0,10,156,1,0,0,0,
        12,198,1,0,0,0,14,200,1,0,0,0,16,209,1,0,0,0,18,219,1,0,0,0,20,223,
        1,0,0,0,22,234,1,0,0,0,24,304,1,0,0,0,26,306,1,0,0,0,28,317,1,0,
        0,0,30,325,1,0,0,0,32,333,1,0,0,0,34,341,1,0,0,0,36,352,1,0,0,0,
        38,363,1,0,0,0,40,374,1,0,0,0,42,401,1,0,0,0,44,412,1,0,0,0,46,414,
        1,0,0,0,48,421,1,0,0,0,50,430,1,0,0,0,52,432,1,0,0,0,54,440,1,0,
        0,0,56,448,1,0,0,0,58,456,1,0,0,0,60,476,1,0,0,0,62,502,1,0,0,0,
        64,509,1,0,0,0,66,532,1,0,0,0,68,542,1,0,0,0,70,545,1,0,0,0,72,569,
        1,0,0,0,74,571,1,0,0,0,76,576,1,0,0,0,78,617,1,0,0,0,80,619,1,0,
        0,0,82,639,1,0,0,0,84,643,1,0,0,0,86,647,1,0,0,0,88,651,1,0,0,0,
        90,659,1,0,0,0,92,684,1,0,0,0,94,686,1,0,0,0,96,694,1,0,0,0,98,698,
        1,0,0,0,100,702,1,0,0,0,102,704,1,0,0,0,104,706,1,0,0,0,106,844,
        1,0,0,0,108,851,1,0,0,0,110,853,1,0,0,0,112,875,1,0,0,0,114,877,
        1,0,0,0,116,879,1,0,0,0,118,896,1,0,0,0,120,904,1,0,0,0,122,915,
        1,0,0,0,124,125,3,2,1,0,125,1,1,0,0,0,126,127,6,1,-1,0,127,128,5,
        45,0,0,128,129,3,2,1,0,129,130,7,0,0,0,130,131,3,2,1,0,131,132,5,
        46,0,0,132,135,1,0,0,0,133,135,3,4,2,0,134,126,1,0,0,0,134,133,1,
        0,0,0,135,141,1,0,0,0,136,137,10,3,0,0,137,138,7,0,0,0,138,140,3,
        2,1,4,139,136,1,0,0,0,140,143,1,0,0,0,141,139,1,0,0,0,141,142,1,
        0,0,0,142,3,1,0,0,0,143,141,1,0,0,0,144,149,3,16,8,0,145,146,7,1,
        0,0,146,148,3,16,8,0,147,145,1,0,0,0,148,151,1,0,0,0,149,147,1,0,
        0,0,149,150,1,0,0,0,150,5,1,0,0,0,151,149,1,0,0,0,152,153,7,2,0,
        0,153,7,1,0,0,0,154,155,7,2,0,0,155,9,1,0,0,0,156,158,7,3,0,0,157,
        159,3,14,7,0,158,157,1,0,0,0,158,159,1,0,0,0,159,11,1,0,0,0,160,
        161,5,43,0,0,161,166,3,78,39,0,162,163,5,158,0,0,163,165,3,78,39,
        0,164,162,1,0,0,0,165,168,1,0,0,0,166,164,1,0,0,0,166,167,1,0,0,
        0,167,169,1,0,0,0,168,166,1,0,0,0,169,170,5,44,0,0,170,199,1,0,0,
        0,171,172,5,43,0,0,172,173,3,10,5,0,173,174,7,4,0,0,174,175,3,4,
        2,0,175,178,1,0,0,0,176,178,5,44,0,0,177,171,1,0,0,0,177,176,1,0,
        0,0,178,199,1,0,0,0,179,181,5,150,0,0,180,182,3,116,58,0,181,180,
        1,0,0,0,181,182,1,0,0,0,182,184,1,0,0,0,183,185,3,118,59,0,184,183,
        1,0,0,0,184,185,1,0,0,0,185,199,1,0,0,0,186,188,3,6,3,0,187,189,
        5,34,0,0,188,187,1,0,0,0,188,189,1,0,0,0,189,190,1,0,0,0,190,191,
        3,78,39,0,191,193,5,158,0,0,192,194,5,34,0,0,193,192,1,0,0,0,193,
        194,1,0,0,0,194,195,1,0,0,0,195,196,3,78,39,0,196,197,3,8,4,0,197,
        199,1,0,0,0,198,160,1,0,0,0,198,177,1,0,0,0,198,179,1,0,0,0,198,
        186,1,0,0,0,199,13,1,0,0,0,200,203,5,154,0,0,201,204,3,12,6,0,202,
        204,5,128,0,0,203,201,1,0,0,0,203,202,1,0,0,0,204,15,1,0,0,0,205,
        206,6,8,-1,0,206,210,3,12,6,0,207,210,3,22,11,0,208,210,3,10,5,0,
        209,205,1,0,0,0,209,207,1,0,0,0,209,208,1,0,0,0,210,216,1,0,0,0,
        211,212,10,4,0,0,212,213,7,5,0,0,213,215,3,16,8,5,214,211,1,0,0,
        0,215,218,1,0,0,0,216,214,1,0,0,0,216,217,1,0,0,0,217,17,1,0,0,0,
        218,216,1,0,0,0,219,220,3,22,11,0,220,221,5,131,0,0,221,222,3,22,
        11,0,222,19,1,0,0,0,223,224,7,6,0,0,224,228,5,41,0,0,225,227,7,7,
        0,0,226,225,1,0,0,0,227,230,1,0,0,0,228,226,1,0,0,0,228,229,1,0,
        0,0,229,231,1,0,0,0,230,228,1,0,0,0,231,232,5,42,0,0,232,21,1,0,
        0,0,233,235,5,120,0,0,234,233,1,0,0,0,234,235,1,0,0,0,235,236,1,
        0,0,0,236,237,3,34,17,0,237,23,1,0,0,0,238,239,5,147,0,0,239,240,
        5,41,0,0,240,241,5,7,0,0,241,242,5,42,0,0,242,243,3,28,14,0,243,
        244,5,148,0,0,244,245,5,41,0,0,245,246,5,7,0,0,246,247,5,42,0,0,
        247,305,1,0,0,0,248,249,5,147,0,0,249,250,5,41,0,0,250,251,5,8,0,
        0,251,260,5,42,0,0,252,256,5,41,0,0,253,255,7,8,0,0,254,253,1,0,
        0,0,255,258,1,0,0,0,256,254,1,0,0,0,256,257,1,0,0,0,257,259,1,0,
        0,0,258,256,1,0,0,0,259,261,5,42,0,0,260,252,1,0,0,0,260,261,1,0,
        0,0,261,262,1,0,0,0,262,263,3,30,15,0,263,264,5,148,0,0,264,265,
        5,41,0,0,265,266,5,8,0,0,266,267,5,42,0,0,267,305,1,0,0,0,268,269,
        5,147,0,0,269,270,5,41,0,0,270,271,7,9,0,0,271,272,5,42,0,0,272,
        273,3,30,15,0,273,274,5,148,0,0,274,275,5,41,0,0,275,276,7,9,0,0,
        276,277,5,42,0,0,277,305,1,0,0,0,278,279,5,11,0,0,279,280,3,32,16,
        0,280,288,5,46,0,0,281,282,5,158,0,0,282,283,5,45,0,0,283,284,3,
        32,16,0,284,285,5,46,0,0,285,287,1,0,0,0,286,281,1,0,0,0,287,290,
        1,0,0,0,288,286,1,0,0,0,288,289,1,0,0,0,289,291,1,0,0,0,290,288,
        1,0,0,0,291,292,5,46,0,0,292,305,1,0,0,0,293,294,5,156,0,0,294,295,
        3,22,11,0,295,297,5,156,0,0,296,298,3,116,58,0,297,296,1,0,0,0,297,
        298,1,0,0,0,298,305,1,0,0,0,299,300,5,47,0,0,300,301,3,22,11,0,301,
        302,5,47,0,0,302,303,3,116,58,0,303,305,1,0,0,0,304,238,1,0,0,0,
        304,248,1,0,0,0,304,268,1,0,0,0,304,278,1,0,0,0,304,293,1,0,0,0,
        304,299,1,0,0,0,305,25,1,0,0,0,306,308,3,22,11,0,307,309,5,48,0,
        0,308,307,1,0,0,0,308,309,1,0,0,0,309,315,1,0,0,0,310,312,5,123,
        0,0,311,310,1,0,0,0,311,312,1,0,0,0,312,313,1,0,0,0,313,316,3,16,
        8,0,314,316,5,124,0,0,315,311,1,0,0,0,315,314,1,0,0,0,316,27,1,0,
        0,0,317,322,3,26,13,0,318,319,5,12,0,0,319,321,3,26,13,0,320,318,
        1,0,0,0,321,324,1,0,0,0,322,320,1,0,0,0,322,323,1,0,0,0,323,29,1,
        0,0,0,324,322,1,0,0,0,325,330,3,32,16,0,326,327,5,12,0,0,327,329,
        3,32,16,0,328,326,1,0,0,0,329,332,1,0,0,0,330,328,1,0,0,0,330,331,
        1,0,0,0,331,31,1,0,0,0,332,330,1,0,0,0,333,338,3,22,11,0,334,335,
        7,10,0,0,335,337,3,22,11,0,336,334,1,0,0,0,337,340,1,0,0,0,338,336,
        1,0,0,0,338,339,1,0,0,0,339,33,1,0,0,0,340,338,1,0,0,0,341,342,6,
        17,-1,0,342,343,3,36,18,0,343,349,1,0,0,0,344,345,10,2,0,0,345,346,
        7,11,0,0,346,348,3,34,17,3,347,344,1,0,0,0,348,351,1,0,0,0,349,347,
        1,0,0,0,349,350,1,0,0,0,350,35,1,0,0,0,351,349,1,0,0,0,352,353,6,
        18,-1,0,353,354,3,38,19,0,354,360,1,0,0,0,355,356,10,2,0,0,356,357,
        7,12,0,0,357,359,3,36,18,3,358,355,1,0,0,0,359,362,1,0,0,0,360,358,
        1,0,0,0,360,361,1,0,0,0,361,37,1,0,0,0,362,360,1,0,0,0,363,364,6,
        19,-1,0,364,365,3,42,21,0,365,371,1,0,0,0,366,367,10,2,0,0,367,368,
        5,152,0,0,368,370,3,38,19,3,369,366,1,0,0,0,370,373,1,0,0,0,371,
        369,1,0,0,0,371,372,1,0,0,0,372,39,1,0,0,0,373,371,1,0,0,0,374,375,
        6,20,-1,0,375,376,3,44,22,0,376,382,1,0,0,0,377,378,10,2,0,0,378,
        379,7,13,0,0,379,381,3,40,20,3,380,377,1,0,0,0,381,384,1,0,0,0,382,
        380,1,0,0,0,382,383,1,0,0,0,383,41,1,0,0,0,384,382,1,0,0,0,385,386,
        7,14,0,0,386,402,3,42,21,0,387,388,5,128,0,0,388,389,5,153,0,0,389,
        402,5,128,0,0,390,391,5,41,0,0,391,392,3,22,11,0,392,393,5,153,0,
        0,393,394,3,22,11,0,394,395,5,42,0,0,395,402,1,0,0,0,396,398,3,46,
        23,0,397,396,1,0,0,0,398,399,1,0,0,0,399,397,1,0,0,0,399,400,1,0,
        0,0,400,402,1,0,0,0,401,385,1,0,0,0,401,387,1,0,0,0,401,390,1,0,
        0,0,401,397,1,0,0,0,402,43,1,0,0,0,403,404,7,14,0,0,404,413,3,44,
        22,0,405,409,3,46,23,0,406,408,3,48,24,0,407,406,1,0,0,0,408,411,
        1,0,0,0,409,407,1,0,0,0,409,410,1,0,0,0,410,413,1,0,0,0,411,409,
        1,0,0,0,412,403,1,0,0,0,412,405,1,0,0,0,413,45,1,0,0,0,414,418,3,
        58,29,0,415,417,3,50,25,0,416,415,1,0,0,0,417,420,1,0,0,0,418,416,
        1,0,0,0,418,419,1,0,0,0,419,47,1,0,0,0,420,418,1,0,0,0,421,425,3,
        60,30,0,422,424,3,50,25,0,423,422,1,0,0,0,424,427,1,0,0,0,425,423,
        1,0,0,0,425,426,1,0,0,0,426,49,1,0,0,0,427,425,1,0,0,0,428,431,5,
        144,0,0,429,431,3,52,26,0,430,428,1,0,0,0,430,429,1,0,0,0,431,51,
        1,0,0,0,432,438,5,47,0,0,433,439,3,56,28,0,434,439,3,54,27,0,435,
        436,3,56,28,0,436,437,3,54,27,0,437,439,1,0,0,0,438,433,1,0,0,0,
        438,434,1,0,0,0,438,435,1,0,0,0,439,53,1,0,0,0,440,441,5,112,0,0,
        441,444,5,41,0,0,442,445,3,22,11,0,443,445,3,18,9,0,444,442,1,0,
        0,0,444,443,1,0,0,0,445,446,1,0,0,0,446,447,5,42,0,0,447,55,1,0,
        0,0,448,449,5,113,0,0,449,452,5,41,0,0,450,453,3,22,11,0,451,453,
        3,18,9,0,452,450,1,0,0,0,452,451,1,0,0,0,453,454,1,0,0,0,454,455,
        5,42,0,0,455,57,1,0,0,0,456,457,6,29,-1,0,457,458,3,62,31,0,458,
        473,1,0,0,0,459,460,10,2,0,0,460,466,5,113,0,0,461,467,3,78,39,0,
        462,463,5,41,0,0,463,464,3,22,11,0,464,465,5,42,0,0,465,467,1,0,
        0,0,466,461,1,0,0,0,466,462,1,0,0,0,467,469,1,0,0,0,468,470,3,116,
        58,0,469,468,1,0,0,0,469,470,1,0,0,0,470,472,1,0,0,0,471,459,1,0,
        0,0,472,475,1,0,0,0,473,471,1,0,0,0,473,474,1,0,0,0,474,59,1,0,0,
        0,475,473,1,0,0,0,476,477,6,30,-1,0,477,478,3,64,32,0,478,493,1,
        0,0,0,479,480,10,2,0,0,480,486,5,113,0,0,481,487,3,78,39,0,482,483,
        5,41,0,0,483,484,3,22,11,0,484,485,5,42,0,0,485,487,1,0,0,0,486,
        481,1,0,0,0,486,482,1,0,0,0,487,489,1,0,0,0,488,490,3,116,58,0,489,
        488,1,0,0,0,489,490,1,0,0,0,490,492,1,0,0,0,491,479,1,0,0,0,492,
        495,1,0,0,0,493,491,1,0,0,0,493,494,1,0,0,0,494,61,1,0,0,0,495,493,
        1,0,0,0,496,503,3,66,33,0,497,503,3,68,34,0,498,503,3,106,53,0,499,
        503,3,78,39,0,500,503,3,96,48,0,501,503,3,98,49,0,502,496,1,0,0,
        0,502,497,1,0,0,0,502,498,1,0,0,0,502,499,1,0,0,0,502,500,1,0,0,
        0,502,501,1,0,0,0,503,63,1,0,0,0,504,510,3,66,33,0,505,510,3,68,
        34,0,506,510,3,78,39,0,507,510,3,96,48,0,508,510,3,98,49,0,509,504,
        1,0,0,0,509,505,1,0,0,0,509,506,1,0,0,0,509,507,1,0,0,0,509,508,
        1,0,0,0,510,65,1,0,0,0,511,512,5,39,0,0,512,513,3,22,11,0,513,514,
        5,40,0,0,514,533,1,0,0,0,515,516,5,45,0,0,516,517,3,22,11,0,517,
        519,5,46,0,0,518,520,5,146,0,0,519,518,1,0,0,0,519,520,1,0,0,0,520,
        533,1,0,0,0,521,523,7,15,0,0,522,521,1,0,0,0,522,523,1,0,0,0,523,
        524,1,0,0,0,524,525,5,41,0,0,525,526,3,22,11,0,526,527,5,42,0,0,
        527,533,1,0,0,0,528,529,5,43,0,0,529,530,3,22,11,0,530,531,5,44,
        0,0,531,533,1,0,0,0,532,511,1,0,0,0,532,515,1,0,0,0,532,522,1,0,
        0,0,532,528,1,0,0,0,533,67,1,0,0,0,534,535,5,47,0,0,535,536,3,22,
        11,0,536,537,5,47,0,0,537,543,1,0,0,0,538,539,5,53,0,0,539,540,3,
        22,11,0,540,541,5,54,0,0,541,543,1,0,0,0,542,534,1,0,0,0,542,538,
        1,0,0,0,543,69,1,0,0,0,544,546,5,129,0,0,545,544,1,0,0,0,546,547,
        1,0,0,0,547,545,1,0,0,0,547,548,1,0,0,0,548,555,1,0,0,0,549,550,
        5,158,0,0,550,551,5,129,0,0,551,552,5,129,0,0,552,554,5,129,0,0,
        553,549,1,0,0,0,554,557,1,0,0,0,555,553,1,0,0,0,555,556,1,0,0,0,
        556,564,1,0,0,0,557,555,1,0,0,0,558,560,5,18,0,0,559,561,5,129,0,
        0,560,559,1,0,0,0,561,562,1,0,0,0,562,560,1,0,0,0,562,563,1,0,0,
        0,563,565,1,0,0,0,564,558,1,0,0,0,564,565,1,0,0,0,565,567,1,0,0,
        0,566,568,5,116,0,0,567,566,1,0,0,0,567,568,1,0,0,0,568,71,1,0,0,
        0,569,570,5,93,0,0,570,73,1,0,0,0,571,572,5,31,0,0,572,573,5,41,
        0,0,573,574,3,22,11,0,574,575,5,42,0,0,575,75,1,0,0,0,576,577,5,
        39,0,0,577,580,3,22,11,0,578,579,5,158,0,0,579,581,3,22,11,0,580,
        578,1,0,0,0,581,582,1,0,0,0,582,580,1,0,0,0,582,583,1,0,0,0,583,
        584,1,0,0,0,584,585,5,40,0,0,585,77,1,0,0,0,586,618,3,92,46,0,587,
        600,7,16,0,0,588,590,3,116,58,0,589,588,1,0,0,0,589,590,1,0,0,0,
        590,592,1,0,0,0,591,593,5,146,0,0,592,591,1,0,0,0,592,593,1,0,0,
        0,593,601,1,0,0,0,594,596,5,146,0,0,595,594,1,0,0,0,595,596,1,0,
        0,0,596,598,1,0,0,0,597,599,3,116,58,0,598,597,1,0,0,0,598,599,1,
        0,0,0,599,601,1,0,0,0,600,589,1,0,0,0,600,595,1,0,0,0,601,618,1,
        0,0,0,602,618,5,126,0,0,603,618,3,24,12,0,604,618,3,70,35,0,605,
        618,5,127,0,0,606,618,3,88,44,0,607,618,3,94,47,0,608,618,3,84,42,
        0,609,618,3,82,41,0,610,618,3,86,43,0,611,618,3,74,37,0,612,618,
        5,157,0,0,613,618,5,149,0,0,614,618,3,20,10,0,615,618,3,76,38,0,
        616,618,5,115,0,0,617,586,1,0,0,0,617,587,1,0,0,0,617,602,1,0,0,
        0,617,603,1,0,0,0,617,604,1,0,0,0,617,605,1,0,0,0,617,606,1,0,0,
        0,617,607,1,0,0,0,617,608,1,0,0,0,617,609,1,0,0,0,617,610,1,0,0,
        0,617,611,1,0,0,0,617,612,1,0,0,0,617,613,1,0,0,0,617,614,1,0,0,
        0,617,615,1,0,0,0,617,616,1,0,0,0,618,79,1,0,0,0,619,620,5,89,0,
        0,620,635,7,17,0,0,621,623,5,128,0,0,622,624,3,116,58,0,623,622,
        1,0,0,0,623,624,1,0,0,0,624,636,1,0,0,0,625,626,5,128,0,0,626,627,
        5,131,0,0,627,629,5,128,0,0,628,630,3,116,58,0,629,628,1,0,0,0,629,
        630,1,0,0,0,630,636,1,0,0,0,631,632,3,78,39,0,632,633,5,47,0,0,633,
        634,3,78,39,0,634,636,1,0,0,0,635,621,1,0,0,0,635,625,1,0,0,0,635,
        631,1,0,0,0,636,637,1,0,0,0,637,638,7,18,0,0,638,81,1,0,0,0,639,
        640,5,50,0,0,640,641,3,22,11,0,641,642,5,49,0,0,642,83,1,0,0,0,643,
        644,5,51,0,0,644,645,3,22,11,0,645,646,7,19,0,0,646,85,1,0,0,0,647,
        648,7,20,0,0,648,649,3,22,11,0,649,650,5,52,0,0,650,87,1,0,0,0,651,
        652,5,111,0,0,652,653,5,41,0,0,653,654,3,90,45,0,654,655,5,42,0,
        0,655,89,1,0,0,0,656,658,5,128,0,0,657,656,1,0,0,0,658,661,1,0,0,
        0,659,657,1,0,0,0,659,660,1,0,0,0,660,91,1,0,0,0,661,659,1,0,0,0,
        662,668,5,105,0,0,663,669,5,129,0,0,664,665,5,41,0,0,665,666,3,22,
        11,0,666,667,5,42,0,0,667,669,1,0,0,0,668,663,1,0,0,0,668,664,1,
        0,0,0,669,676,1,0,0,0,670,677,5,129,0,0,671,677,7,7,0,0,672,673,
        5,41,0,0,673,674,3,22,11,0,674,675,5,42,0,0,675,677,1,0,0,0,676,
        670,1,0,0,0,676,671,1,0,0,0,676,672,1,0,0,0,677,685,1,0,0,0,678,
        679,5,41,0,0,679,680,3,22,11,0,680,681,5,101,0,0,681,682,3,22,11,
        0,682,683,5,42,0,0,683,685,1,0,0,0,684,662,1,0,0,0,684,678,1,0,0,
        0,685,93,1,0,0,0,686,687,7,21,0,0,687,688,5,41,0,0,688,689,3,22,
        11,0,689,690,5,42,0,0,690,691,5,41,0,0,691,692,3,22,11,0,692,693,
        5,42,0,0,693,95,1,0,0,0,694,695,5,95,0,0,695,696,3,22,11,0,696,697,
        5,96,0,0,697,97,1,0,0,0,698,699,5,97,0,0,699,700,3,22,11,0,700,701,
        5,98,0,0,701,99,1,0,0,0,702,703,7,22,0,0,703,101,1,0,0,0,704,705,
        7,23,0,0,705,103,1,0,0,0,706,707,5,87,0,0,707,105,1,0,0,0,708,710,
        5,125,0,0,709,708,1,0,0,0,709,710,1,0,0,0,710,828,1,0,0,0,711,724,
        3,100,50,0,712,714,3,116,58,0,713,712,1,0,0,0,713,714,1,0,0,0,714,
        716,1,0,0,0,715,717,3,118,59,0,716,715,1,0,0,0,716,717,1,0,0,0,717,
        725,1,0,0,0,718,720,3,118,59,0,719,718,1,0,0,0,719,720,1,0,0,0,720,
        722,1,0,0,0,721,723,3,116,58,0,722,721,1,0,0,0,722,723,1,0,0,0,723,
        725,1,0,0,0,724,713,1,0,0,0,724,719,1,0,0,0,725,731,1,0,0,0,726,
        727,7,24,0,0,727,728,3,112,56,0,728,729,7,25,0,0,729,732,1,0,0,0,
        730,732,3,114,57,0,731,726,1,0,0,0,731,730,1,0,0,0,732,829,1,0,0,
        0,733,739,3,102,51,0,734,735,7,17,0,0,735,736,3,112,56,0,736,737,
        7,18,0,0,737,740,1,0,0,0,738,740,3,114,57,0,739,734,1,0,0,0,739,
        738,1,0,0,0,740,829,1,0,0,0,741,742,3,104,52,0,742,743,7,17,0,0,
        743,744,3,112,56,0,744,745,5,158,0,0,745,746,3,112,56,0,746,747,
        7,18,0,0,747,829,1,0,0,0,748,770,7,26,0,0,749,751,3,116,58,0,750,
        749,1,0,0,0,750,751,1,0,0,0,751,762,1,0,0,0,752,754,5,146,0,0,753,
        752,1,0,0,0,753,754,1,0,0,0,754,763,1,0,0,0,755,756,5,113,0,0,756,
        757,5,41,0,0,757,758,5,39,0,0,758,759,3,78,39,0,759,760,5,40,0,0,
        760,761,5,42,0,0,761,763,1,0,0,0,762,753,1,0,0,0,762,755,1,0,0,0,
        763,771,1,0,0,0,764,766,5,146,0,0,765,764,1,0,0,0,765,766,1,0,0,
        0,766,768,1,0,0,0,767,769,3,116,58,0,768,767,1,0,0,0,768,769,1,0,
        0,0,769,771,1,0,0,0,770,750,1,0,0,0,770,765,1,0,0,0,771,773,1,0,
        0,0,772,774,3,118,59,0,773,772,1,0,0,0,773,774,1,0,0,0,774,775,1,
        0,0,0,775,776,5,39,0,0,776,777,3,108,54,0,777,778,5,40,0,0,778,829,
        1,0,0,0,779,786,5,61,0,0,780,781,3,116,58,0,781,782,3,118,59,0,782,
        787,1,0,0,0,783,784,3,118,59,0,784,785,3,116,58,0,785,787,1,0,0,
        0,786,780,1,0,0,0,786,783,1,0,0,0,786,787,1,0,0,0,787,794,1,0,0,
        0,788,790,3,34,17,0,789,788,1,0,0,0,789,790,1,0,0,0,790,791,1,0,
        0,0,791,795,5,127,0,0,792,795,3,92,46,0,793,795,3,34,17,0,794,789,
        1,0,0,0,794,792,1,0,0,0,794,793,1,0,0,0,795,829,1,0,0,0,796,801,
        5,99,0,0,797,798,5,45,0,0,798,799,3,22,11,0,799,800,5,46,0,0,800,
        802,1,0,0,0,801,797,1,0,0,0,801,802,1,0,0,0,802,803,1,0,0,0,803,
        804,5,41,0,0,804,805,3,22,11,0,805,806,5,42,0,0,806,829,1,0,0,0,
        807,808,5,100,0,0,808,809,5,41,0,0,809,810,3,22,11,0,810,811,5,42,
        0,0,811,829,1,0,0,0,812,820,7,27,0,0,813,814,3,120,60,0,814,815,
        3,118,59,0,815,821,1,0,0,0,816,817,3,118,59,0,817,818,3,120,60,0,
        818,821,1,0,0,0,819,821,3,120,60,0,820,813,1,0,0,0,820,816,1,0,0,
        0,820,819,1,0,0,0,821,822,1,0,0,0,822,823,3,36,18,0,823,829,1,0,
        0,0,824,825,5,55,0,0,825,826,3,110,55,0,826,827,3,36,18,0,827,829,
        1,0,0,0,828,711,1,0,0,0,828,733,1,0,0,0,828,741,1,0,0,0,828,748,
        1,0,0,0,828,779,1,0,0,0,828,796,1,0,0,0,828,807,1,0,0,0,828,812,
        1,0,0,0,828,824,1,0,0,0,829,845,1,0,0,0,830,832,7,28,0,0,831,833,
        3,116,58,0,832,831,1,0,0,0,832,833,1,0,0,0,833,834,1,0,0,0,834,837,
        7,24,0,0,835,838,3,4,2,0,836,838,3,12,6,0,837,835,1,0,0,0,837,836,
        1,0,0,0,838,839,1,0,0,0,839,840,7,25,0,0,840,845,1,0,0,0,841,842,
        5,125,0,0,842,845,3,66,33,0,843,845,3,80,40,0,844,709,1,0,0,0,844,
        830,1,0,0,0,844,841,1,0,0,0,844,843,1,0,0,0,845,107,1,0,0,0,846,
        847,3,22,11,0,847,848,5,158,0,0,848,849,3,108,54,0,849,852,1,0,0,
        0,850,852,3,22,11,0,851,846,1,0,0,0,851,850,1,0,0,0,852,109,1,0,
        0,0,853,854,5,112,0,0,854,855,5,41,0,0,855,856,7,3,0,0,856,857,5,
        60,0,0,857,866,3,22,11,0,858,864,5,113,0,0,859,860,5,41,0,0,860,
        861,7,14,0,0,861,865,5,42,0,0,862,865,5,33,0,0,863,865,5,34,0,0,
        864,859,1,0,0,0,864,862,1,0,0,0,864,863,1,0,0,0,865,867,1,0,0,0,
        866,858,1,0,0,0,866,867,1,0,0,0,867,868,1,0,0,0,868,869,5,42,0,0,
        869,111,1,0,0,0,870,876,3,22,11,0,871,872,3,22,11,0,872,873,5,158,
        0,0,873,874,3,112,56,0,874,876,1,0,0,0,875,870,1,0,0,0,875,871,1,
        0,0,0,876,113,1,0,0,0,877,878,3,40,20,0,878,115,1,0,0,0,879,894,
        5,112,0,0,880,895,3,78,39,0,881,884,5,41,0,0,882,885,3,22,11,0,883,
        885,3,10,5,0,884,882,1,0,0,0,884,883,1,0,0,0,885,886,1,0,0,0,886,
        887,5,42,0,0,887,895,1,0,0,0,888,889,5,41,0,0,889,890,3,22,11,0,
        890,891,5,158,0,0,891,892,3,22,11,0,892,893,5,42,0,0,893,895,1,0,
        0,0,894,880,1,0,0,0,894,881,1,0,0,0,894,888,1,0,0,0,895,117,1,0,
        0,0,896,902,5,113,0,0,897,903,3,78,39,0,898,899,5,41,0,0,899,900,
        3,22,11,0,900,901,5,42,0,0,901,903,1,0,0,0,902,897,1,0,0,0,902,898,
        1,0,0,0,903,119,1,0,0,0,904,905,5,112,0,0,905,911,5,41,0,0,906,912,
        3,18,9,0,907,909,3,78,39,0,908,910,3,20,10,0,909,908,1,0,0,0,909,
        910,1,0,0,0,910,912,1,0,0,0,911,906,1,0,0,0,911,907,1,0,0,0,912,
        913,1,0,0,0,913,914,5,42,0,0,914,121,1,0,0,0,915,916,5,112,0,0,916,
        917,5,41,0,0,917,918,3,18,9,0,918,919,5,42,0,0,919,123,1,0,0,0,105,
        134,141,149,158,166,177,181,184,188,193,198,203,209,216,228,234,
        256,260,288,297,304,308,311,315,322,330,338,349,360,371,382,399,
        401,409,412,418,425,430,438,444,452,466,469,473,486,489,493,502,
        509,519,522,532,542,547,555,562,564,567,582,589,592,595,598,600,
        617,623,629,635,659,668,676,684,709,713,716,719,722,724,731,739,
        750,753,762,765,768,770,773,786,789,794,801,820,828,832,837,844,
        851,864,866,875,884,894,902,909,911
    ]

class LaTeXParser ( Parser ):

    grammarFileName = "LaTeX.g4"

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

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

    sharedContextCache = PredictionContextCache()

    literalNames = [ "<INVALID>", "'\\text'", "'\\textrm'", "'\\textbf'", 
                     "'c'", "'r'", "'l'", "'cases'", "'array'", "'pmatrix'", 
                     "'matrix'", "'[['", "'\\\\'", "'\\phantom'", "'\\hspace'", 
                     "'\\vspace'", "'\\textbf'", "'\\mbox'", "'.'", "'E'", 
                     "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                     "'\\quad'", "'\\qquad'", "<INVALID>", "'\\negmedspace'", 
                     "'\\negthickspace'", "<INVALID>", "<INVALID>", "<INVALID>", 
                     "<INVALID>", "'+'", "'-'", "<INVALID>", "'/'", "<INVALID>", 
                     "<INVALID>", "'('", "')'", "'{'", "'}'", "<INVALID>", 
                     "<INVALID>", "'['", "']'", "'|'", "'&'", "'\\right|'", 
                     "'\\left|'", "'\\langle'", "'\\rangle'", "'\\lvert'", 
                     "'\\rvert'", "'\\lim'", "<INVALID>", "<INVALID>", "<INVALID>", 
                     "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                     "'\\prod'", "<INVALID>", "<INVALID>", "'\\lg'", "<INVALID>", 
                     "<INVALID>", "<INVALID>", "<INVALID>", "'\\csc'", "'\\sec'", 
                     "'\\cot'", "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                     "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                     "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                     "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                     "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                     "<INVALID>", "'\\lfloor'", "'\\rfloor'", "'\\lceil'", 
                     "'\\rceil'", "'\\sqrt'", "'\\overline'", "'\\over'", 
                     "'\\times'", "'\\cdot'", "'\\div'", "<INVALID>", "'\\binom'", 
                     "'\\dbinom'", "'\\tbinom'", "<INVALID>", "<INVALID>", 
                     "'\\mathit'", "'_'", "'^'", "<INVALID>", "<INVALID>", 
                     "'\\%'", "<INVALID>", "<INVALID>", "<INVALID>", "'\\neg'", 
                     "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                     "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                     "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                     "<INVALID>", "<INVALID>", "'\\leqq'", "'\\leqslant'", 
                     "<INVALID>", "<INVALID>", "'\\geqq'", "'\\geqslant'", 
                     "<INVALID>", "<INVALID>", "<INVALID>", "'!'", "<INVALID>", 
                     "<INVALID>", "'\\begin'", "'\\end'", "<INVALID>", "<INVALID>", 
                     "<INVALID>", "<INVALID>", "'\\choose'", "<INVALID>", 
                     "<INVALID>", "<INVALID>", "<INVALID>", "','" ]

    symbolicNames = [ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "WS", "THINSPACE", "MEDSPACE", "THICKSPACE", "QUAD", 
                      "QQUAD", "NEGTHINSPACE", "NEGMEDSPACE", "NEGTHICKSPACE", 
                      "CMD_LEFT", "CMD_RIGHT", "MODIFIER", "IGNORE", "ADD", 
                      "SUB", "MUL", "DIV", "SET_MINUS", "PM", "L_PAREN", 
                      "R_PAREN", "L_BRACE", "R_BRACE", "L_BRACE_LITERAL", 
                      "R_BRACE_LITERAL", "L_BRACKET", "R_BRACKET", "BAR", 
                      "MATRIX_DELIMITER", "R_BAR", "L_BAR", "L_ANGLE", "R_ANGLE", 
                      "L_VERT", "R_VERT", "FUNC_LIM", "FUNC_MIN", "FUNC_MAX", 
                      "FUNC_SUP", "FUNC_INF", "LIM_APPROACH_SYM", "FUNC_INT", 
                      "FUNC_SUM", "FUNC_PROD", "FUNC_EXP", "FUNC_LOG", "FUNC_LG", 
                      "FUNC_LN", "FUNC_SIN", "FUNC_COS", "FUNC_TAN", "FUNC_CSC", 
                      "FUNC_SEC", "FUNC_COT", "FUNC_ARCSIN", "FUNC_ARCCOS", 
                      "FUNC_ARCTAN", "FUNC_ARCCSC", "FUNC_ARCSEC", "FUNC_ARCCOT", 
                      "FUNC_SINH", "FUNC_COSH", "FUNC_TANH", "FUNC_ARSINH", 
                      "FUNC_ARCOSH", "FUNC_ARTANH", "FUNC_VAR", "FUNC_COV", 
                      "FUNC_EXPECTED_VALUE", "PROBABILITY", "FUNC_DET", 
                      "FUNC_RE", "FUNC_IM", "RIGHT_ARROW", "LEFT_RIGHT_ARROW", 
                      "L_FLOOR", "R_FLOOR", "L_CEIL", "R_CEIL", "FUNC_SQRT", 
                      "FUNC_OVERLINE", "FUNC_OVER", "CMD_TIMES", "CMD_CDOT", 
                      "CMD_DIV", "CMD_FRAC", "CMD_BINOM", "CMD_DBINOM", 
                      "CMD_TBINOM", "CMD_CAP", "CMD_CUP", "CMD_MATHIT", 
                      "UNDERSCORE", "CARET", "COLON", "DOTS", "PERCENTAGE", 
                      "AND", "OR", "TEXT_OR", "NEGATE", "GREEK", "PI", "TEXT_IF", 
                      "TEXT_OTHERWISE", "DDX", "DERIVATIVE_SYMBOLS", "DIFFERENTIAL", 
                      "LETTER", "DIGIT", "DEFINES", "EQUAL", "NEQ", "LT", 
                      "LTE", "LTE_Q", "LTE_S", "GT", "GTE", "GTE_Q", "GTE_S", 
                      "SUBSET", "SUPSET", "APPROX", "BANG", "MID", "SINGLE_QUOTES", 
                      "BEGIN", "END", "INFINITY", "SPECIAL_SETS", "EMPTY_SET", 
                      "BINARY_OPERATORS", "CHOOSE", "IN", "SYMBOL", "NORM", 
                      "IMAGINARY_UNIT", "COMMA" ]

    RULE_math = 0
    RULE_implication = 1
    RULE_formulas = 2
    RULE_l_interval = 3
    RULE_r_interval = 4
    RULE_variable = 5
    RULE_set = 6
    RULE_in_set = 7
    RULE_relation = 8
    RULE_equality = 9
    RULE_text = 10
    RULE_expr = 11
    RULE_env = 12
    RULE_cases_row = 13
    RULE_cases = 14
    RULE_matrix = 15
    RULE_matrix_row = 16
    RULE_additive = 17
    RULE_mp = 18
    RULE_operator = 19
    RULE_mp_nofunc = 20
    RULE_unary = 21
    RULE_unary_nofunc = 22
    RULE_postfix = 23
    RULE_postfix_nofunc = 24
    RULE_postfix_op = 25
    RULE_eval_at = 26
    RULE_eval_at_sub = 27
    RULE_eval_at_sup = 28
    RULE_exp = 29
    RULE_exp_nofunc = 30
    RULE_comp = 31
    RULE_comp_nofunc = 32
    RULE_group = 33
    RULE_abs_group = 34
    RULE_number = 35
    RULE_special_symbols = 36
    RULE_modifier = 37
    RULE_tuple = 38
    RULE_atom = 39
    RULE_probability = 40
    RULE_bars = 41
    RULE_bra = 42
    RULE_ket = 43
    RULE_mathit = 44
    RULE_mathit_text = 45
    RULE_frac = 46
    RULE_binom = 47
    RULE_floor = 48
    RULE_ceil = 49
    RULE_func_normal = 50
    RULE_func_bracket = 51
    RULE_func_binary_bracket = 52
    RULE_func = 53
    RULE_args = 54
    RULE_limit_sub = 55
    RULE_func_arg = 56
    RULE_func_arg_noparens = 57
    RULE_subexpr = 58
    RULE_supexpr = 59
    RULE_subeq = 60
    RULE_supeq = 61

    ruleNames =  [ "math", "implication", "formulas", "l_interval", "r_interval", 
                   "variable", "set", "in_set", "relation", "equality", 
                   "text", "expr", "env", "cases_row", "cases", "matrix", 
                   "matrix_row", "additive", "mp", "operator", "mp_nofunc", 
                   "unary", "unary_nofunc", "postfix", "postfix_nofunc", 
                   "postfix_op", "eval_at", "eval_at_sub", "eval_at_sup", 
                   "exp", "exp_nofunc", "comp", "comp_nofunc", "group", 
                   "abs_group", "number", "special_symbols", "modifier", 
                   "tuple", "atom", "probability", "bars", "bra", "ket", 
                   "mathit", "mathit_text", "frac", "binom", "floor", "ceil", 
                   "func_normal", "func_bracket", "func_binary_bracket", 
                   "func", "args", "limit_sub", "func_arg", "func_arg_noparens", 
                   "subexpr", "supexpr", "subeq", "supeq" ]

    EOF = Token.EOF
    T__0=1
    T__1=2
    T__2=3
    T__3=4
    T__4=5
    T__5=6
    T__6=7
    T__7=8
    T__8=9
    T__9=10
    T__10=11
    T__11=12
    T__12=13
    T__13=14
    T__14=15
    T__15=16
    T__16=17
    T__17=18
    T__18=19
    WS=20
    THINSPACE=21
    MEDSPACE=22
    THICKSPACE=23
    QUAD=24
    QQUAD=25
    NEGTHINSPACE=26
    NEGMEDSPACE=27
    NEGTHICKSPACE=28
    CMD_LEFT=29
    CMD_RIGHT=30
    MODIFIER=31
    IGNORE=32
    ADD=33
    SUB=34
    MUL=35
    DIV=36
    SET_MINUS=37
    PM=38
    L_PAREN=39
    R_PAREN=40
    L_BRACE=41
    R_BRACE=42
    L_BRACE_LITERAL=43
    R_BRACE_LITERAL=44
    L_BRACKET=45
    R_BRACKET=46
    BAR=47
    MATRIX_DELIMITER=48
    R_BAR=49
    L_BAR=50
    L_ANGLE=51
    R_ANGLE=52
    L_VERT=53
    R_VERT=54
    FUNC_LIM=55
    FUNC_MIN=56
    FUNC_MAX=57
    FUNC_SUP=58
    FUNC_INF=59
    LIM_APPROACH_SYM=60
    FUNC_INT=61
    FUNC_SUM=62
    FUNC_PROD=63
    FUNC_EXP=64
    FUNC_LOG=65
    FUNC_LG=66
    FUNC_LN=67
    FUNC_SIN=68
    FUNC_COS=69
    FUNC_TAN=70
    FUNC_CSC=71
    FUNC_SEC=72
    FUNC_COT=73
    FUNC_ARCSIN=74
    FUNC_ARCCOS=75
    FUNC_ARCTAN=76
    FUNC_ARCCSC=77
    FUNC_ARCSEC=78
    FUNC_ARCCOT=79
    FUNC_SINH=80
    FUNC_COSH=81
    FUNC_TANH=82
    FUNC_ARSINH=83
    FUNC_ARCOSH=84
    FUNC_ARTANH=85
    FUNC_VAR=86
    FUNC_COV=87
    FUNC_EXPECTED_VALUE=88
    PROBABILITY=89
    FUNC_DET=90
    FUNC_RE=91
    FUNC_IM=92
    RIGHT_ARROW=93
    LEFT_RIGHT_ARROW=94
    L_FLOOR=95
    R_FLOOR=96
    L_CEIL=97
    R_CEIL=98
    FUNC_SQRT=99
    FUNC_OVERLINE=100
    FUNC_OVER=101
    CMD_TIMES=102
    CMD_CDOT=103
    CMD_DIV=104
    CMD_FRAC=105
    CMD_BINOM=106
    CMD_DBINOM=107
    CMD_TBINOM=108
    CMD_CAP=109
    CMD_CUP=110
    CMD_MATHIT=111
    UNDERSCORE=112
    CARET=113
    COLON=114
    DOTS=115
    PERCENTAGE=116
    AND=117
    OR=118
    TEXT_OR=119
    NEGATE=120
    GREEK=121
    PI=122
    TEXT_IF=123
    TEXT_OTHERWISE=124
    DDX=125
    DERIVATIVE_SYMBOLS=126
    DIFFERENTIAL=127
    LETTER=128
    DIGIT=129
    DEFINES=130
    EQUAL=131
    NEQ=132
    LT=133
    LTE=134
    LTE_Q=135
    LTE_S=136
    GT=137
    GTE=138
    GTE_Q=139
    GTE_S=140
    SUBSET=141
    SUPSET=142
    APPROX=143
    BANG=144
    MID=145
    SINGLE_QUOTES=146
    BEGIN=147
    END=148
    INFINITY=149
    SPECIAL_SETS=150
    EMPTY_SET=151
    BINARY_OPERATORS=152
    CHOOSE=153
    IN=154
    SYMBOL=155
    NORM=156
    IMAGINARY_UNIT=157
    COMMA=158

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




    class MathContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def implication(self):
            return self.getTypedRuleContext(LaTeXParser.ImplicationContext,0)


        def getRuleIndex(self):
            return LaTeXParser.RULE_math

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

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

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




    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 = 124
            self.implication(0)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ImplicationContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

        def implication(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(LaTeXParser.ImplicationContext)
            else:
                return self.getTypedRuleContext(LaTeXParser.ImplicationContext,i)


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

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

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

        def formulas(self):
            return self.getTypedRuleContext(LaTeXParser.FormulasContext,0)


        def getRuleIndex(self):
            return LaTeXParser.RULE_implication

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

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

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



    def implication(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = LaTeXParser.ImplicationContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 2
        self.enterRecursionRule(localctx, 2, self.RULE_implication, _p)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 134
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,0,self._ctx)
            if la_ == 1:
                self.state = 127
                self.match(LaTeXParser.L_BRACKET)
                self.state = 128
                self.implication(0)
                self.state = 129
                _la = self._input.LA(1)
                if not(_la==93 or _la==94):
                    self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 130
                self.implication(0)
                self.state = 131
                self.match(LaTeXParser.R_BRACKET)
                pass

            elif la_ == 2:
                self.state = 133
                self.formulas()
                pass


            self._ctx.stop = self._input.LT(-1)
            self.state = 141
            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.ImplicationContext(self, _parentctx, _parentState)
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_implication)
                    self.state = 136
                    if not self.precpred(self._ctx, 3):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 3)")
                    self.state = 137
                    _la = self._input.LA(1)
                    if not(_la==93 or _la==94):
                        self._errHandler.recoverInline(self)
                    else:
                        self._errHandler.reportMatch(self)
                        self.consume()
                    self.state = 138
                    self.implication(4) 
                self.state = 143
                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 FormulasContext(ParserRuleContext):
        __slots__ = 'parser'

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

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


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

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

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

        def getRuleIndex(self):
            return LaTeXParser.RULE_formulas

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

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

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




    def formulas(self):

        localctx = LaTeXParser.FormulasContext(self, self._ctx, self.state)
        self.enterRule(localctx, 4, self.RULE_formulas)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 144
            self.relation(0)
            self.state = 149
            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:
                    self.state = 145
                    _la = self._input.LA(1)
                    if not(((((_la - 117)) & ~0x3f) == 0 and ((1 << (_la - 117)) & 2199023255557) != 0)):
                        self._errHandler.recoverInline(self)
                    else:
                        self._errHandler.reportMatch(self)
                        self.consume()
                    self.state = 146
                    self.relation(0) 
                self.state = 151
                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.exitRule()
        return localctx


    class L_intervalContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def L_PAREN(self):
            return self.getToken(LaTeXParser.L_PAREN, 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 getRuleIndex(self):
            return LaTeXParser.RULE_l_interval

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

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

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




    def l_interval(self):

        localctx = LaTeXParser.L_intervalContext(self, self._ctx, self.state)
        self.enterRule(localctx, 6, self.RULE_l_interval)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 152
            _la = self._input.LA(1)
            if not((((_la) & ~0x3f) == 0 and ((1 << _la) & 107202383708160) != 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 R_intervalContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def L_PAREN(self):
            return self.getToken(LaTeXParser.L_PAREN, 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 getRuleIndex(self):
            return LaTeXParser.RULE_r_interval

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

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

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




    def r_interval(self):

        localctx = LaTeXParser.R_intervalContext(self, self._ctx, self.state)
        self.enterRule(localctx, 8, self.RULE_r_interval)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 154
            _la = self._input.LA(1)
            if not((((_la) & ~0x3f) == 0 and ((1 << _la) & 107202383708160) != 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 VariableContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__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 in_set(self):
            return self.getTypedRuleContext(LaTeXParser.In_setContext,0)


        def getRuleIndex(self):
            return LaTeXParser.RULE_variable

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

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

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




    def variable(self):

        localctx = LaTeXParser.VariableContext(self, self._ctx, self.state)
        self.enterRule(localctx, 10, self.RULE_variable)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 156
            _la = self._input.LA(1)
            if not(_la==128 or _la==155):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
            self.state = 158
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,3,self._ctx)
            if la_ == 1:
                self.state = 157
                self.in_set()


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


    class SetContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

        def atom(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(LaTeXParser.AtomContext)
            else:
                return self.getTypedRuleContext(LaTeXParser.AtomContext,i)


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

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

        def variable(self):
            return self.getTypedRuleContext(LaTeXParser.VariableContext,0)


        def formulas(self):
            return self.getTypedRuleContext(LaTeXParser.FormulasContext,0)


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

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

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

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

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


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


        def l_interval(self):
            return self.getTypedRuleContext(LaTeXParser.L_intervalContext,0)


        def r_interval(self):
            return self.getTypedRuleContext(LaTeXParser.R_intervalContext,0)


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

        def getRuleIndex(self):
            return LaTeXParser.RULE_set

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

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

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




    def set_(self):

        localctx = LaTeXParser.SetContext(self, self._ctx, self.state)
        self.enterRule(localctx, 12, self.RULE_set)
        self._la = 0 # Token type
        try:
            self.state = 198
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,10,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 160
                self.match(LaTeXParser.L_BRACE_LITERAL)
                self.state = 161
                self.atom()
                self.state = 166
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==158:
                    self.state = 162
                    self.match(LaTeXParser.COMMA)
                    self.state = 163
                    self.atom()
                    self.state = 168
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

                self.state = 169
                self.match(LaTeXParser.R_BRACE_LITERAL)
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 177
                self._errHandler.sync(self)
                token = self._input.LA(1)
                if token in [43]:
                    self.state = 171
                    self.match(LaTeXParser.L_BRACE_LITERAL)
                    self.state = 172
                    self.variable()
                    self.state = 173
                    _la = self._input.LA(1)
                    if not(_la==47 or _la==114 or _la==145):
                        self._errHandler.recoverInline(self)
                    else:
                        self._errHandler.reportMatch(self)
                        self.consume()
                    self.state = 174
                    self.formulas()
                    pass
                elif token in [44]:
                    self.state = 176
                    self.match(LaTeXParser.R_BRACE_LITERAL)
                    pass
                else:
                    raise NoViableAltException(self)

                pass

            elif la_ == 3:
                self.enterOuterAlt(localctx, 3)
                self.state = 179
                self.match(LaTeXParser.SPECIAL_SETS)
                self.state = 181
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,6,self._ctx)
                if la_ == 1:
                    self.state = 180
                    self.subexpr()


                self.state = 184
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,7,self._ctx)
                if la_ == 1:
                    self.state = 183
                    self.supexpr()


                pass

            elif la_ == 4:
                self.enterOuterAlt(localctx, 4)
                self.state = 186
                self.l_interval()
                self.state = 188
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==34:
                    self.state = 187
                    self.match(LaTeXParser.SUB)


                self.state = 190
                self.atom()
                self.state = 191
                self.match(LaTeXParser.COMMA)
                self.state = 193
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==34:
                    self.state = 192
                    self.match(LaTeXParser.SUB)


                self.state = 195
                self.atom()
                self.state = 196
                self.r_interval()
                pass


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


    class In_setContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

        def set_(self):
            return self.getTypedRuleContext(LaTeXParser.SetContext,0)


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

        def getRuleIndex(self):
            return LaTeXParser.RULE_in_set

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

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

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




    def in_set(self):

        localctx = LaTeXParser.In_setContext(self, self._ctx, self.state)
        self.enterRule(localctx, 14, self.RULE_in_set)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 200
            self.match(LaTeXParser.IN)
            self.state = 203
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [39, 40, 43, 44, 45, 46, 150]:
                self.state = 201
                self.set_()
                pass
            elif token in [128]:
                self.state = 202
                self.match(LaTeXParser.LETTER)
                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 RelationContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def set_(self):
            return self.getTypedRuleContext(LaTeXParser.SetContext,0)


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


        def variable(self):
            return self.getTypedRuleContext(LaTeXParser.VariableContext,0)


        def relation(self, i:int=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 APPROX(self):
            return self.getToken(LaTeXParser.APPROX, 0)

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

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

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

        def getRuleIndex(self):
            return LaTeXParser.RULE_relation

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

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

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



    def relation(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = LaTeXParser.RelationContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 16
        self.enterRecursionRule(localctx, 16, self.RULE_relation, _p)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 209
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,12,self._ctx)
            if la_ == 1:
                self.state = 206
                self.set_()
                pass

            elif la_ == 2:
                self.state = 207
                self.expr()
                pass

            elif la_ == 3:
                self.state = 208
                self.variable()
                pass


            self._ctx.stop = self._input.LT(-1)
            self.state = 216
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,13,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 = 211
                    if not self.precpred(self._ctx, 4):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 4)")
                    self.state = 212
                    _la = self._input.LA(1)
                    if not(((((_la - 130)) & ~0x3f) == 0 and ((1 << (_la - 130)) & 14751) != 0)):
                        self._errHandler.recoverInline(self)
                    else:
                        self._errHandler.reportMatch(self)
                        self.consume()
                    self.state = 213
                    self.relation(5) 
                self.state = 218
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,13,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):
        __slots__ = 'parser'

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

        def expr(self, i:int=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 enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterEquality" ):
                listener.enterEquality(self)

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

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




    def equality(self):

        localctx = LaTeXParser.EqualityContext(self, self._ctx, self.state)
        self.enterRule(localctx, 18, self.RULE_equality)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 219
            self.expr()
            self.state = 220
            self.match(LaTeXParser.EQUAL)
            self.state = 221
            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 TextContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

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

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

        def getRuleIndex(self):
            return LaTeXParser.RULE_text

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

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

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




    def text(self):

        localctx = LaTeXParser.TextContext(self, self._ctx, self.state)
        self.enterRule(localctx, 20, self.RULE_text)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 223
            _la = self._input.LA(1)
            if not((((_la) & ~0x3f) == 0 and ((1 << _la) & 14) != 0)):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
            self.state = 224
            self.match(LaTeXParser.L_BRACE)
            self.state = 228
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while (((_la) & ~0x3f) == 0 and ((1 << _la) & 112) != 0) or _la==128:
                self.state = 225
                _la = self._input.LA(1)
                if not((((_la) & ~0x3f) == 0 and ((1 << _la) & 112) != 0) or _la==128):
                    self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 230
                self._errHandler.sync(self)
                _la = self._input.LA(1)

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

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

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


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

        def getRuleIndex(self):
            return LaTeXParser.RULE_expr

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

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

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




    def expr(self):

        localctx = LaTeXParser.ExprContext(self, self._ctx, self.state)
        self.enterRule(localctx, 22, self.RULE_expr)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 234
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==120:
                self.state = 233
                self.match(LaTeXParser.NEGATE)


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

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

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

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

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

        def cases(self):
            return self.getTypedRuleContext(LaTeXParser.CasesContext,0)


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

        def matrix(self):
            return self.getTypedRuleContext(LaTeXParser.MatrixContext,0)


        def matrix_row(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(LaTeXParser.Matrix_rowContext)
            else:
                return self.getTypedRuleContext(LaTeXParser.Matrix_rowContext,i)


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

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

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

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

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


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


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

        def getRuleIndex(self):
            return LaTeXParser.RULE_env

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

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

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




    def env(self):

        localctx = LaTeXParser.EnvContext(self, self._ctx, self.state)
        self.enterRule(localctx, 24, self.RULE_env)
        self._la = 0 # Token type
        try:
            self.state = 304
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,20,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 238
                self.match(LaTeXParser.BEGIN)
                self.state = 239
                self.match(LaTeXParser.L_BRACE)
                self.state = 240
                self.match(LaTeXParser.T__6)
                self.state = 241
                self.match(LaTeXParser.R_BRACE)
                self.state = 242
                self.cases()
                self.state = 243
                self.match(LaTeXParser.END)
                self.state = 244
                self.match(LaTeXParser.L_BRACE)
                self.state = 245
                self.match(LaTeXParser.T__6)
                self.state = 246
                self.match(LaTeXParser.R_BRACE)
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 248
                self.match(LaTeXParser.BEGIN)
                self.state = 249
                self.match(LaTeXParser.L_BRACE)
                self.state = 250
                self.match(LaTeXParser.T__7)
                self.state = 251
                self.match(LaTeXParser.R_BRACE)
                self.state = 260
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,17,self._ctx)
                if la_ == 1:
                    self.state = 252
                    self.match(LaTeXParser.L_BRACE)
                    self.state = 256
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    while (((_la) & ~0x3f) == 0 and ((1 << _la) & 112) != 0):
                        self.state = 253
                        _la = self._input.LA(1)
                        if not((((_la) & ~0x3f) == 0 and ((1 << _la) & 112) != 0)):
                            self._errHandler.recoverInline(self)
                        else:
                            self._errHandler.reportMatch(self)
                            self.consume()
                        self.state = 258
                        self._errHandler.sync(self)
                        _la = self._input.LA(1)

                    self.state = 259
                    self.match(LaTeXParser.R_BRACE)


                self.state = 262
                self.matrix()
                self.state = 263
                self.match(LaTeXParser.END)
                self.state = 264
                self.match(LaTeXParser.L_BRACE)
                self.state = 265
                self.match(LaTeXParser.T__7)
                self.state = 266
                self.match(LaTeXParser.R_BRACE)
                pass

            elif la_ == 3:
                self.enterOuterAlt(localctx, 3)
                self.state = 268
                self.match(LaTeXParser.BEGIN)
                self.state = 269
                self.match(LaTeXParser.L_BRACE)
                self.state = 270
                _la = self._input.LA(1)
                if not((((_la) & ~0x3f) == 0 and ((1 << _la) & 1792) != 0)):
                    self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 271
                self.match(LaTeXParser.R_BRACE)
                self.state = 272
                self.matrix()
                self.state = 273
                self.match(LaTeXParser.END)
                self.state = 274
                self.match(LaTeXParser.L_BRACE)
                self.state = 275
                _la = self._input.LA(1)
                if not((((_la) & ~0x3f) == 0 and ((1 << _la) & 1792) != 0)):
                    self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 276
                self.match(LaTeXParser.R_BRACE)
                pass

            elif la_ == 4:
                self.enterOuterAlt(localctx, 4)
                self.state = 278
                self.match(LaTeXParser.T__10)
                self.state = 279
                self.matrix_row()
                self.state = 280
                self.match(LaTeXParser.R_BRACKET)
                self.state = 288
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==158:
                    self.state = 281
                    self.match(LaTeXParser.COMMA)
                    self.state = 282
                    self.match(LaTeXParser.L_BRACKET)
                    self.state = 283
                    self.matrix_row()
                    self.state = 284
                    self.match(LaTeXParser.R_BRACKET)
                    self.state = 290
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

                self.state = 291
                self.match(LaTeXParser.R_BRACKET)
                pass

            elif la_ == 5:
                self.enterOuterAlt(localctx, 5)
                self.state = 293
                self.match(LaTeXParser.NORM)
                self.state = 294
                self.expr()
                self.state = 295
                self.match(LaTeXParser.NORM)
                self.state = 297
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,19,self._ctx)
                if la_ == 1:
                    self.state = 296
                    self.subexpr()


                pass

            elif la_ == 6:
                self.enterOuterAlt(localctx, 6)
                self.state = 299
                self.match(LaTeXParser.BAR)
                self.state = 300
                self.expr()
                self.state = 301
                self.match(LaTeXParser.BAR)
                self.state = 302
                self.subexpr()
                pass


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


    class Cases_rowContext(ParserRuleContext):
        __slots__ = 'parser'

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

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


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

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

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


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

        def getRuleIndex(self):
            return LaTeXParser.RULE_cases_row

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

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

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




    def cases_row(self):

        localctx = LaTeXParser.Cases_rowContext(self, self._ctx, self.state)
        self.enterRule(localctx, 26, self.RULE_cases_row)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 306
            self.expr()

            self.state = 308
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==48:
                self.state = 307
                self.match(LaTeXParser.MATRIX_DELIMITER)


            self.state = 315
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [1, 2, 3, 4, 5, 6, 11, 13, 14, 15, 16, 17, 19, 31, 33, 34, 39, 40, 41, 43, 44, 45, 46, 47, 50, 51, 53, 55, 56, 57, 58, 59, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 95, 97, 99, 100, 105, 106, 107, 108, 111, 115, 120, 121, 123, 125, 126, 127, 128, 129, 147, 149, 150, 155, 156, 157]:
                self.state = 311
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==123:
                    self.state = 310
                    self.match(LaTeXParser.TEXT_IF)


                self.state = 313
                self.relation(0)
                pass
            elif token in [124]:
                self.state = 314
                self.match(LaTeXParser.TEXT_OTHERWISE)
                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 CasesContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def cases_row(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(LaTeXParser.Cases_rowContext)
            else:
                return self.getTypedRuleContext(LaTeXParser.Cases_rowContext,i)


        def getRuleIndex(self):
            return LaTeXParser.RULE_cases

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

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

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




    def cases(self):

        localctx = LaTeXParser.CasesContext(self, self._ctx, self.state)
        self.enterRule(localctx, 28, self.RULE_cases)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 317
            self.cases_row()
            self.state = 322
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==12:
                self.state = 318
                self.match(LaTeXParser.T__11)
                self.state = 319
                self.cases_row()
                self.state = 324
                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 MatrixContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def matrix_row(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(LaTeXParser.Matrix_rowContext)
            else:
                return self.getTypedRuleContext(LaTeXParser.Matrix_rowContext,i)


        def getRuleIndex(self):
            return LaTeXParser.RULE_matrix

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

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

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




    def matrix(self):

        localctx = LaTeXParser.MatrixContext(self, self._ctx, self.state)
        self.enterRule(localctx, 30, self.RULE_matrix)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 325
            self.matrix_row()
            self.state = 330
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==12:
                self.state = 326
                self.match(LaTeXParser.T__11)
                self.state = 327
                self.matrix_row()
                self.state = 332
                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 Matrix_rowContext(ParserRuleContext):
        __slots__ = 'parser'

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

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


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

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

        def getRuleIndex(self):
            return LaTeXParser.RULE_matrix_row

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

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

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




    def matrix_row(self):

        localctx = LaTeXParser.Matrix_rowContext(self, self._ctx, self.state)
        self.enterRule(localctx, 32, self.RULE_matrix_row)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 333
            self.expr()
            self.state = 338
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==48 or _la==158:
                self.state = 334
                _la = self._input.LA(1)
                if not(_la==48 or _la==158):
                    self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 335
                self.expr()
                self.state = 340
                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 AdditiveContext(ParserRuleContext):
        __slots__ = 'parser'

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

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


        def additive(self, i:int=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 PM(self):
            return self.getToken(LaTeXParser.PM, 0)

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

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

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

        def getRuleIndex(self):
            return LaTeXParser.RULE_additive

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

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

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



    def additive(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = LaTeXParser.AdditiveContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 34
        self.enterRecursionRule(localctx, 34, self.RULE_additive, _p)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 342
            self.mp(0)
            self._ctx.stop = self._input.LT(-1)
            self.state = 349
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,27,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 = 344
                    if not self.precpred(self._ctx, 2):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                    self.state = 345
                    _la = self._input.LA(1)
                    if not((((_la) & ~0x3f) == 0 and ((1 << _la) & 300647710720) != 0) or ((((_la - 109)) & ~0x3f) == 0 and ((1 << (_la - 109)) & 515) != 0)):
                        self._errHandler.recoverInline(self)
                    else:
                        self._errHandler.reportMatch(self)
                        self.consume()
                    self.state = 346
                    self.additive(3) 
                self.state = 351
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,27,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):
        __slots__ = 'parser'

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

        def operator(self):
            return self.getTypedRuleContext(LaTeXParser.OperatorContext,0)


        def mp(self, i:int=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 SET_MINUS(self):
            return self.getToken(LaTeXParser.SET_MINUS, 0)

        def getRuleIndex(self):
            return LaTeXParser.RULE_mp

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

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

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



    def mp(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = LaTeXParser.MpContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 36
        self.enterRecursionRule(localctx, 36, self.RULE_mp, _p)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 353
            self.operator(0)
            self._ctx.stop = self._input.LT(-1)
            self.state = 360
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,28,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 = 355
                    if not self.precpred(self._ctx, 2):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                    self.state = 356
                    _la = self._input.LA(1)
                    if not((((_la) & ~0x3f) == 0 and ((1 << _la) & 240518168576) != 0) or ((((_la - 102)) & ~0x3f) == 0 and ((1 << (_la - 102)) & 4103) != 0)):
                        self._errHandler.recoverInline(self)
                    else:
                        self._errHandler.reportMatch(self)
                        self.consume()
                    self.state = 357
                    self.mp(3) 
                self.state = 362
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,28,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 OperatorContext(ParserRuleContext):
        __slots__ = 'parser'

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

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


        def operator(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(LaTeXParser.OperatorContext)
            else:
                return self.getTypedRuleContext(LaTeXParser.OperatorContext,i)


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

        def getRuleIndex(self):
            return LaTeXParser.RULE_operator

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

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

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



    def operator(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = LaTeXParser.OperatorContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 38
        self.enterRecursionRule(localctx, 38, self.RULE_operator, _p)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 364
            self.unary()
            self._ctx.stop = self._input.LT(-1)
            self.state = 371
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,29,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    localctx = LaTeXParser.OperatorContext(self, _parentctx, _parentState)
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_operator)
                    self.state = 366
                    if not self.precpred(self._ctx, 2):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                    self.state = 367
                    self.match(LaTeXParser.BINARY_OPERATORS)
                    self.state = 368
                    self.operator(3) 
                self.state = 373
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,29,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):
        __slots__ = 'parser'

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

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


        def mp_nofunc(self, i:int=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 enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterMp_nofunc" ):
                listener.enterMp_nofunc(self)

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

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



    def mp_nofunc(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = LaTeXParser.Mp_nofuncContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 40
        self.enterRecursionRule(localctx, 40, self.RULE_mp_nofunc, _p)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 375
            self.unary_nofunc()
            self._ctx.stop = self._input.LT(-1)
            self.state = 382
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,30,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 = 377
                    if not self.precpred(self._ctx, 2):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                    self.state = 378
                    _la = self._input.LA(1)
                    if not(_la==35 or _la==36 or ((((_la - 102)) & ~0x3f) == 0 and ((1 << (_la - 102)) & 4103) != 0)):
                        self._errHandler.recoverInline(self)
                    else:
                        self._errHandler.reportMatch(self)
                        self.consume()
                    self.state = 379
                    self.mp_nofunc(3) 
                self.state = 384
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,30,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):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__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 LETTER(self, i:int=None):
            if i is None:
                return self.getTokens(LaTeXParser.LETTER)
            else:
                return self.getToken(LaTeXParser.LETTER, i)

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

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

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


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

        def postfix(self, i:int=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 enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterUnary" ):
                listener.enterUnary(self)

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

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




    def unary(self):

        localctx = LaTeXParser.UnaryContext(self, self._ctx, self.state)
        self.enterRule(localctx, 42, self.RULE_unary)
        self._la = 0 # Token type
        try:
            self.state = 401
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,32,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 385
                _la = self._input.LA(1)
                if not(_la==33 or _la==34):
                    self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 386
                self.unary()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 387
                self.match(LaTeXParser.LETTER)
                self.state = 388
                self.match(LaTeXParser.CHOOSE)
                self.state = 389
                self.match(LaTeXParser.LETTER)
                pass

            elif la_ == 3:
                self.enterOuterAlt(localctx, 3)
                self.state = 390
                self.match(LaTeXParser.L_BRACE)
                self.state = 391
                self.expr()
                self.state = 392
                self.match(LaTeXParser.CHOOSE)
                self.state = 393
                self.expr()
                self.state = 394
                self.match(LaTeXParser.R_BRACE)
                pass

            elif la_ == 4:
                self.enterOuterAlt(localctx, 4)
                self.state = 397 
                self._errHandler.sync(self)
                _alt = 1
                while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                    if _alt == 1:
                        self.state = 396
                        self.postfix()

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

                pass


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

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__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:int=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 enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterUnary_nofunc" ):
                listener.enterUnary_nofunc(self)

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

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




    def unary_nofunc(self):

        localctx = LaTeXParser.Unary_nofuncContext(self, self._ctx, self.state)
        self.enterRule(localctx, 44, self.RULE_unary_nofunc)
        self._la = 0 # Token type
        try:
            self.state = 412
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [33, 34]:
                self.enterOuterAlt(localctx, 1)
                self.state = 403
                _la = self._input.LA(1)
                if not(_la==33 or _la==34):
                    self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 404
                self.unary_nofunc()
                pass
            elif token in [1, 2, 3, 4, 5, 6, 11, 13, 14, 15, 16, 17, 19, 31, 39, 41, 43, 45, 47, 50, 51, 53, 55, 56, 57, 58, 59, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 95, 97, 99, 100, 105, 106, 107, 108, 111, 115, 121, 125, 126, 127, 128, 129, 147, 149, 155, 156, 157]:
                self.enterOuterAlt(localctx, 2)
                self.state = 405
                self.postfix()
                self.state = 409
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,33,self._ctx)
                while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                    if _alt==1:
                        self.state = 406
                        self.postfix_nofunc() 
                    self.state = 411
                    self._errHandler.sync(self)
                    _alt = self._interp.adaptivePredict(self._input,33,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):
        __slots__ = 'parser'

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

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


        def postfix_op(self, i:int=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 enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterPostfix" ):
                listener.enterPostfix(self)

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

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




    def postfix(self):

        localctx = LaTeXParser.PostfixContext(self, self._ctx, self.state)
        self.enterRule(localctx, 46, self.RULE_postfix)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 414
            self.exp(0)
            self.state = 418
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,35,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 415
                    self.postfix_op() 
                self.state = 420
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,35,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):
        __slots__ = 'parser'

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

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


        def postfix_op(self, i:int=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 enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterPostfix_nofunc" ):
                listener.enterPostfix_nofunc(self)

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

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




    def postfix_nofunc(self):

        localctx = LaTeXParser.Postfix_nofuncContext(self, self._ctx, self.state)
        self.enterRule(localctx, 48, self.RULE_postfix_nofunc)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 421
            self.exp_nofunc(0)
            self.state = 425
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,36,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 422
                    self.postfix_op() 
                self.state = 427
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,36,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):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__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 enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterPostfix_op" ):
                listener.enterPostfix_op(self)

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

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




    def postfix_op(self):

        localctx = LaTeXParser.Postfix_opContext(self, self._ctx, self.state)
        self.enterRule(localctx, 50, self.RULE_postfix_op)
        try:
            self.state = 430
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [144]:
                self.enterOuterAlt(localctx, 1)
                self.state = 428
                self.match(LaTeXParser.BANG)
                pass
            elif token in [47]:
                self.enterOuterAlt(localctx, 2)
                self.state = 429
                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):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__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 enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterEval_at" ):
                listener.enterEval_at(self)

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

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




    def eval_at(self):

        localctx = LaTeXParser.Eval_atContext(self, self._ctx, self.state)
        self.enterRule(localctx, 52, self.RULE_eval_at)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 432
            self.match(LaTeXParser.BAR)
            self.state = 438
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,38,self._ctx)
            if la_ == 1:
                self.state = 433
                self.eval_at_sup()
                pass

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

            elif la_ == 3:
                self.state = 435
                self.eval_at_sup()
                self.state = 436
                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):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__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 enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterEval_at_sub" ):
                listener.enterEval_at_sub(self)

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

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




    def eval_at_sub(self):

        localctx = LaTeXParser.Eval_at_subContext(self, self._ctx, self.state)
        self.enterRule(localctx, 54, self.RULE_eval_at_sub)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 440
            self.match(LaTeXParser.UNDERSCORE)
            self.state = 441
            self.match(LaTeXParser.L_BRACE)
            self.state = 444
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,39,self._ctx)
            if la_ == 1:
                self.state = 442
                self.expr()
                pass

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


            self.state = 446
            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):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__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 enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterEval_at_sup" ):
                listener.enterEval_at_sup(self)

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

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




    def eval_at_sup(self):

        localctx = LaTeXParser.Eval_at_supContext(self, self._ctx, self.state)
        self.enterRule(localctx, 56, self.RULE_eval_at_sup)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 448
            self.match(LaTeXParser.CARET)
            self.state = 449
            self.match(LaTeXParser.L_BRACE)
            self.state = 452
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,40,self._ctx)
            if la_ == 1:
                self.state = 450
                self.expr()
                pass

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


            self.state = 454
            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):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__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 enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterExp" ):
                listener.enterExp(self)

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

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



    def exp(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = LaTeXParser.ExpContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 58
        self.enterRecursionRule(localctx, 58, self.RULE_exp, _p)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 457
            self.comp()
            self._ctx.stop = self._input.LT(-1)
            self.state = 473
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,43,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 = 459
                    if not self.precpred(self._ctx, 2):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                    self.state = 460
                    self.match(LaTeXParser.CARET)
                    self.state = 466
                    self._errHandler.sync(self)
                    la_ = self._interp.adaptivePredict(self._input,41,self._ctx)
                    if la_ == 1:
                        self.state = 461
                        self.atom()
                        pass

                    elif la_ == 2:
                        self.state = 462
                        self.match(LaTeXParser.L_BRACE)
                        self.state = 463
                        self.expr()
                        self.state = 464
                        self.match(LaTeXParser.R_BRACE)
                        pass


                    self.state = 469
                    self._errHandler.sync(self)
                    la_ = self._interp.adaptivePredict(self._input,42,self._ctx)
                    if la_ == 1:
                        self.state = 468
                        self.subexpr()

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

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__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 enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterExp_nofunc" ):
                listener.enterExp_nofunc(self)

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

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



    def exp_nofunc(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = LaTeXParser.Exp_nofuncContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 60
        self.enterRecursionRule(localctx, 60, self.RULE_exp_nofunc, _p)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 477
            self.comp_nofunc()
            self._ctx.stop = self._input.LT(-1)
            self.state = 493
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,46,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 = 479
                    if not self.precpred(self._ctx, 2):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                    self.state = 480
                    self.match(LaTeXParser.CARET)
                    self.state = 486
                    self._errHandler.sync(self)
                    la_ = self._interp.adaptivePredict(self._input,44,self._ctx)
                    if la_ == 1:
                        self.state = 481
                        self.atom()
                        pass

                    elif la_ == 2:
                        self.state = 482
                        self.match(LaTeXParser.L_BRACE)
                        self.state = 483
                        self.expr()
                        self.state = 484
                        self.match(LaTeXParser.R_BRACE)
                        pass


                    self.state = 489
                    self._errHandler.sync(self)
                    la_ = self._interp.adaptivePredict(self._input,45,self._ctx)
                    if la_ == 1:
                        self.state = 488
                        self.subexpr()

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

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__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 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 enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterComp" ):
                listener.enterComp(self)

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

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




    def comp(self):

        localctx = LaTeXParser.CompContext(self, self._ctx, self.state)
        self.enterRule(localctx, 62, self.RULE_comp)
        try:
            self.state = 502
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,47,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 496
                self.group()
                pass

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

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

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

            elif la_ == 5:
                self.enterOuterAlt(localctx, 5)
                self.state = 500
                self.floor()
                pass

            elif la_ == 6:
                self.enterOuterAlt(localctx, 6)
                self.state = 501
                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):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__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 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 enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterComp_nofunc" ):
                listener.enterComp_nofunc(self)

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

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




    def comp_nofunc(self):

        localctx = LaTeXParser.Comp_nofuncContext(self, self._ctx, self.state)
        self.enterRule(localctx, 64, self.RULE_comp_nofunc)
        try:
            self.state = 509
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,48,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 504
                self.group()
                pass

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

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

            elif la_ == 4:
                self.enterOuterAlt(localctx, 4)
                self.state = 507
                self.floor()
                pass

            elif la_ == 5:
                self.enterOuterAlt(localctx, 5)
                self.state = 508
                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):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__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 SINGLE_QUOTES(self):
            return self.getToken(LaTeXParser.SINGLE_QUOTES, 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 enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterGroup" ):
                listener.enterGroup(self)

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

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




    def group(self):

        localctx = LaTeXParser.GroupContext(self, self._ctx, self.state)
        self.enterRule(localctx, 66, self.RULE_group)
        self._la = 0 # Token type
        try:
            self.state = 532
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [39]:
                self.enterOuterAlt(localctx, 1)
                self.state = 511
                self.match(LaTeXParser.L_PAREN)
                self.state = 512
                self.expr()
                self.state = 513
                self.match(LaTeXParser.R_PAREN)
                pass
            elif token in [45]:
                self.enterOuterAlt(localctx, 2)
                self.state = 515
                self.match(LaTeXParser.L_BRACKET)
                self.state = 516
                self.expr()
                self.state = 517
                self.match(LaTeXParser.R_BRACKET)
                self.state = 519
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,49,self._ctx)
                if la_ == 1:
                    self.state = 518
                    self.match(LaTeXParser.SINGLE_QUOTES)


                pass
            elif token in [13, 14, 15, 16, 17, 41]:
                self.enterOuterAlt(localctx, 3)
                self.state = 522
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if (((_la) & ~0x3f) == 0 and ((1 << _la) & 253952) != 0):
                    self.state = 521
                    _la = self._input.LA(1)
                    if not((((_la) & ~0x3f) == 0 and ((1 << _la) & 253952) != 0)):
                        self._errHandler.recoverInline(self)
                    else:
                        self._errHandler.reportMatch(self)
                        self.consume()


                self.state = 524
                self.match(LaTeXParser.L_BRACE)
                self.state = 525
                self.expr()
                self.state = 526
                self.match(LaTeXParser.R_BRACE)
                pass
            elif token in [43]:
                self.enterOuterAlt(localctx, 4)
                self.state = 528
                self.match(LaTeXParser.L_BRACE_LITERAL)
                self.state = 529
                self.expr()
                self.state = 530
                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):
        __slots__ = 'parser'

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

        def BAR(self, i:int=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 L_VERT(self):
            return self.getToken(LaTeXParser.L_VERT, 0)

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

        def getRuleIndex(self):
            return LaTeXParser.RULE_abs_group

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

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

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




    def abs_group(self):

        localctx = LaTeXParser.Abs_groupContext(self, self._ctx, self.state)
        self.enterRule(localctx, 68, self.RULE_abs_group)
        try:
            self.state = 542
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [47]:
                self.enterOuterAlt(localctx, 1)
                self.state = 534
                self.match(LaTeXParser.BAR)
                self.state = 535
                self.expr()
                self.state = 536
                self.match(LaTeXParser.BAR)
                pass
            elif token in [53]:
                self.enterOuterAlt(localctx, 2)
                self.state = 538
                self.match(LaTeXParser.L_VERT)
                self.state = 539
                self.expr()
                self.state = 540
                self.match(LaTeXParser.R_VERT)
                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 NumberContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

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

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

        def getRuleIndex(self):
            return LaTeXParser.RULE_number

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

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

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




    def number(self):

        localctx = LaTeXParser.NumberContext(self, self._ctx, self.state)
        self.enterRule(localctx, 70, self.RULE_number)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 545 
            self._errHandler.sync(self)
            _alt = 1
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt == 1:
                    self.state = 544
                    self.match(LaTeXParser.DIGIT)

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

            self.state = 555
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,54,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 549
                    self.match(LaTeXParser.COMMA)
                    self.state = 550
                    self.match(LaTeXParser.DIGIT)
                    self.state = 551
                    self.match(LaTeXParser.DIGIT)
                    self.state = 552
                    self.match(LaTeXParser.DIGIT) 
                self.state = 557
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,54,self._ctx)

            self.state = 564
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,56,self._ctx)
            if la_ == 1:
                self.state = 558
                self.match(LaTeXParser.T__17)
                self.state = 560 
                self._errHandler.sync(self)
                _alt = 1
                while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                    if _alt == 1:
                        self.state = 559
                        self.match(LaTeXParser.DIGIT)

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



            self.state = 567
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,57,self._ctx)
            if la_ == 1:
                self.state = 566
                self.match(LaTeXParser.PERCENTAGE)


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


    class Special_symbolsContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

        def getRuleIndex(self):
            return LaTeXParser.RULE_special_symbols

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

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

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




    def special_symbols(self):

        localctx = LaTeXParser.Special_symbolsContext(self, self._ctx, self.state)
        self.enterRule(localctx, 72, self.RULE_special_symbols)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 569
            self.match(LaTeXParser.RIGHT_ARROW)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ModifierContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def MODIFIER(self):
            return self.getToken(LaTeXParser.MODIFIER, 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_modifier

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

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

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




    def modifier(self):

        localctx = LaTeXParser.ModifierContext(self, self._ctx, self.state)
        self.enterRule(localctx, 74, self.RULE_modifier)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 571
            self.match(LaTeXParser.MODIFIER)
            self.state = 572
            self.match(LaTeXParser.L_BRACE)
            self.state = 573
            self.expr()
            self.state = 574
            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 TupleContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

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


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

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

        def getRuleIndex(self):
            return LaTeXParser.RULE_tuple

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

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

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




    def tuple_(self):

        localctx = LaTeXParser.TupleContext(self, self._ctx, self.state)
        self.enterRule(localctx, 76, self.RULE_tuple)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 576
            self.match(LaTeXParser.L_PAREN)
            self.state = 577
            self.expr()
            self.state = 580 
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while True:
                self.state = 578
                self.match(LaTeXParser.COMMA)
                self.state = 579
                self.expr()
                self.state = 582 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if not (_la==158):
                    break

            self.state = 584
            self.match(LaTeXParser.R_PAREN)
        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):
        __slots__ = 'parser'

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

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


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

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

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

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


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

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

        def env(self):
            return self.getTypedRuleContext(LaTeXParser.EnvContext,0)


        def number(self):
            return self.getTypedRuleContext(LaTeXParser.NumberContext,0)


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

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


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


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


        def bars(self):
            return self.getTypedRuleContext(LaTeXParser.BarsContext,0)


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


        def modifier(self):
            return self.getTypedRuleContext(LaTeXParser.ModifierContext,0)


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

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

        def text(self):
            return self.getTypedRuleContext(LaTeXParser.TextContext,0)


        def tuple_(self):
            return self.getTypedRuleContext(LaTeXParser.TupleContext,0)


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

        def getRuleIndex(self):
            return LaTeXParser.RULE_atom

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

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

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




    def atom(self):

        localctx = LaTeXParser.AtomContext(self, self._ctx, self.state)
        self.enterRule(localctx, 78, self.RULE_atom)
        self._la = 0 # Token type
        try:
            self.state = 617
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,64,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 586
                self.frac()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 587
                _la = self._input.LA(1)
                if not((((_la) & ~0x3f) == 0 and ((1 << _la) & 524400) != 0) or ((((_la - 121)) & ~0x3f) == 0 and ((1 << (_la - 121)) & 17179869313) != 0)):
                    self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 600
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,63,self._ctx)
                if la_ == 1:
                    self.state = 589
                    self._errHandler.sync(self)
                    la_ = self._interp.adaptivePredict(self._input,59,self._ctx)
                    if la_ == 1:
                        self.state = 588
                        self.subexpr()


                    self.state = 592
                    self._errHandler.sync(self)
                    la_ = self._interp.adaptivePredict(self._input,60,self._ctx)
                    if la_ == 1:
                        self.state = 591
                        self.match(LaTeXParser.SINGLE_QUOTES)


                    pass

                elif la_ == 2:
                    self.state = 595
                    self._errHandler.sync(self)
                    la_ = self._interp.adaptivePredict(self._input,61,self._ctx)
                    if la_ == 1:
                        self.state = 594
                        self.match(LaTeXParser.SINGLE_QUOTES)


                    self.state = 598
                    self._errHandler.sync(self)
                    la_ = self._interp.adaptivePredict(self._input,62,self._ctx)
                    if la_ == 1:
                        self.state = 597
                        self.subexpr()


                    pass


                pass

            elif la_ == 3:
                self.enterOuterAlt(localctx, 3)
                self.state = 602
                self.match(LaTeXParser.DERIVATIVE_SYMBOLS)
                pass

            elif la_ == 4:
                self.enterOuterAlt(localctx, 4)
                self.state = 603
                self.env()
                pass

            elif la_ == 5:
                self.enterOuterAlt(localctx, 5)
                self.state = 604
                self.number()
                pass

            elif la_ == 6:
                self.enterOuterAlt(localctx, 6)
                self.state = 605
                self.match(LaTeXParser.DIFFERENTIAL)
                pass

            elif la_ == 7:
                self.enterOuterAlt(localctx, 7)
                self.state = 606
                self.mathit()
                pass

            elif la_ == 8:
                self.enterOuterAlt(localctx, 8)
                self.state = 607
                self.binom()
                pass

            elif la_ == 9:
                self.enterOuterAlt(localctx, 9)
                self.state = 608
                self.bra()
                pass

            elif la_ == 10:
                self.enterOuterAlt(localctx, 10)
                self.state = 609
                self.bars()
                pass

            elif la_ == 11:
                self.enterOuterAlt(localctx, 11)
                self.state = 610
                self.ket()
                pass

            elif la_ == 12:
                self.enterOuterAlt(localctx, 12)
                self.state = 611
                self.modifier()
                pass

            elif la_ == 13:
                self.enterOuterAlt(localctx, 13)
                self.state = 612
                self.match(LaTeXParser.IMAGINARY_UNIT)
                pass

            elif la_ == 14:
                self.enterOuterAlt(localctx, 14)
                self.state = 613
                self.match(LaTeXParser.INFINITY)
                pass

            elif la_ == 15:
                self.enterOuterAlt(localctx, 15)
                self.state = 614
                self.text()
                pass

            elif la_ == 16:
                self.enterOuterAlt(localctx, 16)
                self.state = 615
                self.tuple_()
                pass

            elif la_ == 17:
                self.enterOuterAlt(localctx, 17)
                self.state = 616
                self.match(LaTeXParser.DOTS)
                pass


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


    class ProbabilityContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

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

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

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

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

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

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

        def atom(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(LaTeXParser.AtomContext)
            else:
                return self.getTypedRuleContext(LaTeXParser.AtomContext,i)


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

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


        def getRuleIndex(self):
            return LaTeXParser.RULE_probability

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

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

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




    def probability(self):

        localctx = LaTeXParser.ProbabilityContext(self, self._ctx, self.state)
        self.enterRule(localctx, 80, self.RULE_probability)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 619
            self.match(LaTeXParser.PROBABILITY)
            self.state = 620
            _la = self._input.LA(1)
            if not(_la==39 or _la==45):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
            self.state = 635
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,67,self._ctx)
            if la_ == 1:
                self.state = 621
                self.match(LaTeXParser.LETTER)
                self.state = 623
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==112:
                    self.state = 622
                    self.subexpr()


                pass

            elif la_ == 2:
                self.state = 625
                self.match(LaTeXParser.LETTER)
                self.state = 626
                self.match(LaTeXParser.EQUAL)
                self.state = 627
                self.match(LaTeXParser.LETTER)
                self.state = 629
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==112:
                    self.state = 628
                    self.subexpr()


                pass

            elif la_ == 3:
                self.state = 631
                self.atom()
                self.state = 632
                self.match(LaTeXParser.BAR)
                self.state = 633
                self.atom()
                pass


            self.state = 637
            _la = self._input.LA(1)
            if not(_la==40 or _la==46):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class BarsContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

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


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

        def getRuleIndex(self):
            return LaTeXParser.RULE_bars

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

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

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




    def bars(self):

        localctx = LaTeXParser.BarsContext(self, self._ctx, self.state)
        self.enterRule(localctx, 82, self.RULE_bars)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 639
            self.match(LaTeXParser.L_BAR)
            self.state = 640
            self.expr()
            self.state = 641
            self.match(LaTeXParser.R_BAR)
        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):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__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 enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterBra" ):
                listener.enterBra(self)

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

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




    def bra(self):

        localctx = LaTeXParser.BraContext(self, self._ctx, self.state)
        self.enterRule(localctx, 84, self.RULE_bra)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 643
            self.match(LaTeXParser.L_ANGLE)
            self.state = 644
            self.expr()
            self.state = 645
            _la = self._input.LA(1)
            if not(_la==47 or _la==49):
                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):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__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 enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterKet" ):
                listener.enterKet(self)

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

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




    def ket(self):

        localctx = LaTeXParser.KetContext(self, self._ctx, self.state)
        self.enterRule(localctx, 86, self.RULE_ket)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 647
            _la = self._input.LA(1)
            if not(_la==47 or _la==50):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
            self.state = 648
            self.expr()
            self.state = 649
            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):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__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 enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterMathit" ):
                listener.enterMathit(self)

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

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




    def mathit(self):

        localctx = LaTeXParser.MathitContext(self, self._ctx, self.state)
        self.enterRule(localctx, 88, self.RULE_mathit)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 651
            self.match(LaTeXParser.CMD_MATHIT)
            self.state = 652
            self.match(LaTeXParser.L_BRACE)
            self.state = 653
            self.mathit_text()
            self.state = 654
            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):
        __slots__ = 'parser'

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

        def LETTER(self, i:int=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 enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterMathit_text" ):
                listener.enterMathit_text(self)

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

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




    def mathit_text(self):

        localctx = LaTeXParser.Mathit_textContext(self, self._ctx, self.state)
        self.enterRule(localctx, 90, self.RULE_mathit_text)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 659
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==128:
                self.state = 656
                self.match(LaTeXParser.LETTER)
                self.state = 661
                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):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser
            self.upperd = None # Token
            self.upper = None # ExprContext
            self.lowerd = None # Token
            self.lowers = None # Token
            self.lower = None # ExprContext

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

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

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

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

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


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

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

        def getRuleIndex(self):
            return LaTeXParser.RULE_frac

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

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

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




    def frac(self):

        localctx = LaTeXParser.FracContext(self, self._ctx, self.state)
        self.enterRule(localctx, 92, self.RULE_frac)
        self._la = 0 # Token type
        try:
            self.state = 684
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [105]:
                self.enterOuterAlt(localctx, 1)
                self.state = 662
                self.match(LaTeXParser.CMD_FRAC)
                self.state = 668
                self._errHandler.sync(self)
                token = self._input.LA(1)
                if token in [129]:
                    self.state = 663
                    localctx.upperd = self.match(LaTeXParser.DIGIT)
                    pass
                elif token in [41]:
                    self.state = 664
                    self.match(LaTeXParser.L_BRACE)
                    self.state = 665
                    localctx.upper = self.expr()
                    self.state = 666
                    self.match(LaTeXParser.R_BRACE)
                    pass
                else:
                    raise NoViableAltException(self)

                self.state = 676
                self._errHandler.sync(self)
                token = self._input.LA(1)
                if token in [129]:
                    self.state = 670
                    localctx.lowerd = self.match(LaTeXParser.DIGIT)
                    pass
                elif token in [4, 5, 6, 128]:
                    self.state = 671
                    localctx.lowers = self._input.LT(1)
                    _la = self._input.LA(1)
                    if not((((_la) & ~0x3f) == 0 and ((1 << _la) & 112) != 0) or _la==128):
                        localctx.lowers = self._errHandler.recoverInline(self)
                    else:
                        self._errHandler.reportMatch(self)
                        self.consume()
                    pass
                elif token in [41]:
                    self.state = 672
                    self.match(LaTeXParser.L_BRACE)
                    self.state = 673
                    localctx.lower = self.expr()
                    self.state = 674
                    self.match(LaTeXParser.R_BRACE)
                    pass
                else:
                    raise NoViableAltException(self)

                pass
            elif token in [41]:
                self.enterOuterAlt(localctx, 2)
                self.state = 678
                self.match(LaTeXParser.L_BRACE)
                self.state = 679
                self.expr()
                self.state = 680
                self.match(LaTeXParser.FUNC_OVER)
                self.state = 681
                self.expr()
                self.state = 682
                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 BinomContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

        def R_BRACE(self, i:int=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:int=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 enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterBinom" ):
                listener.enterBinom(self)

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

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




    def binom(self):

        localctx = LaTeXParser.BinomContext(self, self._ctx, self.state)
        self.enterRule(localctx, 94, self.RULE_binom)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 686
            _la = self._input.LA(1)
            if not(((((_la - 106)) & ~0x3f) == 0 and ((1 << (_la - 106)) & 7) != 0)):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
            self.state = 687
            self.match(LaTeXParser.L_BRACE)
            self.state = 688
            localctx.n = self.expr()
            self.state = 689
            self.match(LaTeXParser.R_BRACE)
            self.state = 690
            self.match(LaTeXParser.L_BRACE)
            self.state = 691
            localctx.k = self.expr()
            self.state = 692
            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):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__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 enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterFloor" ):
                listener.enterFloor(self)

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

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




    def floor(self):

        localctx = LaTeXParser.FloorContext(self, self._ctx, self.state)
        self.enterRule(localctx, 96, self.RULE_floor)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 694
            self.match(LaTeXParser.L_FLOOR)
            self.state = 695
            localctx.val = self.expr()
            self.state = 696
            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):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__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 enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterCeil" ):
                listener.enterCeil(self)

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

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




    def ceil(self):

        localctx = LaTeXParser.CeilContext(self, self._ctx, self.state)
        self.enterRule(localctx, 98, self.RULE_ceil)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 698
            self.match(LaTeXParser.L_CEIL)
            self.state = 699
            localctx.val = self.expr()
            self.state = 700
            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):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__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_LG(self):
            return self.getToken(LaTeXParser.FUNC_LG, 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 FUNC_DET(self):
            return self.getToken(LaTeXParser.FUNC_DET, 0)

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

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

        def getRuleIndex(self):
            return LaTeXParser.RULE_func_normal

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

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

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




    def func_normal(self):

        localctx = LaTeXParser.Func_normalContext(self, self._ctx, self.state)
        self.enterRule(localctx, 100, self.RULE_func_normal)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 702
            _la = self._input.LA(1)
            if not(((((_la - 64)) & ~0x3f) == 0 and ((1 << (_la - 64)) & 473956351) != 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 Func_bracketContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

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

        def getRuleIndex(self):
            return LaTeXParser.RULE_func_bracket

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

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

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




    def func_bracket(self):

        localctx = LaTeXParser.Func_bracketContext(self, self._ctx, self.state)
        self.enterRule(localctx, 102, self.RULE_func_bracket)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 704
            _la = self._input.LA(1)
            if not(_la==86 or _la==88):
                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 Func_binary_bracketContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

        def getRuleIndex(self):
            return LaTeXParser.RULE_func_binary_bracket

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

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

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




    def func_binary_bracket(self):

        localctx = LaTeXParser.Func_binary_bracketContext(self, self._ctx, self.state)
        self.enterRule(localctx, 104, self.RULE_func_binary_bracket)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 706
            self.match(LaTeXParser.FUNC_COV)
        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):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__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 func_bracket(self):
            return self.getTypedRuleContext(LaTeXParser.Func_bracketContext,0)


        def func_binary_bracket(self):
            return self.getTypedRuleContext(LaTeXParser.Func_binary_bracketContext,0)


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

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


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

        def FUNC_INT(self):
            return self.getToken(LaTeXParser.FUNC_INT, 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 FUNC_OVERLINE(self):
            return self.getToken(LaTeXParser.FUNC_OVERLINE, 0)

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


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


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

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

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

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

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


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

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

        def func_arg(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(LaTeXParser.Func_argContext)
            else:
                return self.getTypedRuleContext(LaTeXParser.Func_argContext,i)


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


        def COMMA(self):
            return self.getToken(LaTeXParser.COMMA, 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 subeq(self):
            return self.getTypedRuleContext(LaTeXParser.SubeqContext,0)


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


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

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

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

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


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

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


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

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

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

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

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

        def formulas(self):
            return self.getTypedRuleContext(LaTeXParser.FormulasContext,0)


        def set_(self):
            return self.getTypedRuleContext(LaTeXParser.SetContext,0)


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


        def probability(self):
            return self.getTypedRuleContext(LaTeXParser.ProbabilityContext,0)


        def getRuleIndex(self):
            return LaTeXParser.RULE_func

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

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

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




    def func(self):

        localctx = LaTeXParser.FuncContext(self, self._ctx, self.state)
        self.enterRule(localctx, 106, self.RULE_func)
        self._la = 0 # Token type
        try:
            self.state = 844
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,95,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 709
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==125:
                    self.state = 708
                    self.match(LaTeXParser.DDX)


                self.state = 828
                self._errHandler.sync(self)
                token = self._input.LA(1)
                if token in [64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 90, 91, 92]:
                    self.state = 711
                    self.func_normal()
                    self.state = 724
                    self._errHandler.sync(self)
                    la_ = self._interp.adaptivePredict(self._input,77,self._ctx)
                    if la_ == 1:
                        self.state = 713
                        self._errHandler.sync(self)
                        _la = self._input.LA(1)
                        if _la==112:
                            self.state = 712
                            self.subexpr()


                        self.state = 716
                        self._errHandler.sync(self)
                        _la = self._input.LA(1)
                        if _la==113:
                            self.state = 715
                            self.supexpr()


                        pass

                    elif la_ == 2:
                        self.state = 719
                        self._errHandler.sync(self)
                        _la = self._input.LA(1)
                        if _la==113:
                            self.state = 718
                            self.supexpr()


                        self.state = 722
                        self._errHandler.sync(self)
                        _la = self._input.LA(1)
                        if _la==112:
                            self.state = 721
                            self.subexpr()


                        pass


                    self.state = 731
                    self._errHandler.sync(self)
                    la_ = self._interp.adaptivePredict(self._input,78,self._ctx)
                    if la_ == 1:
                        self.state = 726
                        _la = self._input.LA(1)
                        if not(_la==39 or _la==41):
                            self._errHandler.recoverInline(self)
                        else:
                            self._errHandler.reportMatch(self)
                            self.consume()
                        self.state = 727
                        self.func_arg()
                        self.state = 728
                        _la = self._input.LA(1)
                        if not(_la==40 or _la==42):
                            self._errHandler.recoverInline(self)
                        else:
                            self._errHandler.reportMatch(self)
                            self.consume()
                        pass

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


                    pass
                elif token in [86, 88]:
                    self.state = 733
                    self.func_bracket()
                    self.state = 739
                    self._errHandler.sync(self)
                    la_ = self._interp.adaptivePredict(self._input,79,self._ctx)
                    if la_ == 1:
                        self.state = 734
                        _la = self._input.LA(1)
                        if not(_la==39 or _la==45):
                            self._errHandler.recoverInline(self)
                        else:
                            self._errHandler.reportMatch(self)
                            self.consume()
                        self.state = 735
                        self.func_arg()
                        self.state = 736
                        _la = self._input.LA(1)
                        if not(_la==40 or _la==46):
                            self._errHandler.recoverInline(self)
                        else:
                            self._errHandler.reportMatch(self)
                            self.consume()
                        pass

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


                    pass
                elif token in [87]:
                    self.state = 741
                    self.func_binary_bracket()

                    self.state = 742
                    _la = self._input.LA(1)
                    if not(_la==39 or _la==45):
                        self._errHandler.recoverInline(self)
                    else:
                        self._errHandler.reportMatch(self)
                        self.consume()
                    self.state = 743
                    self.func_arg()
                    self.state = 744
                    self.match(LaTeXParser.COMMA)
                    self.state = 745
                    self.func_arg()
                    self.state = 746
                    _la = self._input.LA(1)
                    if not(_la==40 or _la==46):
                        self._errHandler.recoverInline(self)
                    else:
                        self._errHandler.reportMatch(self)
                        self.consume()
                    pass
                elif token in [121, 128, 155]:
                    self.state = 748
                    _la = self._input.LA(1)
                    if not(((((_la - 121)) & ~0x3f) == 0 and ((1 << (_la - 121)) & 17179869313) != 0)):
                        self._errHandler.recoverInline(self)
                    else:
                        self._errHandler.reportMatch(self)
                        self.consume()
                    self.state = 770
                    self._errHandler.sync(self)
                    la_ = self._interp.adaptivePredict(self._input,85,self._ctx)
                    if la_ == 1:
                        self.state = 750
                        self._errHandler.sync(self)
                        _la = self._input.LA(1)
                        if _la==112:
                            self.state = 749
                            self.subexpr()


                        self.state = 762
                        self._errHandler.sync(self)
                        la_ = self._interp.adaptivePredict(self._input,82,self._ctx)
                        if la_ == 1:
                            self.state = 753
                            self._errHandler.sync(self)
                            _la = self._input.LA(1)
                            if _la==146:
                                self.state = 752
                                self.match(LaTeXParser.SINGLE_QUOTES)


                            pass

                        elif la_ == 2:
                            self.state = 755
                            self.match(LaTeXParser.CARET)
                            self.state = 756
                            self.match(LaTeXParser.L_BRACE)
                            self.state = 757
                            self.match(LaTeXParser.L_PAREN)
                            self.state = 758
                            self.atom()
                            self.state = 759
                            self.match(LaTeXParser.R_PAREN)
                            self.state = 760
                            self.match(LaTeXParser.R_BRACE)
                            pass


                        pass

                    elif la_ == 2:
                        self.state = 765
                        self._errHandler.sync(self)
                        _la = self._input.LA(1)
                        if _la==146:
                            self.state = 764
                            self.match(LaTeXParser.SINGLE_QUOTES)


                        self.state = 768
                        self._errHandler.sync(self)
                        _la = self._input.LA(1)
                        if _la==112:
                            self.state = 767
                            self.subexpr()


                        pass


                    self.state = 773
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if _la==113:
                        self.state = 772
                        self.supexpr()


                    self.state = 775
                    self.match(LaTeXParser.L_PAREN)
                    self.state = 776
                    self.args()
                    self.state = 777
                    self.match(LaTeXParser.R_PAREN)
                    pass
                elif token in [61]:
                    self.state = 779
                    self.match(LaTeXParser.FUNC_INT)
                    self.state = 786
                    self._errHandler.sync(self)
                    token = self._input.LA(1)
                    if token in [112]:
                        self.state = 780
                        self.subexpr()
                        self.state = 781
                        self.supexpr()
                        pass
                    elif token in [113]:
                        self.state = 783
                        self.supexpr()
                        self.state = 784
                        self.subexpr()
                        pass
                    elif token in [1, 2, 3, 4, 5, 6, 11, 13, 14, 15, 16, 17, 19, 31, 33, 34, 39, 41, 43, 45, 47, 50, 51, 53, 55, 56, 57, 58, 59, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 95, 97, 99, 100, 105, 106, 107, 108, 111, 115, 121, 125, 126, 127, 128, 129, 147, 149, 155, 156, 157]:
                        pass
                    else:
                        pass
                    self.state = 794
                    self._errHandler.sync(self)
                    la_ = self._interp.adaptivePredict(self._input,89,self._ctx)
                    if la_ == 1:
                        self.state = 789
                        self._errHandler.sync(self)
                        la_ = self._interp.adaptivePredict(self._input,88,self._ctx)
                        if la_ == 1:
                            self.state = 788
                            self.additive(0)


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

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

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


                    pass
                elif token in [99]:
                    self.state = 796
                    self.match(LaTeXParser.FUNC_SQRT)
                    self.state = 801
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if _la==45:
                        self.state = 797
                        self.match(LaTeXParser.L_BRACKET)
                        self.state = 798
                        localctx.root = self.expr()
                        self.state = 799
                        self.match(LaTeXParser.R_BRACKET)


                    self.state = 803
                    self.match(LaTeXParser.L_BRACE)
                    self.state = 804
                    localctx.base = self.expr()
                    self.state = 805
                    self.match(LaTeXParser.R_BRACE)
                    pass
                elif token in [100]:
                    self.state = 807
                    self.match(LaTeXParser.FUNC_OVERLINE)
                    self.state = 808
                    self.match(LaTeXParser.L_BRACE)
                    self.state = 809
                    localctx.base = self.expr()
                    self.state = 810
                    self.match(LaTeXParser.R_BRACE)
                    pass
                elif token in [62, 63]:
                    self.state = 812
                    _la = self._input.LA(1)
                    if not(_la==62 or _la==63):
                        self._errHandler.recoverInline(self)
                    else:
                        self._errHandler.reportMatch(self)
                        self.consume()
                    self.state = 820
                    self._errHandler.sync(self)
                    la_ = self._interp.adaptivePredict(self._input,91,self._ctx)
                    if la_ == 1:
                        self.state = 813
                        self.subeq()
                        self.state = 814
                        self.supexpr()
                        pass

                    elif la_ == 2:
                        self.state = 816
                        self.supexpr()
                        self.state = 817
                        self.subeq()
                        pass

                    elif la_ == 3:
                        self.state = 819
                        self.subeq()
                        pass


                    self.state = 822
                    self.mp(0)
                    pass
                elif token in [55]:
                    self.state = 824
                    self.match(LaTeXParser.FUNC_LIM)
                    self.state = 825
                    self.limit_sub()
                    self.state = 826
                    self.mp(0)
                    pass
                else:
                    raise NoViableAltException(self)

                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 830
                _la = self._input.LA(1)
                if not((((_la) & ~0x3f) == 0 and ((1 << _la) & 1080863910568919040) != 0)):
                    self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 832
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==112:
                    self.state = 831
                    self.subexpr()


                self.state = 834
                _la = self._input.LA(1)
                if not(_la==39 or _la==41):
                    self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 837
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,94,self._ctx)
                if la_ == 1:
                    self.state = 835
                    self.formulas()
                    pass

                elif la_ == 2:
                    self.state = 836
                    self.set_()
                    pass


                self.state = 839
                _la = self._input.LA(1)
                if not(_la==40 or _la==42):
                    self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                pass

            elif la_ == 3:
                self.enterOuterAlt(localctx, 3)
                self.state = 841
                self.match(LaTeXParser.DDX)
                self.state = 842
                self.group()
                pass

            elif la_ == 4:
                self.enterOuterAlt(localctx, 4)
                self.state = 843
                self.probability()
                pass


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

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

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


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

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


        def getRuleIndex(self):
            return LaTeXParser.RULE_args

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

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

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




    def args(self):

        localctx = LaTeXParser.ArgsContext(self, self._ctx, self.state)
        self.enterRule(localctx, 108, self.RULE_args)
        try:
            self.state = 851
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,96,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 846
                self.expr()
                self.state = 847
                self.match(LaTeXParser.COMMA)
                self.state = 848
                self.args()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 850
                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):
        __slots__ = 'parser'

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

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

        def L_BRACE(self, i:int=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:int=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 enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterLimit_sub" ):
                listener.enterLimit_sub(self)

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

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




    def limit_sub(self):

        localctx = LaTeXParser.Limit_subContext(self, self._ctx, self.state)
        self.enterRule(localctx, 110, self.RULE_limit_sub)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 853
            self.match(LaTeXParser.UNDERSCORE)
            self.state = 854
            self.match(LaTeXParser.L_BRACE)
            self.state = 855
            _la = self._input.LA(1)
            if not(_la==128 or _la==155):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
            self.state = 856
            self.match(LaTeXParser.LIM_APPROACH_SYM)
            self.state = 857
            self.expr()
            self.state = 866
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==113:
                self.state = 858
                self.match(LaTeXParser.CARET)
                self.state = 864
                self._errHandler.sync(self)
                token = self._input.LA(1)
                if token in [41]:
                    self.state = 859
                    self.match(LaTeXParser.L_BRACE)
                    self.state = 860
                    _la = self._input.LA(1)
                    if not(_la==33 or _la==34):
                        self._errHandler.recoverInline(self)
                    else:
                        self._errHandler.reportMatch(self)
                        self.consume()
                    self.state = 861
                    self.match(LaTeXParser.R_BRACE)
                    pass
                elif token in [33]:
                    self.state = 862
                    self.match(LaTeXParser.ADD)
                    pass
                elif token in [34]:
                    self.state = 863
                    self.match(LaTeXParser.SUB)
                    pass
                else:
                    raise NoViableAltException(self)



            self.state = 868
            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):
        __slots__ = 'parser'

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

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


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

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


        def getRuleIndex(self):
            return LaTeXParser.RULE_func_arg

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

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

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




    def func_arg(self):

        localctx = LaTeXParser.Func_argContext(self, self._ctx, self.state)
        self.enterRule(localctx, 112, self.RULE_func_arg)
        try:
            self.state = 875
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,99,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 870
                self.expr()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 871
                self.expr()
                self.state = 872
                self.match(LaTeXParser.COMMA)
                self.state = 873
                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):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__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 enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterFunc_arg_noparens" ):
                listener.enterFunc_arg_noparens(self)

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

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




    def func_arg_noparens(self):

        localctx = LaTeXParser.Func_arg_noparensContext(self, self._ctx, self.state)
        self.enterRule(localctx, 114, self.RULE_func_arg_noparens)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 877
            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):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__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 R_BRACE(self):
            return self.getToken(LaTeXParser.R_BRACE, 0)

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


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

        def variable(self):
            return self.getTypedRuleContext(LaTeXParser.VariableContext,0)


        def getRuleIndex(self):
            return LaTeXParser.RULE_subexpr

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

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

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




    def subexpr(self):

        localctx = LaTeXParser.SubexprContext(self, self._ctx, self.state)
        self.enterRule(localctx, 116, self.RULE_subexpr)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 879
            self.match(LaTeXParser.UNDERSCORE)
            self.state = 894
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,101,self._ctx)
            if la_ == 1:
                self.state = 880
                self.atom()
                pass

            elif la_ == 2:
                self.state = 881
                self.match(LaTeXParser.L_BRACE)
                self.state = 884
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,100,self._ctx)
                if la_ == 1:
                    self.state = 882
                    self.expr()
                    pass

                elif la_ == 2:
                    self.state = 883
                    self.variable()
                    pass


                self.state = 886
                self.match(LaTeXParser.R_BRACE)
                pass

            elif la_ == 3:
                self.state = 888
                self.match(LaTeXParser.L_BRACE)
                self.state = 889
                self.expr()
                self.state = 890
                self.match(LaTeXParser.COMMA)
                self.state = 891
                self.expr()
                self.state = 892
                self.match(LaTeXParser.R_BRACE)
                pass


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

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__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 enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterSupexpr" ):
                listener.enterSupexpr(self)

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

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




    def supexpr(self):

        localctx = LaTeXParser.SupexprContext(self, self._ctx, self.state)
        self.enterRule(localctx, 118, self.RULE_supexpr)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 896
            self.match(LaTeXParser.CARET)
            self.state = 902
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,102,self._ctx)
            if la_ == 1:
                self.state = 897
                self.atom()
                pass

            elif la_ == 2:
                self.state = 898
                self.match(LaTeXParser.L_BRACE)
                self.state = 899
                self.expr()
                self.state = 900
                self.match(LaTeXParser.R_BRACE)
                pass


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

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__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 equality(self):
            return self.getTypedRuleContext(LaTeXParser.EqualityContext,0)


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


        def text(self):
            return self.getTypedRuleContext(LaTeXParser.TextContext,0)


        def getRuleIndex(self):
            return LaTeXParser.RULE_subeq

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

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

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




    def subeq(self):

        localctx = LaTeXParser.SubeqContext(self, self._ctx, self.state)
        self.enterRule(localctx, 120, self.RULE_subeq)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 904
            self.match(LaTeXParser.UNDERSCORE)
            self.state = 905
            self.match(LaTeXParser.L_BRACE)
            self.state = 911
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,104,self._ctx)
            if la_ == 1:
                self.state = 906
                self.equality()
                pass

            elif la_ == 2:
                self.state = 907
                self.atom()
                self.state = 909
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if (((_la) & ~0x3f) == 0 and ((1 << _la) & 14) != 0):
                    self.state = 908
                    self.text()


                pass


            self.state = 913
            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):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__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 enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterSupeq" ):
                listener.enterSupeq(self)

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

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




    def supeq(self):

        localctx = LaTeXParser.SupeqContext(self, self._ctx, self.state)
        self.enterRule(localctx, 122, self.RULE_supeq)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 915
            self.match(LaTeXParser.UNDERSCORE)
            self.state = 916
            self.match(LaTeXParser.L_BRACE)
            self.state = 917
            self.equality()
            self.state = 918
            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:RuleContext, ruleIndex:int, predIndex:int):
        if self._predicates == None:
            self._predicates = dict()
        self._predicates[1] = self.implication_sempred
        self._predicates[8] = self.relation_sempred
        self._predicates[17] = self.additive_sempred
        self._predicates[18] = self.mp_sempred
        self._predicates[19] = self.operator_sempred
        self._predicates[20] = self.mp_nofunc_sempred
        self._predicates[29] = self.exp_sempred
        self._predicates[30] = 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 implication_sempred(self, localctx:ImplicationContext, predIndex:int):
            if predIndex == 0:
                return self.precpred(self._ctx, 3)
         

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

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

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

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

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

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

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




