Syntax
The next stage of source code analysis after lexical scanning is syntax parsing.
The input for syntax parser is stream of tokens produced during the lexical scanning or incremental rescanning stage.
Syntax parsing, and especially incremental reparsing, is a more complex process that includes error recovery and other features. However, you will find many similarities between the lexical scanning and syntax parsing APIs of Lady Deirdre.
The output of the syntax parser is a syntax tree, which is used in the semantic analysis stage.