Interface grammar#
Interface grammar describes contracts, method signatures, properties, events, type parameters, and interface inheritance.
Source#
| Property | Value |
|---|---|
| Grammar file | packages/business/language/grammar/interface.g4 |
| Grammar name | interface |
| Grammar kind | parser |
| Imports | common, type, literal, expression |
| Imported by | BusinessLanguage, module |
| Direct rule or token count | 10 |
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: interfaceDeclaration, functionReturnType.
- Declarations:
interfaceDeclaration - Types:
functionReturnType
Key grammar excerpts#
interfaceDeclaration#
interfaceDeclaration: annotation* INTERFACE identifier OPEN_BRACE interfaceMember* CLOSE_BRACE;functionReturnType#
functionReturnType: ASYNC? typeExpression;Complete rule and token inventory#
functionReturnType, interfaceAnnotation, interfaceConstant, interfaceDeclaration, interfaceFunction, interfaceMember, interfaceProperty, parameter
parameterList, typeExpressionListExamples#
Interface contract#
interface InvoicePoster {
function post(invoice_id: InvoiceId): PostingResult;
}Service implements contract#
interface ExchangeRateProvider {
function rate(from_currency: CurrencyCode, to_currency: CurrencyCode): decimal;
}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/classes-interfaces/
- /language/services-apis/
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.