Module grammar#
Module grammar describes imports, exports, aliases, packages, namespaces, and module-level dependency boundaries.
Source#
| Property | Value |
|---|---|
| Grammar file | packages/business/language/grammar/module.g4 |
| Grammar name | module |
| Grammar kind | parser |
| Imports | common, 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 by | BusinessLanguage |
| Direct rule or token count | 6 |
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#
moduleDeclaration: annotation* MODULE identifier moduleHeader? OPEN_BRACE moduleMember* CLOSE_BRACE;importDeclaration#
importDeclaration
: IMPORT importPath SEMICOLON?
| IMPORT importPath OPEN_PAREN CLOSE_PAREN SEMICOLON?
| IMPORT importPath OPEN_PAREN identifierList CLOSE_PAREN SEMICOLON?
;exportDeclaration#
exportDeclaration
: EXPORT importPath SEMICOLON?
| EXPORT MULTIPLY FROM importPath SEMICOLON?
| EXPORT MULTIPLY FROM stringLiteral SEMICOLON?
;Complete rule and token inventory#
exportDeclaration, importDeclaration, moduleDeclaration, moduleHeader, moduleHeaderProperty, moduleMemberExamples#
Import selected names#
import erp.finance(CompanyCode, CurrencyCode);Import a path with an empty selection#
import erp.shared();Path exports#
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.
Related guides#
- /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.