The parser should read grammars in the format from Homework 2 and read input sentences in the space-separated format you used above to output generated sentences.
you should be able to parse the sentences generated by your own and others' grammars.