Annotation grammar#
Annotation grammar describes metadata blocks and attribute lists that attach compiler-facing information to declarations.
Source#
| Property | Value |
|---|---|
| Grammar file | packages/business/language/grammar/annotation.g4 |
| Grammar name | annotation |
| Grammar kind | parser |
| Imports | common, type, expression |
| Imported by | BusinessLanguage, iac, module, struct |
| Direct rule or token count | 4 |
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: annotationDeclaration.
- Declarations:
annotationDeclaration
Key grammar excerpts#
annotationDeclaration#
annotationDeclaration: ANNOTATION_START identifier OPEN_PAREN parameterList? CLOSE_PAREN OPEN_BRACE annotationMember* CLOSE_BRACE;Complete rule and token inventory#
annotationDeclaration, annotationMember, annotationMethod, annotationPropertyExamples#
Declaration annotation#
@label("Vendor number")
@deprecated(reason: "Use supplier_id after migration")
field VendorId: string;Multiple attributes#
@index(name: "vendor_company_idx", unique: true)
table VendorCompanyIndex {
field vendor_id: VendorId key;
field company_code: CompanyCode key;
}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/annotations/
- /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.