Move ast functions to separate module

Just for separation of concerns, yknow