compilers Definition Lexer A lexer converts seemingly meaningless text into syntactically or semantically more meaningful tokens based on grammar rules.