Literal grammar#
Literal grammar describes strings, numbers, booleans, nulls, arrays, maps, date-like values, money values, and structured literals.
Source#
| Property | Value |
|---|---|
| Grammar file | packages/business/language/grammar/literal.g4 |
| Grammar name | literal |
| Grammar kind | parser |
| Imports | common |
| Imported by | api, app, BusinessLanguage, class, controls, enum, errorHandling, expression, field, form, function, interface, message, module, program, query, service, source_ui, subscription, table, 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: literal, stringLiteral, integerLiteral, floatLiteral, booleanLiteral, nullLiteral, arrayLiteral, objectLiteral, percentageLiteral, dateLiteral.
- Literals:
arrayLiteral,booleanLiteral,dateLiteral,floatLiteral,integerLiteral,nullLiteral,numericLiteral,objectLiteral, and 4 more
Key grammar excerpts#
literal#
literal: stringLiteral
| percentageLiteral
| integerLiteral
| floatLiteral
| booleanLiteral
| nullLiteral
| arrayLiteral
| objectLiteral
| dateLiteral
| timeLiteral
| templateLiteral
// TODO: Restore regexLiteral once lexer-level regex mode returns; current lexerstringLiteral#
stringLiteral: STRING_LITERAL
| DOUBLE_QUOTE_STRING
| SINGLE_QUOTE_STRING
| TEMPLATE_STRING
| BACKTICK_STRING
| STRING
;integerLiteral#
integerLiteral: DECIMAL_INTEGER
| INTEGER_LITERAL
| HEX_INTEGER
| OCTAL_INTEGER
| BINARY_INTEGER
;Complete rule and token inventory#
arrayElement, arrayLiteral, booleanLiteral, computedPropertyKey, dateLiteral, floatLiteral, integerLiteral, literal
nullLiteral, numericLiteral, objectLiteral, objectValue, percentageLiteral, propertyAssignment, propertyName, propertySeparator
propertySpread, spreadElement, stringLiteral, templateElement, templateLiteral, timeLiteralExamples#
Scalar literals#
var enabled: bool = true;
var page_size: int = 25;
var label: string = "Payables";Collection literals#
var labels = ["Payables", "Receivables"];
var sample_amounts = { net: 1000.00, tax: 150.00 };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/types-literals/
- /language/expressions/
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.