Implementation of a pregroup grammar parsing algorithm