The parser takes in a string and, if the parse succeeds, returns a pair consisting of a ”parsed-stuff” and the rest of the string. It returns the symbol ’fail if the parse does not succeed.
Read the problem statement for understanding the Grammar syntax.