N NezamDocumentation

Module grammar#

Module grammar describes imports, exports, aliases, packages, namespaces, and module-level dependency boundaries.

Source#

PropertyValue
Grammar filepackages/business/language/grammar/module.g4
Grammar namemodule
Grammar kindparser
Importscommon, type, expression, literal, field, table, entity, class, struct, interface, enum, service, api, function, message, validation, test, app, form, controls, configuration, annotation, error, rule, subscription
Imported byBusinessLanguage
Direct rule or token count6

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: moduleDeclaration, importDeclaration, exportDeclaration.

  • Declarations: exportDeclaration, importDeclaration, moduleDeclaration

Key grammar excerpts#

moduleDeclaration#

antlr
moduleDeclaration: annotation* MODULE identifier moduleHeader? OPEN_BRACE moduleMember* CLOSE_BRACE;

importDeclaration#

antlr
importDeclaration
    : IMPORT importPath SEMICOLON?
    | IMPORT importPath OPEN_PAREN CLOSE_PAREN SEMICOLON?
    | IMPORT importPath OPEN_PAREN identifierList CLOSE_PAREN SEMICOLON?
    ;

exportDeclaration#

antlr
exportDeclaration
    : EXPORT importPath SEMICOLON?
    | EXPORT MULTIPLY FROM importPath SEMICOLON?
    | EXPORT MULTIPLY FROM stringLiteral SEMICOLON?
    ;

Complete rule and token inventory#

text
exportDeclaration, importDeclaration, moduleDeclaration, moduleHeader, moduleHeaderProperty, moduleMember

Examples#

Import selected names#

bl
import erp.finance(CompanyCode, CurrencyCode);

Import a path with an empty selection#

bl
import erp.shared();

Path exports#

bl
export erp.finance;
export * from "erp.shared";

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/modules-namespaces/
  • /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/module.md