enso/docs/parser/ast.md
2020-07-21 13:59:40 +01:00

1.2 KiB

layout title category tags order
developer-doc AST parser
parser
ast
9

AST

The parser AST describes the high-level syntactic structure of Enso, as well as containing robust and descriptive parser errors directly in the AST.

Functionality

The parser AST needs to account for the following:

  • A single Name type, removing the distinction between different names found in the lexer. This should provide functions is_var, is_opr, and is_ref.
  • It should contain all of the language constructs that may appear in Enso's source.
  • It should contain Invalid nodes, but these should be given a descriptive error as to why the construct is invalid.
  • It should also contain Ambiguous nodes, where a macro cannot be resolved in an unambiguous fashion.

Each node should contain:

  • An identifier, attributed to it from the ID map.
  • The start source position of the node, and the length (span) of the node.

The actionables for this section are:

  • Flesh out the design for the AST based on the requirements of the various parser phases.