Recognising the end of the input is signalled to the parser by
Answer: A
Correct answer: a distinguished end of file token returned by the scanner
The parser needs to know that the input has ended in the same form as everything else it consumes, so the scanner returns a special end of file token, conventionally written as a dollar sign in grammars. The grammar then has a production that accepts the start symbol followed by that token, which is how it recognises a complete program.
Please log in or register to report this question.