As a counterpoint to the dozens of people saying they've only ever used separate lexers and parsers, Parsing Expression Grammar (PEG) libraries generally combine high-level parsing with low-level lexing. This allows grammars to be composable, such as embedding SQL, JSON, or XML literals directly into code as-is, without a second level of escaping.
In my opinion, a lot of the need for separate lexing was historical, due to the weak optimisations in the compilers of the era. With modern languages like C++ or Rust on top of LLVM, the lexing steps can be inlined efficiently.
In my opinion, a lot of the need for separate lexing was historical, due to the weak optimisations in the compilers of the era. With modern languages like C++ or Rust on top of LLVM, the lexing steps can be inlined efficiently.