Common grammar#
Common grammar provides reusable identifiers, modifiers, blocks, simple statements, and shared punctuation patterns used by the rest of the parser.
Source#
| Property | Value |
|---|---|
| Grammar file | packages/business/language/grammar/common.g4 |
| Grammar name | common |
| Grammar kind | parser |
| Imports | None |
| Imported by | annotation, 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 count | 22 |
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#
stringArrayLiteral
: OPEN_BRACKET stringLiteralList? CLOSE_BRACKET
;annotationStringLiteral#
annotationStringLiteral: STRING_LITERAL
| DOUBLE_QUOTE_STRING
| SINGLE_QUOTE_STRING
| TEMPLATE_STRING
| BACKTICK_STRING
| STRING
;annotationNumericLiteral#
annotationNumericLiteral: DECIMAL_INTEGER
| INTEGER
| HEX_INTEGER
| OCTAL_INTEGER
| BINARY_INTEGER
| FLOAT
| SCIENTIFIC_FLOAT
| DECIMAL_FLOAT
| ENGINEERING_FLOAT
;Complete rule and token inventory#
accessModifier, annotation, annotationArgument, annotationArgumentList, annotationBooleanLiteral, annotationNumericLiteral, annotationStringLiteral, annotationValue
argumentLabel, builtinIdentifier, functionModifier, identifier, identifierList, importPath, importPathSegment, keywordIdentifier
onPropertyKey, propertyKeyName, qualifiedIdentifier, stringArrayLiteral, stringLiteralList, unresolvedIdentifierExamples#
Block and terminators#
{
var posted: bool = false;
posted = true;
}Qualified name#
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.
Related guides#
- /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.