notesonly.in

One notebook for every subject — open it anywhere.

Log in

Lexical analysis and tokenization

Compiler Design · Engineering

Study notes

Tokenize 'if (x1 >= 42)': keyword IF, '(', identifier 'x1', operator '>=', integer 42, ')'. The lexer matches '>=' by maximal munch (not '>' then '='), skips whitespace, and reports 'line 3: illegal @' for bad characters. The parser later receives this clean token stream, never raw characters.

← Back to topics for Engineering