N NezamDocumentation

Struct grammar#

Struct grammar is the compatibility module for structured type declarations imported by the root grammar.

Source#

PropertyValue
Grammar filepackages/business/language/grammar/struct.g4
Grammar namestruct
Grammar kindparser
Importscommon, type, annotation, expression
Imported byBusinessLanguage, module
Direct rule or token count7

How to use this page#

Read the examples first when authoring Business Language. Use the rule inventory when checking exact grammar coverage or when updating parser, lowering, editor, or documentation behavior.

Entry rules and syntax families#

Start with these rules when reading this grammar: structDeclaration.

  • Declarations: structDeclaration

Key grammar excerpts#

structDeclaration#

antlr
structDeclaration
    : annotation* STRUCT identifier OPEN_BRACE structMemberList? CLOSE_BRACE
    ;

Complete rule and token inventory#

text
fieldModifier, fieldReference, fieldSuffix, structDeclaration, structMember, structMemberList, structMemberTerminator

Examples#

Struct declaration#

bl
struct PostingResult {
  field posted: bool;
  field document_number: string;
}

Struct as DTO#

bl
struct VendorDto {
  field vendor_id: VendorId;
  field vendor_name: string;
}

Common authoring mistakes#

  • Do not copy examples without checking the rule inventory for the exact grammar boundary.
  • Do not add behavior that depends on missing configuration or undeclared user-facing errors.
  • /language/data-modeling/
  • /language/types-literals/

Authoring notes#

  • Keep examples aligned with the grammar source, not with inferred syntax from another language.
  • Use declared messages for user-facing failures, and fail closed when required configuration is absent.
Source: packages/business/language/grammar-files/struct.md