fixed constructor bug; added factory methods for creating different parsers