32. Python Language Services¶
Python provides a number of modules to assist in working with the Python language. These modules support tokenizing, parsing, syntax analysis, bytecode disassembly, and various other facilities.
These modules include:
- 32.1.
parser— Access Python parse trees - 32.2.
ast— Abstract Syntax Trees - 32.3.
symtable— Access to the compiler’s symbol tables- 32.3.1. Generating Symbol Tables
- 32.3.2. Examining Symbol Tables
SymbolTableSymbolTable.get_type()SymbolTable.get_id()SymbolTable.get_name()SymbolTable.get_lineno()SymbolTable.is_optimized()SymbolTable.is_nested()SymbolTable.has_children()SymbolTable.has_exec()SymbolTable.has_import_star()SymbolTable.get_identifiers()SymbolTable.lookup()SymbolTable.get_symbols()SymbolTable.get_children()
FunctionClassSymbol
- 32.4.
symbol— Constants used with Python parse trees - 32.5.
token— Constants used with Python parse treestok_nameISTERMINAL()ISNONTERMINAL()ISEOF()ENDMARKERNAMENUMBERSTRINGNEWLINEINDENTDEDENTLPARRPARLSQBRSQBCOLONCOMMASEMIPLUSMINUSSTARSLASHVBARAMPERLESSGREATEREQUALDOTPERCENTBACKQUOTELBRACERBRACEEQEQUALNOTEQUALLESSEQUALGREATEREQUALTILDECIRCUMFLEXLEFTSHIFTRIGHTSHIFTDOUBLESTARPLUSEQUALMINEQUALSTAREQUALSLASHEQUALPERCENTEQUALAMPEREQUALVBAREQUALCIRCUMFLEXEQUALLEFTSHIFTEQUALRIGHTSHIFTEQUALDOUBLESTAREQUALDOUBLESLASHDOUBLESLASHEQUALATOPERRORTOKENN_TOKENSNT_OFFSET
- 32.6.
keyword— Testing for Python keywords - 32.7.
tokenize— Tokenizer for Python source - 32.8.
tabnanny— Detection of ambiguous indentation - 32.9.
pyclbr— Python class browser support - 32.10.
py_compile— Compile Python source files - 32.11.
compileall— Byte-compile Python libraries - 32.12.
dis— Disassembler for Python bytecode - 32.13.
pickletools— Tools for pickle developers
