Child pages
  • ExtensibleRule
Skip to end of metadata
Go to start of metadata

ExtensibleRule declares the rule that allows you to specify options.   

For example, the following Key rule contains the three options: StringLiteral1, StringLiteral2, and Identifier:

This rule is similar to the following BNF rule:

ExtensibleRule lets you define extension bodies in-place:

ExtensibleRule might not contain any extensions whatsoever:

Extensions can be added later on, for example, in another syntax module defined in a separate assembly.

The reason ExtensibleRule is named “extensible”, is it’s a grammar extension point. Any extensible rule can be extended in a different syntax module (see ExtendSyntax). Besides, the syntax module that extends a rule from another module can be defined in the assembly with the one being extended, as well as in a separate assembly.

Rules can be extended dynamically. It can be done during the grammar loading process as well as during the parsing. This way Nitra-based languages grammar can be dynamically changed, which may be useful when creating changeable syntax languages (such as Nemerle), or when applying extensions to classic languages and DSL.

See also


  • No labels