N NezamDocumentation

App grammar#

App grammar describes application declarations, pages, navigation, actions, layouts, and UI wiring at the application level.

Source#

PropertyValue
Grammar filepackages/business/language/grammar/app.g4
Grammar nameapp
Grammar kindparser
Importscommon, expression, literal, form, type
Imported byBusinessLanguage, module
Direct rule or token count38

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: appDeclaration, appStateDeclaration.

  • Declarations: appDeclaration, appStateDeclaration

Key grammar excerpts#

appDeclaration#

antlr
appDeclaration
    : annotation* accessModifier? APP identifier
      appDeclarationWithHeader
    | annotation* accessModifier? APP identifier
      appDeclarationWithoutHeader
      // @define @name_fields(identifier) @role(member_owner) @kind(layout:app) @symbol(kind=global) @scope(level=2)
    ;

appStateDeclaration#

antlr
appStateDeclaration
    : annotation* accessModifier? identifier COLON typeExpression SEMICOLON?
      // @define @name_fields(identifier) @role(member_definition) @kind(member:state) @symbol(kind=non_local)
    ;

Complete rule and token inventory#

text
appDeclaration, appDeclarationWithHeader, appDeclarationWithoutHeader, appHeader, appHeaderProperty, appInlineHeaderProperty, appInlineHeaderValue, appInlineItem
appLayoutProperty, appLayoutValue, appMember, appStateDeclaration, commandPaletteCommand, commandPaletteCommandLabel, commandPaletteCommandOption, commandPaletteGroup
commandPaletteGroupName, commandPaletteSection, formLayout, formMount, formMountConfig, formMountProperty, formMountValue, formRef
layoutPreset, layoutSection, navigationItem, navigationProperty, navigationPropertyKey, navigationSection, navigationValue, startupSection
toolbarAction, toolbarActionLabel, toolbarActionOption, toolbarGroup, toolbarGroupName, toolbarSection

Examples#

Application shell with mounted form#

bl
app PayablesApp {
  title: "Payables";

  form Vendors: VendorForm {
    layout: two_column;
  }

  startup: Vendors;
}
bl
app FinanceConsole {
  navigation: {
    vendors: {
      label: "Vendors";
      form: Vendors;
    }
  }

  toolbar: {
    main: "Refresh" -> refresh_vendors;
  }
}

Inline form and object mount config#

bl
app VendorWorkspace {
  form VendorEditor {
    body: {
      vendor_name: Text from Vendor.vendor_name;
    }
  }

  form vendors: VendorForm {
    layout: grid;
    params: { readonly: false, source: VendorMaster };
  }

  startup: VendorEditor;
}

Unquoted action labels and options#

bl
app VendorConsole {
  form vendors: VendorForm {
    layout: grid;
  }

  toolbar: main:
    Save vendor -> save_vendor icon: "save" primary true;

  command_palettes: global:
    Open vendor -> open_vendor shortcut "Ctrl+K";

  startup: vendors;
}

Header app with state and shell layout#

bl
app BackOffice {
  title: "Back Office";
} {
  state {
    selected_vendor_id: VendorId;
  }

  form vendors: VendorForm {
    layout: grid;
    options: { density: "compact" };
  }

  command_palettes: {
    global: "Open vendors" -> open_vendors shortcut: "Ctrl+K";
  }

  ui: {
    layout: desktop;
  }

  startup: vendors;
}

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/apps-forms-controls/
  • /language/source-ui-layouts/

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