Which of the following best describes the relationship between a lexer and a parser?
-
The lexer generates machine code, while the parser checks syntax
-
The lexer produces tokens, which the parser uses to build a syntax tree
-
The lexer and parser perform the same function
-
The parser generates tokens, while the lexer checks syntax