Skip to content
STIMSMITH

BNF Grammar

Concept

In the context of Sail, the term BNF Grammar refers to the formal Backus-Naur Form grammar that defines the concrete syntactic structure of the Sail instruction-set semantics specification language. It enumerates productions for identifiers, operators, types, kinds, quantifiers, effects, patterns, expressions, blocks, definitions, and declarations such as type, struct, enum, union, bitfield, function, mapping, register, instantiation, overload, scattered, val, let, and termination measure forms.

First seen 8/6/2026
Last seen 8/6/2026
Evidence 4 chunks
Wiki v1

WIKI

BNF Grammar

In the Sail language documentation, the term BNF Grammar designates the formal Backus-Naur Form grammar that specifies the concrete surface syntax of Sail. The grammar is presented as a sequence of productions (::=) covering lexical rules, type-level constructs, expression-level constructs, patterns, and the top-level definitions that constitute a Sail specification.

Lexical and Identifier Productions

READ FULL ARTICLE →

NEIGHBORHOOD

No graph connections found for this entity yet. It may appear in future ingestion runs.

explore full graph →

RELATIONSHIPS

23 connections
Sail ISA Specification Language ← implements 4e
Sail ISA Specification Language is defined by a BNF grammar covering all its syntactic constructs.
Function Definition ← part of 2e
The BNF grammar includes function definition productions.
Type Quantifier ← part of 1e
The BNF grammar of Sail includes type quantifiers as a production rule.
Kind Annotation ← part of 1e
The BNF grammar of Sail includes kind annotations as a production rule.
Pattern Matching ← part of 1e
The BNF grammar includes pattern matching productions.
Expression Language ← part of 1e
The BNF grammar includes the expression language productions.
Mapping Definition ← part of 1e
The BNF grammar includes mapping definition productions.
Struct Type ← part of 1e
The BNF grammar includes struct type definition productions.
Enum Type ← part of 1e
The BNF grammar includes enum type definition productions.
Union Type ← part of 1e
The BNF grammar includes union type definition productions.
Bitfield Type ← part of 1e
The BNF grammar includes bitfield type definition productions.
Register Type ← part of 1e
The BNF grammar includes register definition productions.
Overload Definition ← part of 1e
The BNF grammar includes overload definition productions.
Scattered Definition ← part of 1e
The BNF grammar includes scattered definition productions.
Termination Measure ← part of 1e
The BNF grammar includes termination measure productions.
Let Binding ← part of 1e
The BNF grammar includes let binding productions.
Attribute Annotation ← part of 1e
The BNF grammar includes attribute annotation productions.
Value Specification ← part of 1e
The BNF grammar includes value specification productions.
Extern Binding ← part of 1e
The BNF grammar includes extern binding productions.
Effect System ← part of 1e
The BNF grammar includes effect set productions as part of the type scheme grammar.
Bitvector Literal ← part of 1e
The BNF grammar includes bitvector literal productions.
Vector Type ← part of 1e
The BNF grammar includes vector expression and update productions.
Type Variable ← part of 1e
The BNF grammar of Sail includes type variables as a production rule.

CITATIONS

6 sources
6 citations — click to expand
[1] The BNF Grammar is the formal Backus-Naur Form grammar presented in the Sail documentation that defines the surface syntax of the Sail language, including identifiers, operators, types, kinds, quantifiers, patterns, expressions, blocks, and definitions. The Sail instruction-set semantics specification language
[2] The <def_aux> and <def> productions enumerate the top-level definition forms accepted by Sail, including function, mapping, type, struct, enum, union, bitfield, let, register, val, instantiation, overload, scattered, default, constraint, line directive, and termination_measure declarations. The Sail instruction-set semantics specification language
[3] The <typ> and <kind> productions introduce dependent type-level constructs such as if-then-else types, type quantifiers, and the kinds Int, Type, Order, Bool. The Sail instruction-set semantics specification language
[4] The <exp> and <atomic_exp> productions define the Sail expression language, including function application, projection, type ascription, references, sizeof, constraint, struct literals, vector literals and updates, list and vector comprehensions, blocks, let, var, return, throw, if, match, try, foreach, repeat and while loops with optional termination measures. The Sail instruction-set semantics specification language
[5] BNF grammars are also used to formalize the surface syntax of other languages, such as the BSL (boldsea Semantic Language) executable-ontology language. Executable Ontologies: Synthesizing Event Semantics with Dataflow Architecture
[6] Supplying a BNF grammar as part of the prompt context for large language models substantially improves syntactic and structural validity when generating code in domain-specific languages. Text2DSL: LLM-Based Code Generation for Domain-Specific Languages