Module lwb_parser::parser::syntax_file::ast
source · [−]Structs
Annotations are tags that modify a specific sort or more often constructor. TODO: Document each
A character class represent a selection of terminal characters. This is similar to
Regex character classes. Character classes can be inverted by starting them with a ^
.
For example, [^\n]
means it matches any character that is not a newline.
A documentation comment (doc comment) is always associated with a sort or constructor. It documents what it does. Doc comments will be interpreted and will be put on the generated types during codegen.
An identifier is any name of a constructor or sort, and is used in various places. Identifiers always start with a letter (capital or not) or an underscore, and can be followed by letters or numbers. This is very similar to how variables in most major programming languages work.
Other top-level constructs that are not sorts
Enums
A [sort
] consists of constructors. A sort will try each of the constructors
from top to bottom, and use the first one that succesfully parses the input string.
A delimited expression can be repeated just like normal repetition expressions. To denote this, you can use a delimitation bound.
With expressions, you can give the syntax rules of a single constructor. Expressions can be nested and combined.
A sort is a group of constructors. See [constructor
] for more details.