Parse trees are used in parsers to represent the tokens and how they relate to one another, according to the grammatical rules of the high-level language. It produces syntax errors when the tokens aren’t related properly according to the rules, and may attempt to “recover” from them.
Parse trees are used to represent derivations. It’s a tree with the following properties:
- The root represents the start symbol .
- Leaf nodes represent terminal symbols.
- Interior nodes represent non-terminal symbols.
- Edges connect each symbol to the one from which it is derived.