move ast methods to their own module
add tests for ast parsing/generating