Lexing
Goal
- Convert text into tokens
- Skip whitespace and comments
Longest match
- Check two-char operators first
==,!=,<=,>=
Identifiers
- Start: letter or
_ - Continue: letter, digit,
_ - Reclassify as keyword when matched
Positions
- Record line/column at token start
- Helpful errors later
Style
- Simple loops
- Readable over clever
1 / 1