work on ast and refined the grammar