Thread a context in Terr AST compilation