Compartir a través de


Rules

[This content is no longer valid. For the latest information on "M", "Quadrant", SQL Server Modeling Services, and the Repository, see the Model Citizen blog.]

In MGrammar, you define your language syntax by writing a number of rules that define what valid input in the language looks like. There are three kinds of rules in MGrammar:

  • Token rules.

  • Interleave rules.

  • Syntax rules.

Token rules are used to define the language's fixed keywords and the kinds of literals that can appear associated with the keywords. Token rules are the first to be applied to a stream of input text and are used to tokenize the input, which means to break it into units known as tokens that are processed by other rules.

Interleave rules are used to define whitespace, a term that refers to characters that can be ignored by a language. These characters often include spaces, returns, line feeds and other non-meaningful characters. Interleave rules are the second group of rules to be applied to the input, following the tokenizing of the input stream.

Syntax rules are the last set of rules to be applied to the input stream. These rules specify relationships between the tokens in the input stream.

In This Section

Token Rules

Syntax Rules