To create an intermediate representation which has an interface we can work with.

Provides extra context by grouping tokens in a meaningful way.

Example groups: function, function head, function body, declaration, assignment, etc…

These form a tree, where each parent is the group.

It also serves to distinguish valid tokens from invalid ones via the use of context-free grammars.

top down parsing

bottom up parsing