You are on page 1of 1

Compilation phases

The lexer reads a string of characters an chops it into tokens, i.e. to

“meaningful words”; the figure represents the token string by putting

spaces between tokens.

• The parser reads a string of tokens and groups it into a syntax tree, i.e. to a structure indicating
which parts belong together and how; the figure represents the syntax tree by using parentheses.

• The type checker finds out the type of each part of the syntax tree that might have alternative
types, and returns an annotated syntax tree; the figure represents the annotations by the letter i
(“integer”) in square brackets.

You might also like