refactor, including giving compiler own scope
prettyprint + gendoc