Item Generator/Constructor Call

AdditiveExpr :=

| 'generate' TypeName_t 'with' CastExpr

| 'construct' TypeName_t '(' ArgumentExprList ')' 'with' CastExpr

| 'construct' TypeName_t '(' ArgumentExprList ') 'noconfig'

These are bridging productions from the nonterminal AdditiveExpr in C, which is to match expressions with precedence equal or higher than additions. The production with the 'generate' keyword is for calls to item generators while those with the 'construct' keyword are for calls to item constructors. A generator take a configuration after the 'with' keyword, and a constructor take the root node of the item tree as parameter inside '(' and ')'. The second production is the mixed item constructor, where the root is passed in and the configuration is set as well, as some sub-part of the item tree is still created by node generators which depends on the configuration. For additional discussions about generate versus construct, please refer to this. Also note that all productions here are for generator/constructor calls at the item level, as opposed to their counterparts at the node level. For additional discussions about item (wrapper) versus node, please refer to this.

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

  • ArgumentExprList is a nonterminal in C for a list of expressions to pass as arguments. Here the constructor should only take one argument (the root node). It is not implemented directly with a nonterminal for a single expression only because of the issue of parser conflict (related to the interaction with node generator/constructor syntax). Inside this scope, any node constructor can omit the 'construct' keyword.

  • CastExpr is a nonterminal, which is to match expressions with precedence equal or higher than type-casts. Here the it is the generator configuration. This can often be its construction, or alternatively it can be a variable of suitable type that stores this configuration (see this).