Finished the semantics for the grammar. It is now working fine