lexing-two-stages-scanning-evaluation
IN premise — entries/2026/06/21/wiki-Tokenization_lexical_analysis.md
Created 2026-06-21T09:50:11+00:00
Lexing has two stages: scanning (segmentation into lexemes using a finite-state machine) and evaluation (converting lexemes into typed token values).
Summary
Breaking raw text into tokens is not one monolithic step; it splits into first figuring out where boundaries fall and then assigning each chunk a type and concrete value. This matters because the two concerns can be debugged, optimized, or swapped independently, so a mistake in recognizing where one symbol ends does not get tangled up with a mistake in interpreting what that symbol means.