Crate parser

source ·
Expand description

§Parser Module

The parser module contains the implementation of the SAP language parser. The parser is responsible for taking a sequence of tokens and converting them into an abstract syntax tree (AST). The AST is then used by the interpreter to execute the program.

The parser is implemented as a recursive descent parser, which is a top-down parser that starts from the root of the syntax tree and works its way down to the leaves.

It is also responsible for reporting syntax errors in the input program. When a syntax error is encountered, the parser returns an error containing a message describing the error.

Structs§

  • The Parser struct is responsible for parsing a sequence of tokens into an abstract syntax tree (AST). The parser is implemented as a recursive descent parser, which is a top-down parser that starts from the root of the syntax tree and works its way down to the leaves.

Constants§

Functions§

  • This function takes in a string input, and produces either a valid syntax tree, or a syntax error.