N NezamDocumentation

Common grammar#

Common grammar provides reusable identifiers, modifiers, blocks, simple statements, and shared punctuation patterns used by the rest of the parser.

Source#

PropertyValue
Grammar filepackages/business/language/grammar/common.g4
Grammar namecommon
Grammar kindparser
ImportsNone
Imported byannotation, api, app, BusinessLanguage, class, configuration, controls, entity, enum, error, errorHandling, expression, field, form, function, iac, interface, literal, message, module, program, query, rule, service, source_ui, struct, subscription, table, test, type, validation
Direct rule or token count22

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: stringArrayLiteral, annotationStringLiteral, annotationNumericLiteral, annotationBooleanLiteral.

  • Literals: annotationBooleanLiteral, annotationNumericLiteral, annotationStringLiteral, stringArrayLiteral

Key grammar excerpts#

stringArrayLiteral#

antlr
stringArrayLiteral
    : OPEN_BRACKET stringLiteralList? CLOSE_BRACKET
    ;

annotationStringLiteral#

antlr
annotationStringLiteral: STRING_LITERAL
                       | DOUBLE_QUOTE_STRING
                       | SINGLE_QUOTE_STRING
                       | TEMPLATE_STRING
                       | BACKTICK_STRING
                       | STRING
                       ;

annotationNumericLiteral#

antlr
annotationNumericLiteral: DECIMAL_INTEGER
                        | INTEGER
                        | HEX_INTEGER
                        | OCTAL_INTEGER
                        | BINARY_INTEGER
                        | FLOAT
                        | SCIENTIFIC_FLOAT
                        | DECIMAL_FLOAT
                        | ENGINEERING_FLOAT
                        ;

Complete rule and token inventory#

text
accessModifier, annotation, annotationArgument, annotationArgumentList, annotationBooleanLiteral, annotationNumericLiteral, annotationStringLiteral, annotationValue
argumentLabel, builtinIdentifier, functionModifier, identifier, identifierList, importPath, importPathSegment, keywordIdentifier
onPropertyKey, propertyKeyName, qualifiedIdentifier, stringArrayLiteral, stringLiteralList, unresolvedIdentifier

Examples#

Block and terminators#

bl
{
  var posted: bool = false;
  posted = true;
}

Qualified name#

bl
using finance.shared { CompanyCode, CurrencyCode } as 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.
  • /language/syntax/
  • /language/statements-control-flow/

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/common.md