Business Language grammar#
The root parser composes every imported grammar module and defines the top-level program, declaration, statement, package, namespace, workspace, and configuration entry flow.
Source#
| Property | Value |
|---|---|
| Grammar file | packages/business/language/grammar/BusinessLanguage.g4 |
| Grammar name | BusinessLanguage |
| Grammar kind | parser |
| Imports | common, type, literal, expression, field, table, function, enum, message, annotation, struct, validation, error, app, api, class, entity, service, form, module, interface, controls, configuration, rule, subscription, test, source_ui, program, iac |
| Imported by | None |
| Direct rule or token count | 24 |
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: packageDeclaration, packageBody, workspaceDeclaration, usingDeclaration, versionLiteral, configDeclaration, namespaceDeclaration.
- Declarations:
configDeclaration,namespaceDeclaration,packageDeclaration,usingDeclaration,workspaceDeclaration - Bodies:
packageBody - Literals:
versionLiteral
Key grammar excerpts#
packageDeclaration#
packageDeclaration
: PACKAGE qualifiedIdentifier packageBody?
;packageBody#
packageBody
: SEMICOLON
| OPEN_BRACE packageMember* CLOSE_BRACE
;workspaceDeclaration#
workspaceDeclaration
: WORKSPACE qualifiedIdentifier OPEN_BRACE workspaceMember* CLOSE_BRACE
;Complete rule and token inventory#
configBlock, configDeclaration, configEntry, configEntryKey, configEntryList, configEntrySeparator, configValue, declaration
namespaceDeclaration, packageBody, packageDeclaration, packageMember, program, programItem, statement, usingAlias
usingCondition, usingDeclaration, usingImportList, usingVersion, versionLiteral, versionSegment, workspaceDeclaration, workspaceMemberExamples#
Minimal package#
package finance.payables;
field VendorId: string {
max_length: 40;
key: true;
}
table Vendor {
field vendor_id: VendorId key origin;
field company_code: CompanyCode key;
field active: bool default(true);
}
public function find_vendor(vendor_id: VendorId): Vendor? {
select var vendor: Vendor where Vendor.vendor_id = vendor_id;
return vendor;
}Configuration table plus behavior#
table PayablePolicy {
field company_code: CompanyCode key;
field duplicate_invoice_check: bool required;
}
rule invoice_can_post(invoice_id: InvoiceId): bool {
return invoice_id != null;
}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/
- /language/declarations/
- /language/modules-namespaces/
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.