Skip to main content

Module ast

Module ast 

Source
Expand description

The abstract syntax tree produced by the Parser.

A parsed expression is a tree of Nodes. Every node records pos, the byte offset in the source of the token that produced it (for a binary operation, the operator; for function application, which has no operator, the start of the argument). Evaluation errors report this position.

Syntax errors do not stop parsing. They become Node::Unclosed or Node::UnexpectedToken leaves, which evaluate to Undefined values.

Structs§

BinaryOp
A node with two operands: an infix operator or function application.
Leaf
A leaf node: a literal value and its source position.
UnaryOp
A node with one operand: a prefix operator or a bracketed group.

Enums§

Node
A node of the Swan syntax tree.