-
Book Overview & Buying
-
Table Of Contents
Practical System Programming for Rust Developers
By :
The parser is the module in our project that constructs the AST, which is a tree of nodes with each node representing a token (a number or an arithmetic operator). The AST is a recursive tree structure of token nodes, that is, the root node is a token, which contains child nodes that are also tokens.
The parser is a higher-level entity compared to the Tokenizer. While the Tokenizer converts user input into fine-grained tokens (for example, various arithmetic operators), the parser uses the Tokenizer outputs to construct an overall AST, which is a hierarchy of nodes. The structure of the AST constructed from the parser is illustrated in the following diagram:
Figure 2.7 – Our AST
In the preceding figure, each of the following are nodes:
Each of these...