Question

    Which of the following tasks is not typically performed

    by a lexer?
    A Handling whitespace and comments Correct Answer Incorrect Answer
    B Identifying keywords and identifiers Correct Answer Incorrect Answer
    C Detecting syntax errors Correct Answer Incorrect Answer
    D Removing redundant code Correct Answer Incorrect Answer
    E None of these Correct Answer Incorrect Answer

    Solution

    Lexers primarily focus on recognizing tokens and breaking down the source code. Removing redundant code is usually a concern for other compilation phases, such as optimization.

    Practice Next

    Relevant for Exams: