N NezamDocumentation

Program grammar#

Program grammar is the compatibility module for program-level declarations imported by the root grammar.

Source#

PropertyValue
Grammar filepackages/business/language/grammar/program.g4
Grammar nameprogram
Grammar kindparser
Importscommon, literal, expression
Imported byBusinessLanguage
Direct rule or token count15

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: programDeclaration, programHostDeclaration, programHostBindDeclaration, programStoreDeclaration, providerProfileDeclaration, providerProfileBindDeclaration.

  • Declarations: programDeclaration, programHostBindDeclaration, programHostDeclaration, programStoreDeclaration, providerProfileBindDeclaration, providerProfileDeclaration

Key grammar excerpts#

programDeclaration#

antlr
programDeclaration
    : annotation* accessModifier? PROGRAM identifier OPEN_BRACE programMember* CLOSE_BRACE
      // @define @name_fields(identifier) @symbol(kind=global) @scope(level=2) @runtime_ast_export
    ;

programHostDeclaration#

antlr
programHostDeclaration
    : HOST programHostKind identifier OPEN_BRACE programHostMember* CLOSE_BRACE
      // @define @name_fields(identifier) @symbol(kind=non_local) @runtime_ast_export
    ;

programHostBindDeclaration#

antlr
programHostBindDeclaration
    : BIND COLON singleExpression SEMICOLON?
    ;

Complete rule and token inventory#

text
programDeclaration, programHostBindDeclaration, programHostDeclaration, programHostKind, programHostMember, programHostStartupSection, programMember, programProperty
programStartupArgument, programStartupInvocation, programStartupStep, programStoreDeclaration, providerProfileBindDeclaration, providerProfileDeclaration, providerProfileMember

Examples#

Program declaration shell#

bl
program nightly_payables_close {
  schedule: "0 2 * * *";
}

Program config entry#

bl
program vendor_sync {
  batch_size: 500;
}

Hosts, stores, and provider profile#

bl
public program OperationsRuntime {
  host console maintenance {
    bind: MaintenanceCommands;

    startup {
      ensure Database.migrate "latest" true 1;
      ensure Jobs.seed ReferenceData;
    }
  }

  host http api {
    bind: VendorApi;
    port: 8080;
  }

  store primary {
    storage_adapter: "postgres";
    pool: {
      max: 20;
    };
  }

  provider_profile production {
    bind Cloud.Postgres -> Providers.Postgres;
    location: "eu-central-1";
  }
}

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/resources-deployments/
  • /reference/compiler-pipeline/

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