Sui Move Language Grammar (mainnet-v1.43.1)

A next generation language for secure asset programming. Its primary use case is in blockchain environments, where Move programs are used to construct state changes. Move allows developers to write programs that flexibly manage and transfer assets, while providing the security and protections against attacks on those assets.

Parser Grammar

module

Modules are the core program unit that define types along with functions that operate on these types. (AST: ModuleDefinition, Doc: Modules)

Rule module

enum-definition

An enum is a user-defined data structure containing one or more variants. Each variant can optionally contain typed fields. The number, and types of these fields can differ for each variant in the enumeration. Fields in enums can store any non-reference, non-tuple type, including other structs or enums. (AST: EnumDefinition, Doc: Enumerations)

Rule enum-definition

type-parameters

This type is used in multiple places. To avoid redundant definitions, a shared virtual type is created to simplify imports.

Rule type-parameters

type-parameter

Both functions and structs can take a list of type parameters in their signatures, enclosed by a pair of angle brackets <...>. (AST: DatatypeTypeParameter, Doc: Declaring Type Parameters)

Rule type-parameter

abilities

This type is used in multiple places. To avoid redundant definitions, a shared virtual type is created to simplify imports.

Rule abilities

ability

Abilities are a typing feature in Move that control what actions are permissible for values of a given type. (AST: Ability, Doc: Abilities)

Rule ability

doc-comment

Documentation comments are special comments that are used to generate documentation for your code. They are similar to block comments but start with three slashes /// and are placed before the definition of the item they document. (AST: DocComment, Doc: Doc comment)

Rule doc-comment