Documentation ¶
Overview ¶
Package syntax defines an Abstract Syntax Tree, an AST, for Neugram.
Nodes in the AST are represented by Node objects. The particular nodes for expressions, statements, and types are defined in the respective packages:
syntax/expr syntax/stmt syntax/tipe
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cursor ¶
type Cursor struct { Node Node // the current Node Parent Node // the parent of the current Node Name string // name of the parent field containing the current Node // contains filtered or unexported fields }
A Cursor describes a Node during a syntax tree traversal.
type Node ¶
A Node is a node in the syntax tree.
func Walk ¶
Walk traverses a syntax tree, calling preFn and postFn for each node.
If a preFn is provided it is called for each node before its children are traversed. If preFn returns false no children are traversed.
If a postFn is provided it is called for each node after its children are traversed. TODO: If a postFn returns false traversal ends.
Directories ¶
Path | Synopsis |
---|---|
Package expr defines data structures representing Neugram expressions.
|
Package expr defines data structures representing Neugram expressions. |
Package src provides source code position tracking.
|
Package src provides source code position tracking. |
Package stmt defines data structures representing Neugram statements.
|
Package stmt defines data structures representing Neugram statements. |
Package tipe defines data structures representing Neugram types.
|
Package tipe defines data structures representing Neugram types. |
Package token defines data structures representing Neugram tokens.
|
Package token defines data structures representing Neugram tokens. |