A lexer might seem like one of the boringest pieces of code to write, but every language brings it’s own little wrinkles to the problem. Elegant solutions are more work, but also more rewarding. There is, of course, a large body of work on table-driven approaches, several of them listed here (and bigger list), though…