Transform concrete grammar into abstract algebra

Fixed