Question

    Which component of a compiler interacts directly with the lexer?

    A Code generator Correct Answer Incorrect Answer
    B Parser Correct Answer Incorrect Answer
    C Optimizer Correct Answer Incorrect Answer
    D Semantic analyzer Correct Answer Incorrect Answer
    E None of these Correct Answer Incorrect Answer

    Solution

    The parser interacts directly with the lexer. After the lexer produces a stream of tokens, the parser processes these tokens to build the syntactic structure of the program and create an abstract syntax tree (AST).

    Practice Next

    Relevant for Exams: