N NezamDocumentation

Annotation grammar#

Annotation grammar describes metadata blocks and attribute lists that attach compiler-facing information to declarations.

Source#

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

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

  • Declarations: annotationDeclaration

Key grammar excerpts#

annotationDeclaration#

antlr
annotationDeclaration: ANNOTATION_START identifier OPEN_PAREN parameterList? CLOSE_PAREN OPEN_BRACE annotationMember* CLOSE_BRACE;

Complete rule and token inventory#

text
annotationDeclaration, annotationMember, annotationMethod, annotationProperty

Examples#

Declaration annotation#

bl
@label("Vendor number")
@deprecated(reason: "Use supplier_id after migration")
field VendorId: string;

Multiple attributes#

bl
@index(name: "vendor_company_idx", unique: true)
table VendorCompanyIndex {
  field vendor_id: VendorId key;
  field company_code: CompanyCode key;
}

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/annotations/
  • /language/declarations/

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/annotation.md