A lexer is a software component that identifies keywords, identifiers, operators, numbers, and other basic building blocks of a programming language within the input text.