parameters: (term)
return_statement: return _finalize(tuple(term))
docstring: Parse a bracketed expression from HOLStep.
  
    HOLStep's bracketed expressions appear to be a subset of valid HOL Light
    terms.  They are fully parenthesized so precedence doesn't matter, and there
    are always spaces between operators and identifiers.
  
    Args:
      term: HOLStep term or thm to parse, as a str.
  
    Returns:
      The parsed term or thm as an S-expression.
  
    Raises:
      ValueError: If the parse fails.
docstring_summary: Parse a bracketed expression from HOLStep.
docstring_tokens: Parse a bracketed expression from HOLStep .
function: def parse_term(term):
    """Parse a bracketed expression from HOLStep.
  
    HOLStep's bracketed expressions appear to be a subset of valid HOL Light
    terms.  They are fully parenthesized so precedence doesn't matter, and there
    are always spaces between operators and identifiers.
  
    Args:
      term: HOLStep term or thm to parse, as a str.
  
    Returns:
      The parsed term or thm as an S-expression.
  
    Raises:
      ValueError: If the parse fails.
    """
    # Split into tokens
    words = _TOKEN_RE.findall(term)
  
    # Convert to S-expressions
    stack = [[]]
    for w in words:
      if w == '(':
        stack.append([])
      else:
        if w == ')':
          w = _finalize(tuple(stack.pop()))
        stack[-1].append(w)
    term, = stack
  
    # All done!
    return _finalize(tuple(term))
function_tokens: def parse_term ( term ) : # Split into tokens words = _TOKEN_RE . findall ( term ) # Convert to S-expressions stack = [ [ ] ] for w in words : if w == '(' : stack . append ( [ ] ) else : if w == ')' : w = _finalize ( tuple ( stack . pop ( ) ) ) stack [ - 1 ] . append ( w ) term , = stack # All done! return _finalize ( tuple ( term ) )