As you typed a BASIC command, the cursor would switch between being a flashing 'K' (keyword entry mode: the next key you press will enter the white keyword on that key), or in expression entry mode, a flashing 'L' (lowercase letter entry) or 'C' (capital letter entry). Other keywords were accessible using the 'Symbol Shift' key (to enter the symbols or function names in red on the key caps), or by pressing symbol shift and shift you could put it into 'Extended' mode and enter the red or green keywords above or below the keys.
The upshot of this was that Spectrum BASIC never had to lex code outside of basic expression parsing - and the only ASCII lexing it had to handle was expressions containing literals and variable names. Any keyword token was stored just as a single character token in memory - the program was stored tokenized and ready to be interpreted. It was fundamentally impossible to type certain classes of syntax error.
I remember being kind of surprised when I came across the BBC Micro and C64 where you had to type BASIC keywords out in full. It felt crazy - how could the computer handle you mistyping 'prnit'? How come the computer let you type lines of BASIC in that were wrong?
I still think there's something slightly broken about the fact that text editors let you type syntactically invalid code.