Add some comments

Adding some comments testing my understanding of how this all works. Specific questions are marked with @sqs.

Btw, feature idea: it'd be really nice if I could just add a question on a specific function or line of code, so I didn't have to go through this routine
origins are the filenames that you want to emit defs from

it will analyze other files (for the purpose of type inference and refs) but only defs that are defined in an origin are emitted in the defs json

also refs are only emitted from origin files too