docs: def get_tokens(tokens):
      """Recursively gets tokens from a match list
      
      Args:
          tokens : List of tokens ['(', 'S', '(', 'NP', ')', ')']
      Returns:
          Stack of tokens
      """
      tokens = tokens[1:-1]
      ret = []
      start = 0
      stack = 0
      for i in range(len(tokens)):
          if tokens[i] == '(':
              if stack == 0:
                  start = i
              stack += 1
          elif tokens[i] == ')':
              stack -= 1
              if stack < 0:
                  raise Exception('Bracket mismatch: ' + str(tokens))
              if stack == 0:
                  ret.append(get_tokens(tokens[start:i + 1]))
          else:
              if stack == 0:
                  ret.append(tokens[i])
      if stack != 0:
          raise Exception('Bracket mismatch: ' + str(tokens))
      return ret