Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.brim-lang.com/llms.txt

Use this file to discover all available pages before exploring further.

This page summarizes the current grammar.ebnf design target used for Brim syntax discussions and parser implementation. The canonical source lives in the main repository:

Core design goals

From the grammar header:
  • no semicolons
  • newline/comma-separated lists
  • bindings use := and <- instead of let
  • visible mutation/ownership modes (view, mut, own, move)
  • module/import/export/package forms
  • record and ADT modeling through type and data

Source file shape

file = whitespace
 module_decl?
 file_imports?
 item_list?
 EOF ;
module_decl = "module" module_path separator? ;
file_imports = { import_decl | import_block } ;
item_list = { item separator? } ;

Separators

Brim treats newlines as separators, not block delimiters.
separator = newline { newline } | "," { newline } ;
Braces still define blocks.

High-level item categories

item = function_decl
 | type_decl
 | data_decl
 | trait_decl
 | impl_decl
 | const_decl
 | extern_block
 | test_block ;
Continue with: