Compilers
Lesson 1 of 3 6 min +40 XP

From Source to Tokens

Lexical analysis.

What you'll learn

  • Understand from source to tokens
  • Apply it to real examples
  • Check yourself with a quiz
Cutting the sentence into words

Before you can understand a sentence, you split it into words. A compiler's lexer does the same to code — chopping raw text into tokens like keywords, names, and symbols.

Tokens first

Lexical analysis (lexing) breaks source text into tokens — the basic units a parser can work with.

Knowledge Check

+10 XP / correct

1. Lexing breaks source into…

2. A keyword like 'if' becomes a…