Home »
MCQs »
Natural Language Processing (NLP) MCQs
Which of the following correctly defines the role of a parser?
21. Which of the following correctly defines the role of a parser?
- A Parser reports any syntax error
- A Parser recovers from a common error to continue processing of the rest of the program
- A Parser creates a parse tree
- All of the above
Answer
The correct answer is: D) All of the above
Explanation
A Parser is a software component which takes text as input and gives structural representation of input after checking it against the grammar of the language. Main roles of a parser are following:
- To report any syntax error.
- To recover from commonly occurring errors to continue parsing of the rest of the program.
- To create a parse tree
- To create a symbol tree
- To produce intermediate representations.