Model Definition Grammar and Syntax—EBNF
The following section shows all possible grammar structures of the language used to write a model definition. It is written using the EBNF (Extended Backus–Naur form), which is a formal notation that can be used to describe other languages.
Each definition can have only one model. Reserved model names are reservations and default.
model = 'model', model_name, '{', partitions, rule*, '}' ; model_name = quoted_string ; partitions = 'partitions', '{', partition*, '}' ; |
partition = 'partition', partition_name, '{', feature_spec*, '}' ; partition_name = quoted_string ; |
feature_spec = feature_name, feature_version, amount ; feature_name = quoted_string ; feature_version = major_version, [ '.', minor_version ] ; major_version = digit+ ; minor_version = digit+ ; amount = integer_amount | percentage_amount | 'remainder' ; integer_amount = digit+ ; percentage_amount = digit+, '%' ; |
rule = 'on', compound_matcher, '{', rule_body, '}' ; |
compound_matcher = negatable_matcher, compound_rhs* ; |
compound_rhs = compound_and_rhs | compound_or_rhs ; |
compound_and_rhs AND, negatable_matcher ; compound_or_rhs OR, negatable_matcher ; |
negatable_matcher = negated_matcher | simple_matcher ; |
negated_matcher = NOT, simple_matcher ; |
simple_matcher = hostid_matcher | hostname_matcher | hosttype_matcher | vendor_dictionary_matcher | any_matcher ; |
hostid_matcher = 'hostid', '(', parameter_list, ')' ; hostname_matcher = 'hostname', '(', parameter_list, ')' ; hosttype_matcher = 'hosttype', '(' parameter_list, ')' ; vendor_dictionary_matcher = 'dictionary', '(', keyword_parameter_list, ')' ; any_matcher = 'any', '(', ')' ; |
parameter_list = parameter, (',', parameter)* ; parameter = quoted_string ; keyword_parameter_list = keyword_parameter, (',', keyword_parameter)* ; |
keyword_parameter = keyword_key, ':', keyword_value ; keyword_key = quoted_string ; keyword_value = '*' | quoted_string ; |
rule_body = [use_statement] [server_specified] [action] ; use_statement = 'use', partition_name_list ; |
server_specified = 'without' 'requested' 'features' '{' partition_server_specified | feature_server_specified '}' ; |
partition_server_specified = 'all' 'from' partition_name_list ; feature_server_specified = feature_spec* ; |
partition_name_list = partition_name, (',', partition_name) ; |
action = 'accept' | 'deny' | 'continue' ; |
quoted_string = '\"" character* '\"; |
AND = 'and' | '&&' ; OR = 'or | '||' ; NOT = 'not' | '!' ; |
Note:When reading the EBNF, note the following:
• | Optional elements are represented inside square brackets ([ ]) . |
• | An asterisk (*) denotes that the preceding symbol or parenthesized expression may occur one or more times. |
• | A plus sign (+) denotes that the preceding symbol or parenthesized expression may occur zero or more times. |
• | Feature versions have the format NNNN.NN. |
• | Strings cannot be multi-line. |
• | Multiple feature_spec elements can optionally be separated by commas. |
• | If a backslash character is used inside a string, it must be escaped using a second single backslash ( \\ ). |
• | If a double-quote character is used inside a string, it must be escaped using a backslash ( \" ). |