def __init__(self, grammarFileName:str, tokenNames:list, ruleNames:list, atn:ATN, input:TokenStream):
     super().__init__(input)
     self.grammarFileName = grammarFileName
     self.atn = atn
     self.tokenNames = tokenNames
     self.ruleNames = ruleNames
     self.decisionToDFA = [ DFA(state) for state in atn.decisionToState ]
     self.sharedContextCache = PredictionContextCache()
     self._parentContextStack = list()
     # identify the ATN states where pushNewRecursionContext must be called
     self.pushRecursionContextStates = set()
     for state in atn.states:
         if not isinstance(state, StarLoopEntryState):
             continue
         if state.isPrecedenceDecision:
             self.pushRecursionContextStates.add(state.stateNumber)
     # get atn simulator that knows how to do predictions
     self._interp = ParserATNSimulator(self, atn, self.decisionToDFA, self.sharedContextCache)