Generator Configuration Construction

PrimaryExpr :=

| '<*' ItemGenConfig ':' NtGenConfigList '*>'

| '<*' ItemGenConfig ':' NtGenConfigList ',' '*>'

| '<*' ItemGenConfig ':' '*>'

| '<*' ItemGenConfig '*>'

These are bridging productions from the nonterminal PrimaryExpr in C, which is to match expressions with the highest precedence (i.e. those without operators inside). Here, they are use for the generator configuration construction expresssion, which is wrapped in side a pair of and '<*' and '*>'. The type for this expression is compatible with the variable that are declared with the 'giglconfig' specifier. The first two productions are the common form, with the second one allowing an extra comma near the end. The last two production should be rarely used, which does not specify anything about (nonterminal) node generators. The symbol ':' separates the two major parts (as follows).

  • ItemGenConfig (see below) is a nonterminal for setting configurations at the item (wrapper) level.

  • NtGenConfigList (see below) is a nonterminal for setting configurations at the node level.

ItemGenConfig := TypeName_t GiglGenSettingArgs

This production expands the nontermial ItemGenConfig.

  • TypeName_t is a terminal in C that matches any valid type names, which is the name item type here.

  • GiglGenSettingArgs (see below) is a nonterminal for setting a list of configure parameters (wrapped in '{' and '}'), here at the item level.

NtGenConfigList :=

| NtGenConfig

| NtGenConfigList ',' NtGenConfig

NtGenConfig := Identifier_t ':=' RuleGenConfigSet

RuleGenConfigSet :=

| RuleGenConfig

| '|' RuleGenConfig

| RuleGenConfigSet '|' RuleGenConfig

RuleGenConfig :=

| Identifier_t GiglGenSettingArgs '@' '{' GiglGenSettingExpr '}'

| Identifier_t GiglGenSettingArgs

These are sets of productions starting from the nontermial NtGenConfigList. This part contains the configuration setting for all nonterminals, separated by ','s. For each nonterminal, the setting for different rules are spearated by '|'s (optionally with a leading '|'), and in a similar fashion as how rules are declared.

    • Identifier_t is a terminal in C that matches any valid identifier names, which is the name of the nonterminal type in the first instance (the one from NtGenConfig) and the name of the rule in later instances (the one from RuleGenConfig).

  • GiglGenSettingArgs (see below) is a nonterminal for setting a list of configure parameters (wrapped in '{' and '}'), here at the node level.

  • GiglGenSettingExpr (see below) is a nonterminal for setting a single of configure parameter, here for setting the probability of the rule.

GiglGenSettingArgs :=

| '{' GiglGenSettingExprList '}'

| '{' GiglGenSettingExprList ',' '}'

| '{' '}'

| <empty>

GiglGenSettingExprList :=

| GiglGenSettingExpr

| GiglGenSettingExprList ',' GiglGenSettingExpr

GiglGenSettingExpr := AssignExpr

These are sets of productions starting from the nontermial GiglGenSettingArgs, for setting a list of configure parameters. This part is in wrapped in '{' and '}', containing a list of expressions separated by ','s, optionally with a trailing ','. It could be empty, which is equivalent to a pair of '{' and '}' with nothing in it. Every GiglGenSettingExpr is interpreted as a lambda expression (e.g. by default, if there is random number generator call and the configure parameter is for the node level, then different node may get different values) and variables available in the scope are by default bound by references (as opposed to by values), and supports features like forcing configuration time evaluation. In addition, if it is inside the rule probability field as mentioned above, it also supports rule probability referencing features.

  • AssignExpr is a nonterminal in C to match an expression with precedence equal or higher than assignments (almost every expression, excluding those constructed by comma operators). We do not directly AssignExpr use in place of GiglGenSettingExpr, because it is easier to implement the special semantics of configure parameters and rule probability referencing in this way.