Module cst

Module cst 

Source
Expand description

Box language concrete syntax tree (CST).

This module contains two representations of the Box CST.

The type Tree is an explicit representation of a CST. It consists of Rust vectors of function calls (FuncCall). These calls contain Rust vectors of arguments (Arg). Some of these arguments may, in turn, contain nested trees if the argument is a list type.

The explicit representation is easy to use, but is inefficient and makes using the CST a costly abstraction. The alternative representation is an iterator representation, based on two traits TreeIter and ArgsIter. With this representation, instead of materializing the CST at once with a type like a Tree, calling code instead iterates over the tree.

Structs§

Arg
An argument to a function.
FuncCall
A function call.
Tree
Explicit representation of a CST.

Enums§

ArgsItem
Item returned by ArgsIter.
TreeItem
Item returned by TreeIter.
Value
The value of an argument to a function.

Traits§

ArgsIter
Iterator over the arguments of a function.
TreeIter
Iterator representation of a CST.

Functions§

parse
Parse Box language source code into a CST.
parse_using_lexer
Parse into a CST using an explicitly provided lexer.
pretty_print
Pretty print a Box CST.