December 2009
Intermediate to advanced
380 pages
9h 2m
English
| Pattern 8 | Parse Tree |
A parse tree describes how a parser recognized an input sentence.
A parse tree is sometimes called a syntax tree (as opposed to an abstract syntax tree). Despite not being that useful for building interpreters and translators, I’m including this pattern because parse trees are heavily used by development environments and text rewriting systems.
Parse trees record the sequence of rules a parser applies as well as the tokens it matches. Interior parse tree nodes represent rule applications, and leaf nodes represent token matches. Parse trees describe sentence structure by grouping input symbols into subtrees. Subtrees represent the structure of phrases (sentence fragments). For example, the following parse ...