So far, we have defined language grammar and have written a lexer. In this part we will write a parser for our language. Before we start, we need some helper functions: int peek(char *s) { return (strcmp(tok, s) == 0); } int accept(char *s) { if (peek(s)) { readtok(); return 1; } return 0; } int expect(char *s) { if (accept(s) == 0) { error("Error: expected '%s'\n", s); } } peek() returns non-zero value if the next token is equal to the given string.