transforming AST to intermediate representation