Implement arithmetic grammar