N NezamDocumentation

Enum grammar#

Enum grammar describes invariant named value sets used only when values should not vary by tenant, company, country, process, or time.

Source#

PropertyValue
Grammar filepackages/business/language/grammar/enum.g4
Grammar nameenum
Grammar kindparser
Importscommon, type, expression, literal
Imported byBusinessLanguage, module
Direct rule or token count5

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: enumDeclaration.

  • Declarations: enumDeclaration

Key grammar excerpts#

enumDeclaration#

antlr
enumDeclaration
    : accessModifier? ENUM identifier OPEN_BRACE enumValueList? CLOSE_BRACE
      // @define @name_fields(identifier) @symbol(kind=global) @scope(level=2)
    ;

Complete rule and token inventory#

text
enumDeclaration, enumValue, enumValueList, enumValueListCore, enumValueSeparator

Examples#

Stable invariant enum#

bl
enum DebitCreditIndicator {
  DEBIT,
  CREDIT
}

Avoid policy enum#

bl
// Approval outcomes vary by process, so store them in configuration tables instead of an enum.

Common authoring mistakes#

  • Do not model approval states, routing outcomes, thresholds, or reason codes as enums when they can vary by process.
  • Keep enum members for stable invariants; move tenant-controlled value sets into configuration tables.
  • /language/types-literals/
  • /language/data-modeling/

Authoring notes#

  • Use enums only for true invariants such as debit and credit indicators.
  • 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/enum.md