Simplify and refactor grammar and compiler nodes