# Syntax Analysis ## Context-Free Grammars (CFG) ## Parse Tree A tree representation of the derivation parse tree has `terminals` at the leaves, `non-terminals` at the interior. An in-order traversal of the leaves is the original input. * leftmost derivation * rightmost derivation ### Ambiguity should be removed for example: `A + B * C` should be resolved **removing ambiguity** ### AST (Abstract Syntax Tree) ### Error Handling One of the purposes of the compiler is error handling. - to detect non-valid programs - and to translate the non-valid to the valid ## Parsing ### Top-down Parsing **Recursive Descent Parsing** ### Predictive Parsing