# Generated from LaTeX.g4 by ANTLR 4.13.2
# encoding: utf-8
from antlr4 import *
from io import StringIO
import sys
if sys.version_info[1] > 5:
	from typing import TextIO
else:
	from typing.io import TextIO

def serializedATN():
    return [
        4,1,91,535,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,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,5,1,93,8,1,10,
        1,12,1,96,9,1,1,2,1,2,1,2,1,2,1,3,1,3,1,4,1,4,1,4,1,4,1,4,1,4,5,
        4,110,8,4,10,4,12,4,113,9,4,1,5,1,5,1,5,1,5,1,5,1,5,5,5,121,8,5,
        10,5,12,5,124,9,5,1,6,1,6,1,6,1,6,1,6,1,6,5,6,132,8,6,10,6,12,6,
        135,9,6,1,7,1,7,1,7,1,7,1,7,1,7,5,7,143,8,7,10,7,12,7,146,9,7,1,
        8,1,8,1,8,4,8,151,8,8,11,8,12,8,152,3,8,155,8,8,1,9,1,9,1,9,1,9,
        5,9,161,8,9,10,9,12,9,164,9,9,3,9,166,8,9,1,10,1,10,5,10,170,8,10,
        10,10,12,10,173,9,10,1,11,1,11,5,11,177,8,11,10,11,12,11,180,9,11,
        1,12,1,12,3,12,184,8,12,1,13,1,13,1,13,1,13,1,13,1,13,3,13,192,8,
        13,1,14,1,14,1,14,1,14,3,14,198,8,14,1,14,1,14,1,15,1,15,1,15,1,
        15,3,15,206,8,15,1,15,1,15,1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,
        16,1,16,1,16,3,16,220,8,16,1,16,3,16,223,8,16,5,16,225,8,16,10,16,
        12,16,228,9,16,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,
        3,17,240,8,17,1,17,3,17,243,8,17,5,17,245,8,17,10,17,12,17,248,9,
        17,1,18,1,18,1,18,1,18,1,18,1,18,3,18,256,8,18,1,19,1,19,1,19,1,
        19,1,19,3,19,263,8,19,1,20,1,20,1,20,1,20,1,20,1,20,1,20,1,20,1,
        20,1,20,1,20,1,20,1,20,1,20,1,20,1,20,3,20,281,8,20,1,21,1,21,1,
        21,1,21,1,22,4,22,288,8,22,11,22,12,22,289,1,22,1,22,1,22,1,22,5,
        22,296,8,22,10,22,12,22,299,9,22,1,22,1,22,4,22,303,8,22,11,22,12,
        22,304,3,22,307,8,22,1,23,1,23,3,23,311,8,23,1,23,3,23,314,8,23,
        1,23,3,23,317,8,23,1,23,3,23,320,8,23,3,23,322,8,23,1,23,1,23,1,
        23,1,23,1,23,1,23,1,23,3,23,331,8,23,1,24,1,24,1,24,1,24,1,25,1,
        25,1,25,1,25,1,26,1,26,1,26,1,26,1,26,1,27,5,27,347,8,27,10,27,12,
        27,350,9,27,1,28,1,28,1,28,1,28,1,28,1,28,3,28,358,8,28,1,28,1,28,
        1,28,1,28,1,28,3,28,365,8,28,1,29,1,29,1,29,1,29,1,29,1,29,1,29,
        1,29,1,30,1,30,1,30,1,30,1,31,1,31,1,31,1,31,1,32,1,32,1,33,1,33,
        3,33,387,8,33,1,33,3,33,390,8,33,1,33,3,33,393,8,33,1,33,3,33,396,
        8,33,3,33,398,8,33,1,33,1,33,1,33,1,33,1,33,3,33,405,8,33,1,33,1,
        33,3,33,409,8,33,1,33,3,33,412,8,33,1,33,3,33,415,8,33,1,33,3,33,
        418,8,33,3,33,420,8,33,1,33,1,33,1,33,1,33,1,33,1,33,1,33,1,33,1,
        33,1,33,1,33,3,33,433,8,33,1,33,3,33,436,8,33,1,33,1,33,1,33,3,33,
        441,8,33,1,33,1,33,1,33,1,33,1,33,3,33,448,8,33,1,33,1,33,1,33,1,
        33,1,33,1,33,1,33,1,33,1,33,1,33,1,33,1,33,1,33,1,33,1,33,1,33,3,
        33,466,8,33,1,33,1,33,1,33,1,33,1,33,1,33,3,33,474,8,33,1,34,1,34,
        1,34,1,34,1,34,3,34,481,8,34,1,35,1,35,1,35,1,35,1,35,1,35,1,35,
        1,35,1,35,1,35,1,35,3,35,494,8,35,3,35,496,8,35,1,35,1,35,1,36,1,
        36,1,36,1,36,1,36,3,36,505,8,36,1,37,1,37,1,38,1,38,1,38,1,38,1,
        38,1,38,3,38,515,8,38,1,39,1,39,1,39,1,39,1,39,1,39,3,39,523,8,39,
        1,40,1,40,1,40,1,40,1,40,1,41,1,41,1,41,1,41,1,41,1,41,0,7,2,8,10,
        12,14,32,34,42,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,0,9,2,0,79,82,85,86,1,0,15,16,3,0,17,18,65,67,75,75,2,0,77,
        77,91,91,1,0,27,28,2,0,27,27,29,29,1,0,69,71,1,0,37,58,1,0,35,36,
        576,0,84,1,0,0,0,2,86,1,0,0,0,4,97,1,0,0,0,6,101,1,0,0,0,8,103,1,
        0,0,0,10,114,1,0,0,0,12,125,1,0,0,0,14,136,1,0,0,0,16,154,1,0,0,
        0,18,165,1,0,0,0,20,167,1,0,0,0,22,174,1,0,0,0,24,183,1,0,0,0,26,
        185,1,0,0,0,28,193,1,0,0,0,30,201,1,0,0,0,32,209,1,0,0,0,34,229,
        1,0,0,0,36,255,1,0,0,0,38,262,1,0,0,0,40,280,1,0,0,0,42,282,1,0,
        0,0,44,287,1,0,0,0,46,330,1,0,0,0,48,332,1,0,0,0,50,336,1,0,0,0,
        52,340,1,0,0,0,54,348,1,0,0,0,56,351,1,0,0,0,58,366,1,0,0,0,60,374,
        1,0,0,0,62,378,1,0,0,0,64,382,1,0,0,0,66,473,1,0,0,0,68,480,1,0,
        0,0,70,482,1,0,0,0,72,504,1,0,0,0,74,506,1,0,0,0,76,508,1,0,0,0,
        78,516,1,0,0,0,80,524,1,0,0,0,82,529,1,0,0,0,84,85,3,2,1,0,85,1,
        1,0,0,0,86,87,6,1,-1,0,87,88,3,6,3,0,88,94,1,0,0,0,89,90,10,2,0,
        0,90,91,7,0,0,0,91,93,3,2,1,3,92,89,1,0,0,0,93,96,1,0,0,0,94,92,
        1,0,0,0,94,95,1,0,0,0,95,3,1,0,0,0,96,94,1,0,0,0,97,98,3,6,3,0,98,
        99,5,79,0,0,99,100,3,6,3,0,100,5,1,0,0,0,101,102,3,8,4,0,102,7,1,
        0,0,0,103,104,6,4,-1,0,104,105,3,10,5,0,105,111,1,0,0,0,106,107,
        10,2,0,0,107,108,7,0,0,0,108,110,3,8,4,3,109,106,1,0,0,0,110,113,
        1,0,0,0,111,109,1,0,0,0,111,112,1,0,0,0,112,9,1,0,0,0,113,111,1,
        0,0,0,114,115,6,5,-1,0,115,116,3,12,6,0,116,122,1,0,0,0,117,118,
        10,2,0,0,118,119,7,1,0,0,119,121,3,10,5,3,120,117,1,0,0,0,121,124,
        1,0,0,0,122,120,1,0,0,0,122,123,1,0,0,0,123,11,1,0,0,0,124,122,1,
        0,0,0,125,126,6,6,-1,0,126,127,3,16,8,0,127,133,1,0,0,0,128,129,
        10,2,0,0,129,130,7,2,0,0,130,132,3,12,6,3,131,128,1,0,0,0,132,135,
        1,0,0,0,133,131,1,0,0,0,133,134,1,0,0,0,134,13,1,0,0,0,135,133,1,
        0,0,0,136,137,6,7,-1,0,137,138,3,18,9,0,138,144,1,0,0,0,139,140,
        10,2,0,0,140,141,7,2,0,0,141,143,3,14,7,3,142,139,1,0,0,0,143,146,
        1,0,0,0,144,142,1,0,0,0,144,145,1,0,0,0,145,15,1,0,0,0,146,144,1,
        0,0,0,147,148,7,1,0,0,148,155,3,16,8,0,149,151,3,20,10,0,150,149,
        1,0,0,0,151,152,1,0,0,0,152,150,1,0,0,0,152,153,1,0,0,0,153,155,
        1,0,0,0,154,147,1,0,0,0,154,150,1,0,0,0,155,17,1,0,0,0,156,157,7,
        1,0,0,157,166,3,18,9,0,158,162,3,20,10,0,159,161,3,22,11,0,160,159,
        1,0,0,0,161,164,1,0,0,0,162,160,1,0,0,0,162,163,1,0,0,0,163,166,
        1,0,0,0,164,162,1,0,0,0,165,156,1,0,0,0,165,158,1,0,0,0,166,19,1,
        0,0,0,167,171,3,32,16,0,168,170,3,24,12,0,169,168,1,0,0,0,170,173,
        1,0,0,0,171,169,1,0,0,0,171,172,1,0,0,0,172,21,1,0,0,0,173,171,1,
        0,0,0,174,178,3,34,17,0,175,177,3,24,12,0,176,175,1,0,0,0,177,180,
        1,0,0,0,178,176,1,0,0,0,178,179,1,0,0,0,179,23,1,0,0,0,180,178,1,
        0,0,0,181,184,5,89,0,0,182,184,3,26,13,0,183,181,1,0,0,0,183,182,
        1,0,0,0,184,25,1,0,0,0,185,191,5,27,0,0,186,192,3,30,15,0,187,192,
        3,28,14,0,188,189,3,30,15,0,189,190,3,28,14,0,190,192,1,0,0,0,191,
        186,1,0,0,0,191,187,1,0,0,0,191,188,1,0,0,0,192,27,1,0,0,0,193,194,
        5,73,0,0,194,197,5,21,0,0,195,198,3,6,3,0,196,198,3,4,2,0,197,195,
        1,0,0,0,197,196,1,0,0,0,198,199,1,0,0,0,199,200,5,22,0,0,200,29,
        1,0,0,0,201,202,5,74,0,0,202,205,5,21,0,0,203,206,3,6,3,0,204,206,
        3,4,2,0,205,203,1,0,0,0,205,204,1,0,0,0,206,207,1,0,0,0,207,208,
        5,22,0,0,208,31,1,0,0,0,209,210,6,16,-1,0,210,211,3,36,18,0,211,
        226,1,0,0,0,212,213,10,2,0,0,213,219,5,74,0,0,214,220,3,46,23,0,
        215,216,5,21,0,0,216,217,3,6,3,0,217,218,5,22,0,0,218,220,1,0,0,
        0,219,214,1,0,0,0,219,215,1,0,0,0,220,222,1,0,0,0,221,223,3,76,38,
        0,222,221,1,0,0,0,222,223,1,0,0,0,223,225,1,0,0,0,224,212,1,0,0,
        0,225,228,1,0,0,0,226,224,1,0,0,0,226,227,1,0,0,0,227,33,1,0,0,0,
        228,226,1,0,0,0,229,230,6,17,-1,0,230,231,3,38,19,0,231,246,1,0,
        0,0,232,233,10,2,0,0,233,239,5,74,0,0,234,240,3,46,23,0,235,236,
        5,21,0,0,236,237,3,6,3,0,237,238,5,22,0,0,238,240,1,0,0,0,239,234,
        1,0,0,0,239,235,1,0,0,0,240,242,1,0,0,0,241,243,3,76,38,0,242,241,
        1,0,0,0,242,243,1,0,0,0,243,245,1,0,0,0,244,232,1,0,0,0,245,248,
        1,0,0,0,246,244,1,0,0,0,246,247,1,0,0,0,247,35,1,0,0,0,248,246,1,
        0,0,0,249,256,3,40,20,0,250,256,3,42,21,0,251,256,3,66,33,0,252,
        256,3,46,23,0,253,256,3,60,30,0,254,256,3,62,31,0,255,249,1,0,0,
        0,255,250,1,0,0,0,255,251,1,0,0,0,255,252,1,0,0,0,255,253,1,0,0,
        0,255,254,1,0,0,0,256,37,1,0,0,0,257,263,3,40,20,0,258,263,3,42,
        21,0,259,263,3,46,23,0,260,263,3,60,30,0,261,263,3,62,31,0,262,257,
        1,0,0,0,262,258,1,0,0,0,262,259,1,0,0,0,262,260,1,0,0,0,262,261,
        1,0,0,0,263,39,1,0,0,0,264,265,5,19,0,0,265,266,3,6,3,0,266,267,
        5,20,0,0,267,281,1,0,0,0,268,269,5,25,0,0,269,270,3,6,3,0,270,271,
        5,26,0,0,271,281,1,0,0,0,272,273,5,21,0,0,273,274,3,6,3,0,274,275,
        5,22,0,0,275,281,1,0,0,0,276,277,5,23,0,0,277,278,3,6,3,0,278,279,
        5,24,0,0,279,281,1,0,0,0,280,264,1,0,0,0,280,268,1,0,0,0,280,272,
        1,0,0,0,280,276,1,0,0,0,281,41,1,0,0,0,282,283,5,27,0,0,283,284,
        3,6,3,0,284,285,5,27,0,0,285,43,1,0,0,0,286,288,5,78,0,0,287,286,
        1,0,0,0,288,289,1,0,0,0,289,287,1,0,0,0,289,290,1,0,0,0,290,297,
        1,0,0,0,291,292,5,1,0,0,292,293,5,78,0,0,293,294,5,78,0,0,294,296,
        5,78,0,0,295,291,1,0,0,0,296,299,1,0,0,0,297,295,1,0,0,0,297,298,
        1,0,0,0,298,306,1,0,0,0,299,297,1,0,0,0,300,302,5,2,0,0,301,303,
        5,78,0,0,302,301,1,0,0,0,303,304,1,0,0,0,304,302,1,0,0,0,304,305,
        1,0,0,0,305,307,1,0,0,0,306,300,1,0,0,0,306,307,1,0,0,0,307,45,1,
        0,0,0,308,321,7,3,0,0,309,311,3,76,38,0,310,309,1,0,0,0,310,311,
        1,0,0,0,311,313,1,0,0,0,312,314,5,90,0,0,313,312,1,0,0,0,313,314,
        1,0,0,0,314,322,1,0,0,0,315,317,5,90,0,0,316,315,1,0,0,0,316,317,
        1,0,0,0,317,319,1,0,0,0,318,320,3,76,38,0,319,318,1,0,0,0,319,320,
        1,0,0,0,320,322,1,0,0,0,321,310,1,0,0,0,321,316,1,0,0,0,322,331,
        1,0,0,0,323,331,3,44,22,0,324,331,5,76,0,0,325,331,3,52,26,0,326,
        331,3,56,28,0,327,331,3,58,29,0,328,331,3,48,24,0,329,331,3,50,25,
        0,330,308,1,0,0,0,330,323,1,0,0,0,330,324,1,0,0,0,330,325,1,0,0,
        0,330,326,1,0,0,0,330,327,1,0,0,0,330,328,1,0,0,0,330,329,1,0,0,
        0,331,47,1,0,0,0,332,333,5,30,0,0,333,334,3,6,3,0,334,335,7,4,0,
        0,335,49,1,0,0,0,336,337,7,5,0,0,337,338,3,6,3,0,338,339,5,31,0,
        0,339,51,1,0,0,0,340,341,5,72,0,0,341,342,5,21,0,0,342,343,3,54,
        27,0,343,344,5,22,0,0,344,53,1,0,0,0,345,347,5,77,0,0,346,345,1,
        0,0,0,347,350,1,0,0,0,348,346,1,0,0,0,348,349,1,0,0,0,349,55,1,0,
        0,0,350,348,1,0,0,0,351,357,5,68,0,0,352,358,5,78,0,0,353,354,5,
        21,0,0,354,355,3,6,3,0,355,356,5,22,0,0,356,358,1,0,0,0,357,352,
        1,0,0,0,357,353,1,0,0,0,358,364,1,0,0,0,359,365,5,78,0,0,360,361,
        5,21,0,0,361,362,3,6,3,0,362,363,5,22,0,0,363,365,1,0,0,0,364,359,
        1,0,0,0,364,360,1,0,0,0,365,57,1,0,0,0,366,367,7,6,0,0,367,368,5,
        21,0,0,368,369,3,6,3,0,369,370,5,22,0,0,370,371,5,21,0,0,371,372,
        3,6,3,0,372,373,5,22,0,0,373,59,1,0,0,0,374,375,5,59,0,0,375,376,
        3,6,3,0,376,377,5,60,0,0,377,61,1,0,0,0,378,379,5,61,0,0,379,380,
        3,6,3,0,380,381,5,62,0,0,381,63,1,0,0,0,382,383,7,7,0,0,383,65,1,
        0,0,0,384,397,3,64,32,0,385,387,3,76,38,0,386,385,1,0,0,0,386,387,
        1,0,0,0,387,389,1,0,0,0,388,390,3,78,39,0,389,388,1,0,0,0,389,390,
        1,0,0,0,390,398,1,0,0,0,391,393,3,78,39,0,392,391,1,0,0,0,392,393,
        1,0,0,0,393,395,1,0,0,0,394,396,3,76,38,0,395,394,1,0,0,0,395,396,
        1,0,0,0,396,398,1,0,0,0,397,386,1,0,0,0,397,392,1,0,0,0,398,404,
        1,0,0,0,399,400,5,19,0,0,400,401,3,72,36,0,401,402,5,20,0,0,402,
        405,1,0,0,0,403,405,3,74,37,0,404,399,1,0,0,0,404,403,1,0,0,0,405,
        474,1,0,0,0,406,419,7,3,0,0,407,409,3,76,38,0,408,407,1,0,0,0,408,
        409,1,0,0,0,409,411,1,0,0,0,410,412,5,90,0,0,411,410,1,0,0,0,411,
        412,1,0,0,0,412,420,1,0,0,0,413,415,5,90,0,0,414,413,1,0,0,0,414,
        415,1,0,0,0,415,417,1,0,0,0,416,418,3,76,38,0,417,416,1,0,0,0,417,
        418,1,0,0,0,418,420,1,0,0,0,419,408,1,0,0,0,419,414,1,0,0,0,420,
        421,1,0,0,0,421,422,5,19,0,0,422,423,3,68,34,0,423,424,5,20,0,0,
        424,474,1,0,0,0,425,432,5,34,0,0,426,427,3,76,38,0,427,428,3,78,
        39,0,428,433,1,0,0,0,429,430,3,78,39,0,430,431,3,76,38,0,431,433,
        1,0,0,0,432,426,1,0,0,0,432,429,1,0,0,0,432,433,1,0,0,0,433,440,
        1,0,0,0,434,436,3,10,5,0,435,434,1,0,0,0,435,436,1,0,0,0,436,437,
        1,0,0,0,437,441,5,76,0,0,438,441,3,56,28,0,439,441,3,10,5,0,440,
        435,1,0,0,0,440,438,1,0,0,0,440,439,1,0,0,0,441,474,1,0,0,0,442,
        447,5,63,0,0,443,444,5,25,0,0,444,445,3,6,3,0,445,446,5,26,0,0,446,
        448,1,0,0,0,447,443,1,0,0,0,447,448,1,0,0,0,448,449,1,0,0,0,449,
        450,5,21,0,0,450,451,3,6,3,0,451,452,5,22,0,0,452,474,1,0,0,0,453,
        454,5,64,0,0,454,455,5,21,0,0,455,456,3,6,3,0,456,457,5,22,0,0,457,
        474,1,0,0,0,458,465,7,8,0,0,459,460,3,80,40,0,460,461,3,78,39,0,
        461,466,1,0,0,0,462,463,3,78,39,0,463,464,3,80,40,0,464,466,1,0,
        0,0,465,459,1,0,0,0,465,462,1,0,0,0,466,467,1,0,0,0,467,468,3,12,
        6,0,468,474,1,0,0,0,469,470,5,32,0,0,470,471,3,70,35,0,471,472,3,
        12,6,0,472,474,1,0,0,0,473,384,1,0,0,0,473,406,1,0,0,0,473,425,1,
        0,0,0,473,442,1,0,0,0,473,453,1,0,0,0,473,458,1,0,0,0,473,469,1,
        0,0,0,474,67,1,0,0,0,475,476,3,6,3,0,476,477,5,1,0,0,477,478,3,68,
        34,0,478,481,1,0,0,0,479,481,3,6,3,0,480,475,1,0,0,0,480,479,1,0,
        0,0,481,69,1,0,0,0,482,483,5,73,0,0,483,484,5,21,0,0,484,485,7,3,
        0,0,485,486,5,33,0,0,486,495,3,6,3,0,487,493,5,74,0,0,488,489,5,
        21,0,0,489,490,7,1,0,0,490,494,5,22,0,0,491,494,5,15,0,0,492,494,
        5,16,0,0,493,488,1,0,0,0,493,491,1,0,0,0,493,492,1,0,0,0,494,496,
        1,0,0,0,495,487,1,0,0,0,495,496,1,0,0,0,496,497,1,0,0,0,497,498,
        5,22,0,0,498,71,1,0,0,0,499,505,3,6,3,0,500,501,3,6,3,0,501,502,
        5,1,0,0,502,503,3,72,36,0,503,505,1,0,0,0,504,499,1,0,0,0,504,500,
        1,0,0,0,505,73,1,0,0,0,506,507,3,14,7,0,507,75,1,0,0,0,508,514,5,
        73,0,0,509,515,3,46,23,0,510,511,5,21,0,0,511,512,3,6,3,0,512,513,
        5,22,0,0,513,515,1,0,0,0,514,509,1,0,0,0,514,510,1,0,0,0,515,77,
        1,0,0,0,516,522,5,74,0,0,517,523,3,46,23,0,518,519,5,21,0,0,519,
        520,3,6,3,0,520,521,5,22,0,0,521,523,1,0,0,0,522,517,1,0,0,0,522,
        518,1,0,0,0,523,79,1,0,0,0,524,525,5,73,0,0,525,526,5,21,0,0,526,
        527,3,4,2,0,527,528,5,22,0,0,528,81,1,0,0,0,529,530,5,73,0,0,530,
        531,5,21,0,0,531,532,3,4,2,0,532,533,5,22,0,0,533,83,1,0,0,0,60,
        94,111,122,133,144,152,154,162,165,171,178,183,191,197,205,219,222,
        226,239,242,246,255,262,280,289,297,304,306,310,313,316,319,321,
        330,348,357,364,386,389,392,395,397,404,408,411,414,417,419,432,
        435,440,447,465,473,480,493,495,504,514,522
    ]

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

    symbolicNames = [ "<INVALID>", "<INVALID>", "<INVALID>", "WS", "THINSPACE", 
                      "MEDSPACE", "THICKSPACE", "QUAD", "QQUAD", "NEGTHINSPACE", 
                      "NEGMEDSPACE", "NEGTHICKSPACE", "CMD_LEFT", "CMD_RIGHT", 
                      "IGNORE", "ADD", "SUB", "MUL", "DIV", "L_PAREN", "R_PAREN", 
                      "L_BRACE", "R_BRACE", "L_BRACE_LITERAL", "R_BRACE_LITERAL", 
                      "L_BRACKET", "R_BRACKET", "BAR", "R_BAR", "L_BAR", 
                      "L_ANGLE", "R_ANGLE", "FUNC_LIM", "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", "L_FLOOR", 
                      "R_FLOOR", "L_CEIL", "R_CEIL", "FUNC_SQRT", "FUNC_OVERLINE", 
                      "CMD_TIMES", "CMD_CDOT", "CMD_DIV", "CMD_FRAC", "CMD_BINOM", 
                      "CMD_DBINOM", "CMD_TBINOM", "CMD_MATHIT", "UNDERSCORE", 
                      "CARET", "COLON", "DIFFERENTIAL", "LETTER", "DIGIT", 
                      "EQUAL", "NEQ", "LT", "LTE", "LTE_Q", "LTE_S", "GT", 
                      "GTE", "GTE_Q", "GTE_S", "BANG", "SINGLE_QUOTES", 
                      "SYMBOL" ]

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

    ruleNames =  [ "math", "relation", "equality", "expr", "expr_relation", 
                   "additive", "mp", "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", "atom", 
                   "bra", "ket", "mathit", "mathit_text", "frac", "binom", 
                   "floor", "ceil", "func_normal", "func", "args", "limit_sub", 
                   "func_arg", "func_arg_noparens", "subexpr", "supexpr", 
                   "subeq", "supeq" ]

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

    def __init__(self, input:TokenStream, output:TextIO = sys.stdout):
        super().__init__(input, output)
        self.checkVersion("4.13.2")
        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 relation(self):
            return self.getTypedRuleContext(LaTeXParser.RelationContext,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 math(self):

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


    class RelationContext(ParserRuleContext):
        __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 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 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 relation(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = LaTeXParser.RelationContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 2
        self.enterRecursionRule(localctx, 2, self.RULE_relation, _p)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 87
            self.expr()
            self._ctx.stop = self._input.LT(-1)
            self.state = 94
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,0,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    localctx = LaTeXParser.RelationContext(self, _parentctx, _parentState)
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_relation)
                    self.state = 89
                    if not self.precpred(self._ctx, 2):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                    self.state = 90
                    _la = self._input.LA(1)
                    if not(((((_la - 79)) & ~0x3f) == 0 and ((1 << (_la - 79)) & 207) != 0)):
                        self._errHandler.recoverInline(self)
                    else:
                        self._errHandler.reportMatch(self)
                        self.consume()
                    self.state = 91
                    self.relation(3) 
                self.state = 96
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,0,self._ctx)

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


    class EqualityContext(ParserRuleContext):
        __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 equality(self):

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


    class ExprContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def expr_relation(self):
            return self.getTypedRuleContext(LaTeXParser.Expr_relationContext,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 expr(self):

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


    class Expr_relationContext(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 expr_relation(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(LaTeXParser.Expr_relationContext)
            else:
                return self.getTypedRuleContext(LaTeXParser.Expr_relationContext,i)


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

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

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

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

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

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

        def getRuleIndex(self):
            return LaTeXParser.RULE_expr_relation

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

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



    def expr_relation(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = LaTeXParser.Expr_relationContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 8
        self.enterRecursionRule(localctx, 8, self.RULE_expr_relation, _p)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 104
            self.additive(0)
            self._ctx.stop = self._input.LT(-1)
            self.state = 111
            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.Expr_relationContext(self, _parentctx, _parentState)
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_expr_relation)
                    self.state = 106
                    if not self.precpred(self._ctx, 2):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                    self.state = 107
                    _la = self._input.LA(1)
                    if not(((((_la - 79)) & ~0x3f) == 0 and ((1 << (_la - 79)) & 207) != 0)):
                        self._errHandler.recoverInline(self)
                    else:
                        self._errHandler.reportMatch(self)
                        self.consume()
                    self.state = 108
                    self.expr_relation(3) 
                self.state = 113
                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 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 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 additive(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = LaTeXParser.AdditiveContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 10
        self.enterRecursionRule(localctx, 10, self.RULE_additive, _p)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 115
            self.mp(0)
            self._ctx.stop = self._input.LT(-1)
            self.state = 122
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,2,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    localctx = LaTeXParser.AdditiveContext(self, _parentctx, _parentState)
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_additive)
                    self.state = 117
                    if not self.precpred(self._ctx, 2):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                    self.state = 118
                    _la = self._input.LA(1)
                    if not(_la==15 or _la==16):
                        self._errHandler.recoverInline(self)
                    else:
                        self._errHandler.reportMatch(self)
                        self.consume()
                    self.state = 119
                    self.additive(3) 
                self.state = 124
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,2,self._ctx)

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


    class MpContext(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 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 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 mp(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = LaTeXParser.MpContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 12
        self.enterRecursionRule(localctx, 12, self.RULE_mp, _p)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 126
            self.unary()
            self._ctx.stop = self._input.LT(-1)
            self.state = 133
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,3,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    localctx = LaTeXParser.MpContext(self, _parentctx, _parentState)
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_mp)
                    self.state = 128
                    if not self.precpred(self._ctx, 2):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                    self.state = 129
                    _la = self._input.LA(1)
                    if not(((((_la - 17)) & ~0x3f) == 0 and ((1 << (_la - 17)) & 290200700988686339) != 0)):
                        self._errHandler.recoverInline(self)
                    else:
                        self._errHandler.reportMatch(self)
                        self.consume()
                    self.state = 130
                    self.mp(3) 
                self.state = 135
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,3,self._ctx)

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


    class 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 mp_nofunc(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = LaTeXParser.Mp_nofuncContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 14
        self.enterRecursionRule(localctx, 14, self.RULE_mp_nofunc, _p)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 137
            self.unary_nofunc()
            self._ctx.stop = self._input.LT(-1)
            self.state = 144
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,4,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 = 139
                    if not self.precpred(self._ctx, 2):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                    self.state = 140
                    _la = self._input.LA(1)
                    if not(((((_la - 17)) & ~0x3f) == 0 and ((1 << (_la - 17)) & 290200700988686339) != 0)):
                        self._errHandler.recoverInline(self)
                    else:
                        self._errHandler.reportMatch(self)
                        self.consume()
                    self.state = 141
                    self.mp_nofunc(3) 
                self.state = 146
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,4,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 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 unary(self):

        localctx = LaTeXParser.UnaryContext(self, self._ctx, self.state)
        self.enterRule(localctx, 16, self.RULE_unary)
        self._la = 0 # Token type
        try:
            self.state = 154
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [15, 16]:
                self.enterOuterAlt(localctx, 1)
                self.state = 147
                _la = self._input.LA(1)
                if not(_la==15 or _la==16):
                    self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 148
                self.unary()
                pass
            elif token in [19, 21, 23, 25, 27, 29, 30, 32, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 61, 63, 64, 68, 69, 70, 71, 72, 76, 77, 78, 91]:
                self.enterOuterAlt(localctx, 2)
                self.state = 150 
                self._errHandler.sync(self)
                _alt = 1
                while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                    if _alt == 1:
                        self.state = 149
                        self.postfix()

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

                pass
            else:
                raise NoViableAltException(self)

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


    class Unary_nofuncContext(ParserRuleContext):
        __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 unary_nofunc(self):

        localctx = LaTeXParser.Unary_nofuncContext(self, self._ctx, self.state)
        self.enterRule(localctx, 18, self.RULE_unary_nofunc)
        self._la = 0 # Token type
        try:
            self.state = 165
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [15, 16]:
                self.enterOuterAlt(localctx, 1)
                self.state = 156
                _la = self._input.LA(1)
                if not(_la==15 or _la==16):
                    self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 157
                self.unary_nofunc()
                pass
            elif token in [19, 21, 23, 25, 27, 29, 30, 32, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 61, 63, 64, 68, 69, 70, 71, 72, 76, 77, 78, 91]:
                self.enterOuterAlt(localctx, 2)
                self.state = 158
                self.postfix()
                self.state = 162
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,7,self._ctx)
                while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                    if _alt==1:
                        self.state = 159
                        self.postfix_nofunc() 
                    self.state = 164
                    self._errHandler.sync(self)
                    _alt = self._interp.adaptivePredict(self._input,7,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 postfix(self):

        localctx = LaTeXParser.PostfixContext(self, self._ctx, self.state)
        self.enterRule(localctx, 20, self.RULE_postfix)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 167
            self.exp(0)
            self.state = 171
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,9,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 168
                    self.postfix_op() 
                self.state = 173
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,9,self._ctx)

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


    class Postfix_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 postfix_nofunc(self):

        localctx = LaTeXParser.Postfix_nofuncContext(self, self._ctx, self.state)
        self.enterRule(localctx, 22, self.RULE_postfix_nofunc)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 174
            self.exp_nofunc(0)
            self.state = 178
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,10,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 175
                    self.postfix_op() 
                self.state = 180
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,10,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 postfix_op(self):

        localctx = LaTeXParser.Postfix_opContext(self, self._ctx, self.state)
        self.enterRule(localctx, 24, self.RULE_postfix_op)
        try:
            self.state = 183
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [89]:
                self.enterOuterAlt(localctx, 1)
                self.state = 181
                self.match(LaTeXParser.BANG)
                pass
            elif token in [27]:
                self.enterOuterAlt(localctx, 2)
                self.state = 182
                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 eval_at(self):

        localctx = LaTeXParser.Eval_atContext(self, self._ctx, self.state)
        self.enterRule(localctx, 26, self.RULE_eval_at)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 185
            self.match(LaTeXParser.BAR)
            self.state = 191
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,12,self._ctx)
            if la_ == 1:
                self.state = 186
                self.eval_at_sup()
                pass

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

            elif la_ == 3:
                self.state = 188
                self.eval_at_sup()
                self.state = 189
                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 eval_at_sub(self):

        localctx = LaTeXParser.Eval_at_subContext(self, self._ctx, self.state)
        self.enterRule(localctx, 28, self.RULE_eval_at_sub)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 193
            self.match(LaTeXParser.UNDERSCORE)
            self.state = 194
            self.match(LaTeXParser.L_BRACE)
            self.state = 197
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,13,self._ctx)
            if la_ == 1:
                self.state = 195
                self.expr()
                pass

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


            self.state = 199
            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 eval_at_sup(self):

        localctx = LaTeXParser.Eval_at_supContext(self, self._ctx, self.state)
        self.enterRule(localctx, 30, self.RULE_eval_at_sup)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 201
            self.match(LaTeXParser.CARET)
            self.state = 202
            self.match(LaTeXParser.L_BRACE)
            self.state = 205
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,14,self._ctx)
            if la_ == 1:
                self.state = 203
                self.expr()
                pass

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


            self.state = 207
            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 exp(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = LaTeXParser.ExpContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 32
        self.enterRecursionRule(localctx, 32, self.RULE_exp, _p)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 210
            self.comp()
            self._ctx.stop = self._input.LT(-1)
            self.state = 226
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,17,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 = 212
                    if not self.precpred(self._ctx, 2):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                    self.state = 213
                    self.match(LaTeXParser.CARET)
                    self.state = 219
                    self._errHandler.sync(self)
                    token = self._input.LA(1)
                    if token in [27, 29, 30, 68, 69, 70, 71, 72, 76, 77, 78, 91]:
                        self.state = 214
                        self.atom()
                        pass
                    elif token in [21]:
                        self.state = 215
                        self.match(LaTeXParser.L_BRACE)
                        self.state = 216
                        self.expr()
                        self.state = 217
                        self.match(LaTeXParser.R_BRACE)
                        pass
                    else:
                        raise NoViableAltException(self)

                    self.state = 222
                    self._errHandler.sync(self)
                    la_ = self._interp.adaptivePredict(self._input,16,self._ctx)
                    if la_ == 1:
                        self.state = 221
                        self.subexpr()

             
                self.state = 228
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,17,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 exp_nofunc(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = LaTeXParser.Exp_nofuncContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 34
        self.enterRecursionRule(localctx, 34, self.RULE_exp_nofunc, _p)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 230
            self.comp_nofunc()
            self._ctx.stop = self._input.LT(-1)
            self.state = 246
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,20,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 = 232
                    if not self.precpred(self._ctx, 2):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                    self.state = 233
                    self.match(LaTeXParser.CARET)
                    self.state = 239
                    self._errHandler.sync(self)
                    token = self._input.LA(1)
                    if token in [27, 29, 30, 68, 69, 70, 71, 72, 76, 77, 78, 91]:
                        self.state = 234
                        self.atom()
                        pass
                    elif token in [21]:
                        self.state = 235
                        self.match(LaTeXParser.L_BRACE)
                        self.state = 236
                        self.expr()
                        self.state = 237
                        self.match(LaTeXParser.R_BRACE)
                        pass
                    else:
                        raise NoViableAltException(self)

                    self.state = 242
                    self._errHandler.sync(self)
                    la_ = self._interp.adaptivePredict(self._input,19,self._ctx)
                    if la_ == 1:
                        self.state = 241
                        self.subexpr()

             
                self.state = 248
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,20,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 comp(self):

        localctx = LaTeXParser.CompContext(self, self._ctx, self.state)
        self.enterRule(localctx, 36, self.RULE_comp)
        try:
            self.state = 255
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,21,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 249
                self.group()
                pass

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

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

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

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

            elif la_ == 6:
                self.enterOuterAlt(localctx, 6)
                self.state = 254
                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 comp_nofunc(self):

        localctx = LaTeXParser.Comp_nofuncContext(self, self._ctx, self.state)
        self.enterRule(localctx, 38, self.RULE_comp_nofunc)
        try:
            self.state = 262
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,22,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 257
                self.group()
                pass

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

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

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

            elif la_ == 5:
                self.enterOuterAlt(localctx, 5)
                self.state = 261
                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 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 group(self):

        localctx = LaTeXParser.GroupContext(self, self._ctx, self.state)
        self.enterRule(localctx, 40, self.RULE_group)
        try:
            self.state = 280
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [19]:
                self.enterOuterAlt(localctx, 1)
                self.state = 264
                self.match(LaTeXParser.L_PAREN)
                self.state = 265
                self.expr()
                self.state = 266
                self.match(LaTeXParser.R_PAREN)
                pass
            elif token in [25]:
                self.enterOuterAlt(localctx, 2)
                self.state = 268
                self.match(LaTeXParser.L_BRACKET)
                self.state = 269
                self.expr()
                self.state = 270
                self.match(LaTeXParser.R_BRACKET)
                pass
            elif token in [21]:
                self.enterOuterAlt(localctx, 3)
                self.state = 272
                self.match(LaTeXParser.L_BRACE)
                self.state = 273
                self.expr()
                self.state = 274
                self.match(LaTeXParser.R_BRACE)
                pass
            elif token in [23]:
                self.enterOuterAlt(localctx, 4)
                self.state = 276
                self.match(LaTeXParser.L_BRACE_LITERAL)
                self.state = 277
                self.expr()
                self.state = 278
                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 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 abs_group(self):

        localctx = LaTeXParser.Abs_groupContext(self, self._ctx, self.state)
        self.enterRule(localctx, 42, self.RULE_abs_group)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 282
            self.match(LaTeXParser.BAR)
            self.state = 283
            self.expr()
            self.state = 284
            self.match(LaTeXParser.BAR)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


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

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

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

            self.state = 297
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,25,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 291
                    self.match(LaTeXParser.T__0)
                    self.state = 292
                    self.match(LaTeXParser.DIGIT)
                    self.state = 293
                    self.match(LaTeXParser.DIGIT)
                    self.state = 294
                    self.match(LaTeXParser.DIGIT) 
                self.state = 299
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,25,self._ctx)

            self.state = 306
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,27,self._ctx)
            if la_ == 1:
                self.state = 300
                self.match(LaTeXParser.T__1)
                self.state = 302 
                self._errHandler.sync(self)
                _alt = 1
                while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                    if _alt == 1:
                        self.state = 301
                        self.match(LaTeXParser.DIGIT)

                    else:
                        raise NoViableAltException(self)
                    self.state = 304 
                    self._errHandler.sync(self)
                    _alt = self._interp.adaptivePredict(self._input,26,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 AtomContext(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 subexpr(self):
            return self.getTypedRuleContext(LaTeXParser.SubexprContext,0)


        def SINGLE_QUOTES(self):
            return self.getToken(LaTeXParser.SINGLE_QUOTES, 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 frac(self):
            return self.getTypedRuleContext(LaTeXParser.FracContext,0)


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


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


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


        def getRuleIndex(self):
            return LaTeXParser.RULE_atom

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

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




    def atom(self):

        localctx = LaTeXParser.AtomContext(self, self._ctx, self.state)
        self.enterRule(localctx, 46, self.RULE_atom)
        self._la = 0 # Token type
        try:
            self.state = 330
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [77, 91]:
                self.enterOuterAlt(localctx, 1)
                self.state = 308
                _la = self._input.LA(1)
                if not(_la==77 or _la==91):
                    self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 321
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,32,self._ctx)
                if la_ == 1:
                    self.state = 310
                    self._errHandler.sync(self)
                    la_ = self._interp.adaptivePredict(self._input,28,self._ctx)
                    if la_ == 1:
                        self.state = 309
                        self.subexpr()


                    self.state = 313
                    self._errHandler.sync(self)
                    la_ = self._interp.adaptivePredict(self._input,29,self._ctx)
                    if la_ == 1:
                        self.state = 312
                        self.match(LaTeXParser.SINGLE_QUOTES)


                    pass

                elif la_ == 2:
                    self.state = 316
                    self._errHandler.sync(self)
                    la_ = self._interp.adaptivePredict(self._input,30,self._ctx)
                    if la_ == 1:
                        self.state = 315
                        self.match(LaTeXParser.SINGLE_QUOTES)


                    self.state = 319
                    self._errHandler.sync(self)
                    la_ = self._interp.adaptivePredict(self._input,31,self._ctx)
                    if la_ == 1:
                        self.state = 318
                        self.subexpr()


                    pass


                pass
            elif token in [78]:
                self.enterOuterAlt(localctx, 2)
                self.state = 323
                self.number()
                pass
            elif token in [76]:
                self.enterOuterAlt(localctx, 3)
                self.state = 324
                self.match(LaTeXParser.DIFFERENTIAL)
                pass
            elif token in [72]:
                self.enterOuterAlt(localctx, 4)
                self.state = 325
                self.mathit()
                pass
            elif token in [68]:
                self.enterOuterAlt(localctx, 5)
                self.state = 326
                self.frac()
                pass
            elif token in [69, 70, 71]:
                self.enterOuterAlt(localctx, 6)
                self.state = 327
                self.binom()
                pass
            elif token in [30]:
                self.enterOuterAlt(localctx, 7)
                self.state = 328
                self.bra()
                pass
            elif token in [27, 29]:
                self.enterOuterAlt(localctx, 8)
                self.state = 329
                self.ket()
                pass
            else:
                raise NoViableAltException(self)

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


    class BraContext(ParserRuleContext):
        __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 bra(self):

        localctx = LaTeXParser.BraContext(self, self._ctx, self.state)
        self.enterRule(localctx, 48, self.RULE_bra)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 332
            self.match(LaTeXParser.L_ANGLE)
            self.state = 333
            self.expr()
            self.state = 334
            _la = self._input.LA(1)
            if not(_la==27 or _la==28):
                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 ket(self):

        localctx = LaTeXParser.KetContext(self, self._ctx, self.state)
        self.enterRule(localctx, 50, self.RULE_ket)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 336
            _la = self._input.LA(1)
            if not(_la==27 or _la==29):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
            self.state = 337
            self.expr()
            self.state = 338
            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 mathit(self):

        localctx = LaTeXParser.MathitContext(self, self._ctx, self.state)
        self.enterRule(localctx, 52, self.RULE_mathit)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 340
            self.match(LaTeXParser.CMD_MATHIT)
            self.state = 341
            self.match(LaTeXParser.L_BRACE)
            self.state = 342
            self.mathit_text()
            self.state = 343
            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 mathit_text(self):

        localctx = LaTeXParser.Mathit_textContext(self, self._ctx, self.state)
        self.enterRule(localctx, 54, self.RULE_mathit_text)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 348
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==77:
                self.state = 345
                self.match(LaTeXParser.LETTER)
                self.state = 350
                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.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 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 frac(self):

        localctx = LaTeXParser.FracContext(self, self._ctx, self.state)
        self.enterRule(localctx, 56, self.RULE_frac)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 351
            self.match(LaTeXParser.CMD_FRAC)
            self.state = 357
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [78]:
                self.state = 352
                localctx.upperd = self.match(LaTeXParser.DIGIT)
                pass
            elif token in [21]:
                self.state = 353
                self.match(LaTeXParser.L_BRACE)
                self.state = 354
                localctx.upper = self.expr()
                self.state = 355
                self.match(LaTeXParser.R_BRACE)
                pass
            else:
                raise NoViableAltException(self)

            self.state = 364
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [78]:
                self.state = 359
                localctx.lowerd = self.match(LaTeXParser.DIGIT)
                pass
            elif token in [21]:
                self.state = 360
                self.match(LaTeXParser.L_BRACE)
                self.state = 361
                localctx.lower = self.expr()
                self.state = 362
                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 binom(self):

        localctx = LaTeXParser.BinomContext(self, self._ctx, self.state)
        self.enterRule(localctx, 58, self.RULE_binom)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 366
            _la = self._input.LA(1)
            if not(((((_la - 69)) & ~0x3f) == 0 and ((1 << (_la - 69)) & 7) != 0)):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
            self.state = 367
            self.match(LaTeXParser.L_BRACE)
            self.state = 368
            localctx.n = self.expr()
            self.state = 369
            self.match(LaTeXParser.R_BRACE)
            self.state = 370
            self.match(LaTeXParser.L_BRACE)
            self.state = 371
            localctx.k = self.expr()
            self.state = 372
            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 floor(self):

        localctx = LaTeXParser.FloorContext(self, self._ctx, self.state)
        self.enterRule(localctx, 60, self.RULE_floor)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 374
            self.match(LaTeXParser.L_FLOOR)
            self.state = 375
            localctx.val = self.expr()
            self.state = 376
            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 ceil(self):

        localctx = LaTeXParser.CeilContext(self, self._ctx, self.state)
        self.enterRule(localctx, 62, self.RULE_ceil)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 378
            self.match(LaTeXParser.L_CEIL)
            self.state = 379
            localctx.val = self.expr()
            self.state = 380
            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 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 func_normal(self):

        localctx = LaTeXParser.Func_normalContext(self, self._ctx, self.state)
        self.enterRule(localctx, 64, self.RULE_func_normal)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 382
            _la = self._input.LA(1)
            if not((((_la) & ~0x3f) == 0 and ((1 << _la) & 576460614864470016) != 0)):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class FuncContext(ParserRuleContext):
        __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 L_PAREN(self):
            return self.getToken(LaTeXParser.L_PAREN, 0)

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


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

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


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


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


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


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

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

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

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

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

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


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


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

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

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

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


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

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

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

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


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

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

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


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

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


        def getRuleIndex(self):
            return LaTeXParser.RULE_func

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

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




    def func(self):

        localctx = LaTeXParser.FuncContext(self, self._ctx, self.state)
        self.enterRule(localctx, 66, self.RULE_func)
        self._la = 0 # Token type
        try:
            self.state = 473
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58]:
                self.enterOuterAlt(localctx, 1)
                self.state = 384
                self.func_normal()
                self.state = 397
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,41,self._ctx)
                if la_ == 1:
                    self.state = 386
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if _la==73:
                        self.state = 385
                        self.subexpr()


                    self.state = 389
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if _la==74:
                        self.state = 388
                        self.supexpr()


                    pass

                elif la_ == 2:
                    self.state = 392
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if _la==74:
                        self.state = 391
                        self.supexpr()


                    self.state = 395
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if _la==73:
                        self.state = 394
                        self.subexpr()


                    pass


                self.state = 404
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,42,self._ctx)
                if la_ == 1:
                    self.state = 399
                    self.match(LaTeXParser.L_PAREN)
                    self.state = 400
                    self.func_arg()
                    self.state = 401
                    self.match(LaTeXParser.R_PAREN)
                    pass

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


                pass
            elif token in [77, 91]:
                self.enterOuterAlt(localctx, 2)
                self.state = 406
                _la = self._input.LA(1)
                if not(_la==77 or _la==91):
                    self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 419
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,47,self._ctx)
                if la_ == 1:
                    self.state = 408
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if _la==73:
                        self.state = 407
                        self.subexpr()


                    self.state = 411
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if _la==90:
                        self.state = 410
                        self.match(LaTeXParser.SINGLE_QUOTES)


                    pass

                elif la_ == 2:
                    self.state = 414
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if _la==90:
                        self.state = 413
                        self.match(LaTeXParser.SINGLE_QUOTES)


                    self.state = 417
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if _la==73:
                        self.state = 416
                        self.subexpr()


                    pass


                self.state = 421
                self.match(LaTeXParser.L_PAREN)
                self.state = 422
                self.args()
                self.state = 423
                self.match(LaTeXParser.R_PAREN)
                pass
            elif token in [34]:
                self.enterOuterAlt(localctx, 3)
                self.state = 425
                self.match(LaTeXParser.FUNC_INT)
                self.state = 432
                self._errHandler.sync(self)
                token = self._input.LA(1)
                if token in [73]:
                    self.state = 426
                    self.subexpr()
                    self.state = 427
                    self.supexpr()
                    pass
                elif token in [74]:
                    self.state = 429
                    self.supexpr()
                    self.state = 430
                    self.subexpr()
                    pass
                elif token in [15, 16, 19, 21, 23, 25, 27, 29, 30, 32, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 61, 63, 64, 68, 69, 70, 71, 72, 76, 77, 78, 91]:
                    pass
                else:
                    pass
                self.state = 440
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,50,self._ctx)
                if la_ == 1:
                    self.state = 435
                    self._errHandler.sync(self)
                    la_ = self._interp.adaptivePredict(self._input,49,self._ctx)
                    if la_ == 1:
                        self.state = 434
                        self.additive(0)


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

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

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


                pass
            elif token in [63]:
                self.enterOuterAlt(localctx, 4)
                self.state = 442
                self.match(LaTeXParser.FUNC_SQRT)
                self.state = 447
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==25:
                    self.state = 443
                    self.match(LaTeXParser.L_BRACKET)
                    self.state = 444
                    localctx.root = self.expr()
                    self.state = 445
                    self.match(LaTeXParser.R_BRACKET)


                self.state = 449
                self.match(LaTeXParser.L_BRACE)
                self.state = 450
                localctx.base = self.expr()
                self.state = 451
                self.match(LaTeXParser.R_BRACE)
                pass
            elif token in [64]:
                self.enterOuterAlt(localctx, 5)
                self.state = 453
                self.match(LaTeXParser.FUNC_OVERLINE)
                self.state = 454
                self.match(LaTeXParser.L_BRACE)
                self.state = 455
                localctx.base = self.expr()
                self.state = 456
                self.match(LaTeXParser.R_BRACE)
                pass
            elif token in [35, 36]:
                self.enterOuterAlt(localctx, 6)
                self.state = 458
                _la = self._input.LA(1)
                if not(_la==35 or _la==36):
                    self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 465
                self._errHandler.sync(self)
                token = self._input.LA(1)
                if token in [73]:
                    self.state = 459
                    self.subeq()
                    self.state = 460
                    self.supexpr()
                    pass
                elif token in [74]:
                    self.state = 462
                    self.supexpr()
                    self.state = 463
                    self.subeq()
                    pass
                else:
                    raise NoViableAltException(self)

                self.state = 467
                self.mp(0)
                pass
            elif token in [32]:
                self.enterOuterAlt(localctx, 7)
                self.state = 469
                self.match(LaTeXParser.FUNC_LIM)
                self.state = 470
                self.limit_sub()
                self.state = 471
                self.mp(0)
                pass
            else:
                raise NoViableAltException(self)

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


    class ArgsContext(ParserRuleContext):
        __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 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 args(self):

        localctx = LaTeXParser.ArgsContext(self, self._ctx, self.state)
        self.enterRule(localctx, 68, self.RULE_args)
        try:
            self.state = 480
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,54,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 475
                self.expr()
                self.state = 476
                self.match(LaTeXParser.T__0)
                self.state = 477
                self.args()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 479
                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 limit_sub(self):

        localctx = LaTeXParser.Limit_subContext(self, self._ctx, self.state)
        self.enterRule(localctx, 70, self.RULE_limit_sub)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 482
            self.match(LaTeXParser.UNDERSCORE)
            self.state = 483
            self.match(LaTeXParser.L_BRACE)
            self.state = 484
            _la = self._input.LA(1)
            if not(_la==77 or _la==91):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
            self.state = 485
            self.match(LaTeXParser.LIM_APPROACH_SYM)
            self.state = 486
            self.expr()
            self.state = 495
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==74:
                self.state = 487
                self.match(LaTeXParser.CARET)
                self.state = 493
                self._errHandler.sync(self)
                token = self._input.LA(1)
                if token in [21]:
                    self.state = 488
                    self.match(LaTeXParser.L_BRACE)
                    self.state = 489
                    _la = self._input.LA(1)
                    if not(_la==15 or _la==16):
                        self._errHandler.recoverInline(self)
                    else:
                        self._errHandler.reportMatch(self)
                        self.consume()
                    self.state = 490
                    self.match(LaTeXParser.R_BRACE)
                    pass
                elif token in [15]:
                    self.state = 491
                    self.match(LaTeXParser.ADD)
                    pass
                elif token in [16]:
                    self.state = 492
                    self.match(LaTeXParser.SUB)
                    pass
                else:
                    raise NoViableAltException(self)



            self.state = 497
            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 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 func_arg(self):

        localctx = LaTeXParser.Func_argContext(self, self._ctx, self.state)
        self.enterRule(localctx, 72, self.RULE_func_arg)
        try:
            self.state = 504
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,57,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 499
                self.expr()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 500
                self.expr()
                self.state = 501
                self.match(LaTeXParser.T__0)
                self.state = 502
                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 func_arg_noparens(self):

        localctx = LaTeXParser.Func_arg_noparensContext(self, self._ctx, self.state)
        self.enterRule(localctx, 74, self.RULE_func_arg_noparens)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 506
            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 expr(self):
            return self.getTypedRuleContext(LaTeXParser.ExprContext,0)


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

        def getRuleIndex(self):
            return LaTeXParser.RULE_subexpr

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

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




    def subexpr(self):

        localctx = LaTeXParser.SubexprContext(self, self._ctx, self.state)
        self.enterRule(localctx, 76, self.RULE_subexpr)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 508
            self.match(LaTeXParser.UNDERSCORE)
            self.state = 514
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [27, 29, 30, 68, 69, 70, 71, 72, 76, 77, 78, 91]:
                self.state = 509
                self.atom()
                pass
            elif token in [21]:
                self.state = 510
                self.match(LaTeXParser.L_BRACE)
                self.state = 511
                self.expr()
                self.state = 512
                self.match(LaTeXParser.R_BRACE)
                pass
            else:
                raise NoViableAltException(self)

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


    class SupexprContext(ParserRuleContext):
        __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 supexpr(self):

        localctx = LaTeXParser.SupexprContext(self, self._ctx, self.state)
        self.enterRule(localctx, 78, self.RULE_supexpr)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 516
            self.match(LaTeXParser.CARET)
            self.state = 522
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [27, 29, 30, 68, 69, 70, 71, 72, 76, 77, 78, 91]:
                self.state = 517
                self.atom()
                pass
            elif token in [21]:
                self.state = 518
                self.match(LaTeXParser.L_BRACE)
                self.state = 519
                self.expr()
                self.state = 520
                self.match(LaTeXParser.R_BRACE)
                pass
            else:
                raise NoViableAltException(self)

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


    class SubeqContext(ParserRuleContext):
        __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_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 subeq(self):

        localctx = LaTeXParser.SubeqContext(self, self._ctx, self.state)
        self.enterRule(localctx, 80, self.RULE_subeq)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 524
            self.match(LaTeXParser.UNDERSCORE)
            self.state = 525
            self.match(LaTeXParser.L_BRACE)
            self.state = 526
            self.equality()
            self.state = 527
            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 supeq(self):

        localctx = LaTeXParser.SupeqContext(self, self._ctx, self.state)
        self.enterRule(localctx, 82, self.RULE_supeq)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 529
            self.match(LaTeXParser.UNDERSCORE)
            self.state = 530
            self.match(LaTeXParser.L_BRACE)
            self.state = 531
            self.equality()
            self.state = 532
            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.relation_sempred
        self._predicates[4] = self.expr_relation_sempred
        self._predicates[5] = self.additive_sempred
        self._predicates[6] = self.mp_sempred
        self._predicates[7] = self.mp_nofunc_sempred
        self._predicates[16] = self.exp_sempred
        self._predicates[17] = self.exp_nofunc_sempred
        pred = self._predicates.get(ruleIndex, None)
        if pred is None:
            raise Exception("No predicate with index:" + str(ruleIndex))
        else:
            return pred(localctx, predIndex)

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

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

    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 mp_nofunc_sempred(self, localctx:Mp_nofuncContext, predIndex:int):
            if predIndex == 4:
                return self.precpred(self._ctx, 2)
         

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

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




