Crate ast

source ·
Expand description

§Abstract Syntax Tree (AST) Module

The AST module contains the definitions for the abstract syntax tree (AST) nodes generated by the parser. The AST nodes are used to represent the structure of the source code in a tree-like format, which can be used to perform various analysis and evaluation tasks on the code.

The AST nodes are defined as Rust structs, and are serialisable to JSON using the serde library. This allows the AST to be easily converted to a JSON string for debugging and analysis purposes.

The AST module is divided into sub-modules, each of which contains the definitions for a specific type of AST node, such as expressions, statements, and literals.

The AST module also contains a Program struct, which is the root node for all syntax trees generated by the parser. The Program struct contains a list of statements, which represent the top-level statements in the source code.

Modules§

  • This module contains the AST representation for expressions in the SAP language.
  • Literal value representation for the SAP language.
  • This module contains the AST nodes for the SAP language statements.
  • This module contains the Display trait implementations for the AST nodes.

Structs§

  • Represents a whole program source file in the SAP language. It is the root node for all syntax trees generated by the parser.
  • Represents a list of statements. It is used to store a list of statements for an entire program, or for a block of code within a function or selection statement.

Functions§

  • Converts an AST node to a JSON string representation.