lexer from chapter 2