Added type definitions and annotations to the grammar
Broke out parse tree structure and related functions into it's own  module