The API to the parser is very simple. A call to parse() is made with the python code as an argument. The AST is output from there.
The parser has two main components. First, the call to parse sends the code to the tokenizer. The tokenizer is a finite state machine, moving character by character through the code. The tokenizer returns an array of tokens. The array of tokens is sent into makeTreeFromTokens, which recursively constructs the AST from the token stream.
Thanks for taking a look!