[unfinished] compiler rewrite