refactor grammar expressions compiling