This directory contains the code for the AST of a Leo Program.
There are several types of nodes in the AST that then have further breakdowns.
All nodes store a Span, which is useful for tracking the lines and columns of where the node was taken from in the Leo Program.
The top level nodes in a Leo Program.
Represents an import statement in a Leo Program. A list of these are stored on the Program. It stores the path to an import and what is being imported.
NOTE: The import does not contain the source code of the imported Leo Program.
A circuit node represents a defined Circuit in a Leo Program. A order preserving map of these are stored on the Program. Contains the Circuit's name, as well as it's members. The members are a function, or a variable. For both of them the Circuit preserves their names.
An annotation node is a decorator that can be applied to a function. Stored on the function themselves despite being a top-level node. The node stores the name of the annotation, as well as any args passed to it.
A function node represents a defined function in a Leo Program. A order preserving map of these are stored on the Program. A function node stores the following information:
A global const is a bit special and has no special node for itself, but rather is a definition statement. A order preserving map of these are stored on the Program.
The different types in a Leo Program. Types themselves are not a node, but rather just information to be stored on a node.
The address type follows the BIP_0173 format starting with aleo1
.
The boolean type consists of two values true and false.
The char type resents a character from the inclusive range [0, 10FFFF].
The field type an unsigned number up to the modulus length of the field.
The group type a set of affine points on the elliptic curve passed.
The integer type represents a range of integer types.
A integer in the inclusive range [0, 255].
A integer in the inclusive range [0, 65535].
A integer in the inclusive range [0, 4294967295].
A integer in the inclusive range [0, 18446744073709551615].
A integer in the inclusive range [0, 340282366920938463463374607431768211455].
A integer in the inclusive range [-128, 127].
A integer in the inclusive range [-32768, 32767].
A integer in the inclusive range [-2147483648, 2147483647].
A integer in the inclusive range [-9223372036854775808, 9223372036854775807].
A integer in the inclusive range [-170141183460469231731687303715884105728, 170141183460469231731687303715884105727].
The array type contains another type, then the number of elements of that type greater than 0.
The tuple type contains n types, where n is greater than or equal to 0.
The circuit type, every circuit represents a different type.
The self type represented by Self
and only usable inside a circuit.
The statement level nodes in a Leo Program.
An assignment statement node stores the following:
A block statement node stores the following:
A conditional statement node stores the following:
A console statement node stores the following:
A definition statement node stores the following:
let
for mutable definitions.const
for cosntant definitions.An expression statement node stores the following:
A iteration statement node stores the following:
A return statement node stores the following:
The expression nodes in a Leo Program.
An array access expression node stores the following:
An array init expression node stores the following:
An array inline expression node stores the following:
An array range access expression node stores the following:
A binary expression node stores the following:
A call expression node stores the following:
A circuit init expression node stores the following:
A circuit member access expression node stores the following:
A circuit static function access expression node stores the following:
An identifer expression node stores the following:
A ternary expression node stores the following:
A tuple access expression node stores the following:
A tuple init expression node stores the following:
An unary expression node stores the following:
A value expression node stores one of the following: