AST vs Parse Tree
That they are the same tree drawn at different levels of detail. They are not: the parse tree contains a node for every grammar rule applied and every token consumed, including parentheses and semicolons, and the AST deliberately deletes exactly those.
Parse tree (concrete syntax tree)
When you must reproduce the source exactly — formatters, refactoring tools, language servers, anything that rewrites code a human will read again.
Abstract syntax tree
When you are compiling: type checking, lowering and optimization only need the shape, not the punctuation.
| Aspect | Parse tree (concrete syntax tree) | Abstract syntax tree |
|---|---|---|
| Node set | One per grammar production plus one per token. | One per meaningful construct. Punctuation is gone. |
| Parentheses | Present as nodes. | Absent — the grouping they expressed is the tree shape. |
| Round-trips to source | Yes, byte for byte, if trivia is kept. | No. Reprinting gives you formatted code, not the original. |
| Size | Large; grows with grammar complexity, not program complexity. | Small; roughly proportional to what the program says. |
| Who wants it | IDE tooling, linters that report on style, formatters. | The rest of the compiler. |
| Consequence of choosing wrong | Compiler passes pattern-match against grammar noise. | A formatter loses the user’s line breaks and comments. |