refactor of pl compiler