Program grammar#
Program grammar is the compatibility module for program-level declarations imported by the root grammar.
Source#
| Property | Value |
|---|---|
| Grammar file | packages/business/language/grammar/program.g4 |
| Grammar name | program |
| Grammar kind | parser |
| Imports | common, literal, expression |
| Imported by | BusinessLanguage |
| Direct rule or token count | 15 |
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#
programDeclaration
: annotation* accessModifier? PROGRAM identifier OPEN_BRACE programMember* CLOSE_BRACE
// @define @name_fields(identifier) @symbol(kind=global) @scope(level=2) @runtime_ast_export
;programHostDeclaration#
programHostDeclaration
: HOST programHostKind identifier OPEN_BRACE programHostMember* CLOSE_BRACE
// @define @name_fields(identifier) @symbol(kind=non_local) @runtime_ast_export
;programHostBindDeclaration#
programHostBindDeclaration
: BIND COLON singleExpression SEMICOLON?
;Complete rule and token inventory#
programDeclaration, programHostBindDeclaration, programHostDeclaration, programHostKind, programHostMember, programHostStartupSection, programMember, programProperty
programStartupArgument, programStartupInvocation, programStartupStep, programStoreDeclaration, providerProfileBindDeclaration, providerProfileDeclaration, providerProfileMemberExamples#
Program declaration shell#
program nightly_payables_close {
schedule: "0 2 * * *";
}Program config entry#
program vendor_sync {
batch_size: 500;
}Hosts, stores, and provider profile#
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.
Related guides#
- /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.