N NezamDocumentation

Interface grammar#

Interface grammar describes contracts, method signatures, properties, events, type parameters, and interface inheritance.

Source#

PropertyValue
Grammar filepackages/business/language/grammar/interface.g4
Grammar nameinterface
Grammar kindparser
Importscommon, type, literal, expression
Imported byBusinessLanguage, module
Direct rule or token count10

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#

antlr
interfaceDeclaration: annotation* INTERFACE identifier OPEN_BRACE interfaceMember* CLOSE_BRACE;

functionReturnType#

antlr
functionReturnType: ASYNC? typeExpression;

Complete rule and token inventory#

text
functionReturnType, interfaceAnnotation, interfaceConstant, interfaceDeclaration, interfaceFunction, interfaceMember, interfaceProperty, parameter
parameterList, typeExpressionList

Examples#

Interface contract#

bl
interface InvoicePoster {
  function post(invoice_id: InvoiceId): PostingResult;
}

Service implements contract#

bl
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.
  • /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.
Source: packages/business/language/grammar-files/interface.md