refactor compiler core, add compiler hook compatibility